Add GitHub Actions CI workflow for PR testing
- Runs unit tests with pytest on Python 3.12 - Only triggers on PRs to main branch - Includes code coverage reporting (non-blocking) - Lint checks for code quality (non-blocking) - Integration tests are optional and non-blocking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
run: |
|
||||
pytest -v -m "not integration" --cov=nadlan_mcp --cov-report=xml --cov-report=term
|
||||
continue-on-error: false
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run integration tests (if configured)
|
||||
run: |
|
||||
pytest -v -m integration || echo "Integration tests skipped (requires API access)"
|
||||
continue-on-error: true
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
- name: Run black (check only)
|
||||
run: |
|
||||
black --check nadlan_mcp/ tests/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run isort (check only)
|
||||
run: |
|
||||
isort --check-only nadlan_mcp/ tests/
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run flake8
|
||||
run: |
|
||||
flake8 nadlan_mcp/ tests/ --max-line-length=120 --extend-ignore=E203,W503
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run mypy
|
||||
run: |
|
||||
mypy nadlan_mcp/ --ignore-missing-imports
|
||||
continue-on-error: true
|
||||
Reference in New Issue
Block a user