diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..eb6a111 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,25 @@ +name: Run tests and upload coverage + +on: push + +jobs: + test: + name: Run tests and collect coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: uv sync + run: | + uv sync --all-groups --all-extras + + - name: Run tests + run: uv run make coverage + + - name: Upload results to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 8184c92..574ff48 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ _build .VSCodeCounter uv.lock + +.coverage +coverage.xml diff --git a/Makefile b/Makefile index 74546a1..f1ba90c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,10 @@ test: test-matrix: nox +.PHONY: coverage +coverage: + pytest --cov --cov-branch --cov-report=xml + .PHONY: docs-html docs-html: make --directory docs/ clean && make --directory docs/ html diff --git a/pyproject.toml b/pyproject.toml index 814a705..bf0cab8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ test = [ "nox>=2025.2.9", "pytest-xdist", "pytest>=7.0", + "pytest-cov", "sphinx_design", "sphinxcontrib-plantuml", ]