Add coverage report steps to test workflow and upload artifacts #8
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: Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
UV_SYSTEM_PYTHON: 1 | |
jobs: | |
test: | |
name: Test with ${{ matrix.python }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.11", "3.12", "3.13"] | |
os: ["ubuntu-latest"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Get coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
- name: Test with pytest | |
run: uv run --all-extras --python ${{ matrix.python }} pytest --cov-append | |
- name: Save coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage.xml | |
coverage-report: | |
name: Coverage report | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Get coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml |