Skip to content

Commit 1bc208e

Browse files
authored
add diff coverage check (#623)
1 parent 87beb9c commit 1bc208e

File tree

3 files changed

+71
-5
lines changed

3 files changed

+71
-5
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ jobs:
155155
needs: [test]
156156
steps:
157157
- uses: actions/checkout@v4
158+
with:
159+
# needed for diff-cover
160+
fetch-depth: 0
158161

159162
- name: get coverage files
160163
uses: actions/download-artifact@v4
@@ -166,7 +169,7 @@ jobs:
166169
with:
167170
enable-cache: true
168171

169-
- run: uv sync --frozen --package pydantic-ai-slim
172+
- run: uv sync --frozen --package pydantic-ai-slim --only-dev
170173
- run: uv run --frozen coverage combine coverage
171174

172175
- run: uv run --frozen coverage html --show-contexts --title "PydanticAI coverage for ${{ github.sha }}"
@@ -178,7 +181,18 @@ jobs:
178181
path: htmlcov
179182
include-hidden-files: true
180183

184+
- run: uv run --frozen coverage xml
185+
186+
- run: uv run --frozen diff-cover coverage.xml --html-report index.html
187+
188+
- name: Store diff coverage html
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: diff-coverage-html
192+
path: index.html
193+
181194
- run: uv run --frozen coverage report --fail-under 95
195+
- run: uv run --frozen diff-cover coverage.xml --fail-under 95
182196

183197
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
184198
check:

pydantic_ai_slim/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ dev = [
6060
"pytest-examples>=0.0.14",
6161
"pytest-mock>=3.14.0",
6262
"pytest-pretty>=1.2.0",
63+
"diff-cover>=9.2.0",
6364
]
6465

6566
[tool.hatch.build.targets.wheel]

uv.lock

Lines changed: 55 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)