Tests #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Detect changes | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| v1: | |
| - 'tools/v1_sync_pipeline/**' | |
| - 'docs/v1/**' | |
| v2: | |
| - 'tools/v2_sync_pipeline/**' | |
| - 'docs/v2/**' | |
| workflows: | |
| - '.github/workflows/**' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11.4' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-ci.txt | |
| - name: Ensure v1 sync script is idempotent | |
| if: steps.changes.outputs.v1 == 'true' || steps.changes.outputs.workflows == 'true' | |
| run: | | |
| python tools/v1_sync_pipeline/sync_v1_docs.py --fail-on-diff --summary-file "$GITHUB_STEP_SUMMARY" | |
| python tools/v1_sync_pipeline/qa/check_links.py docs/v1/affinity_api_docs.md | |
| - name: Ensure v2 sync script is idempotent | |
| if: steps.changes.outputs.v2 == 'true' || steps.changes.outputs.workflows == 'true' | |
| run: | | |
| python tools/v2_sync_pipeline/sync_v2_docs.py --fail-on-diff --snapshot-dir tmp/v2 | |
| python tools/v1_sync_pipeline/qa/check_links.py docs/v2/affinity_api_docs.md | |
| - name: Run unit tests | |
| run: | | |
| pytest tests/ -m "not integration" -v --tb=short | |
| - name: Run tests with coverage | |
| run: | | |
| pytest tests/ -m "not integration" --cov=tools/v1_sync_pipeline --cov=tools/v2_sync_pipeline --cov-report=term-missing --cov-report=xml | |
| - name: Upload coverage reports | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false |