diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7ac39e0 --- /dev/null +++ b/.github/workflows/test.yml @@ -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