Add coverage commenting #104
Workflow file for this run
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: Python Tests | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| slow: | |
| description: Run slow tests | |
| required: false | |
| default: true | |
| type: boolean | |
| e2e: | |
| description: Run end-to-end tests | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| unit: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup venv | |
| uses: ./.github/actions/setup-venv | |
| - name: Run non-ubuntu quick tests | |
| id: run-unit-tests | |
| if: matrix.os != 'ubuntu-latest' | |
| shell: bash | |
| run: > | |
| uv run pytest \ | |
| -m "unit" \ | |
| --junitxml=pytest-quick.xml \ | |
| --cov=src tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| - name: Run ubuntu quick tests | |
| id: run-quick-ubuntu-tests | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: > | |
| uv run pytest \ | |
| -m "not slow and not full_pipeline" \ | |
| --runner=docker \ | |
| --junitxml=pytest-quick.xml \ | |
| --cov=src tests \ | |
| --log-level=DEBUG \ | |
| --verbose | |
| - name: Run slow tests | |
| if: matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.slow == true | |
| shell: bash | |
| run: > | |
| uv run pytest \ | |
| -m "slow" \ | |
| --runner=docker \ | |
| --junitxml=pytest-slow.xml \ | |
| --cov=src tests \ | |
| --cov-append \ | |
| --verbose | |
| - name: Run full pipeline tests | |
| if: matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.e2e == true | |
| shell: bash | |
| run: > | |
| uv run pytest \ | |
| -m "full_pipeline" \ | |
| --runner=docker \ | |
| --junitxml=pytest-full.xml \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov=src tests \ | |
| --cov-append \ | |
| --verbose | |
| - name: Generate combined coverage report | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: > | |
| uv run coverage xml -o coverage.xml | |
| - name: Merge JUnitXml files | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: > | |
| uv run scripts/merge_cov_junitxml.py | |
| - name: Pytest coverage comment | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: MishaKav/pytest-coverage-comment@v1 | |
| with: | |
| pytest-xml-coverage-path: ./coverage.xml | |
| junitxml-path: ./pytest.xml | |
| ruff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup venv | |
| uses: ./.github/actions/setup-venv | |
| with: | |
| only-dev: true | |
| - name: Ruff format | |
| run: uv run ruff format --check | |
| - name: Ruff check | |
| run: uv run ruff check | |
| mypy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup venv | |
| uses: ./.github/actions/setup-venv | |
| - run: | | |
| uv run mypy . | |
| deptry: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup venv | |
| uses: ./.github/actions/setup-venv | |
| - run: |- | |
| uv run deptry ./src |