Skip to content

Commit

Permalink
add diff coverage check (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored Jan 7, 2025
1 parent 87beb9c commit 1bc208e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 5 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ jobs:
needs: [test]
steps:
- uses: actions/checkout@v4
with:
# needed for diff-cover
fetch-depth: 0

- name: get coverage files
uses: actions/download-artifact@v4
Expand All @@ -166,7 +169,7 @@ jobs:
with:
enable-cache: true

- run: uv sync --frozen --package pydantic-ai-slim
- run: uv sync --frozen --package pydantic-ai-slim --only-dev
- run: uv run --frozen coverage combine coverage

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

- run: uv run --frozen coverage xml

- run: uv run --frozen diff-cover coverage.xml --html-report index.html

- name: Store diff coverage html
uses: actions/upload-artifact@v4
with:
name: diff-coverage-html
path: index.html

- run: uv run --frozen coverage report --fail-under 95
- run: uv run --frozen diff-cover coverage.xml --fail-under 95

# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check:
Expand Down
1 change: 1 addition & 0 deletions pydantic_ai_slim/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dev = [
"pytest-examples>=0.0.14",
"pytest-mock>=3.14.0",
"pytest-pretty>=1.2.0",
"diff-cover>=9.2.0",
]

[tool.hatch.build.targets.wheel]
Expand Down
59 changes: 55 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1bc208e

Please sign in to comment.