Skip to content

Commit 5b6f6d6

Browse files
pyproject, github/workflows: Add diff-cover for CI checks and dependencies
- Added `diff-cover` (>=10.2.0) as a development dependency in `pyproject.toml`. - Modified `test-and-publish.yml` to add a new step for running `diff-cover` during pull request workflows. - Ensures new code meets a minimum 90% coverage threshold. - Generates a Markdown report for coverage in modified code sections. Assisted-by: Codex
1 parent 7ab1038 commit 5b6f6d6

3 files changed

Lines changed: 134 additions & 0 deletions

File tree

.github/workflows/test-and-publish.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ jobs:
3838
run: uvx nox --python ${{ matrix.python-version }} --session tests -- --no-parallel
3939
env:
4040
PDFREST_API_KEY: ${{ secrets.PDFREST_API_KEY }}
41+
- name: Fetch base branch for diff-cover
42+
if: github.event_name == 'pull_request'
43+
run: git fetch origin ${{ github.base_ref }} --depth=1
44+
- name: Run diff-cover (new code must be >= 90%)
45+
if: github.event_name == 'pull_request'
46+
run: >
47+
diff-cover coverage/py${{ matrix.python-version }}/coverage.xml
48+
--compare-branch origin/${{ github.base_ref }}
49+
--fail-under 90
50+
--markdown-report coverage/py${{ matrix.python-version }}/diff-cover.md
4151
- name: Upload coverage reports
4252
if: always()
4353
uses: actions/upload-artifact@v4

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dev = [
3434
"nox>=2025.5.1",
3535
"basedpyright>=1.34.0",
3636
"python-dotenv>=1.0.1",
37+
"diff-cover>=10.2.0",
3738
]
3839

3940
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)