Skip to content

Commit 2d2bbbe

Browse files
committed
add coverage
1 parent 646546f commit 2d2bbbe

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

.github/workflows/build.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ jobs:
8585
run: pip install --no-deps -e .
8686
- name: pytest-spec-main
8787
run: pytest --disable-pytest-warnings
88+
- if: matrix.python-version == '3.12' && github.event_name == 'pull_request'
89+
uses: orgoro/[email protected]
90+
with:
91+
coverageFile: coverage.xml
92+
token: ${{ secrets.GITHUB_TOKEN }}
93+
- if: matrix.python-version == '3.12' && github.event_name != 'pull_request'
94+
run: |
95+
pip install genbadge[coverage]
96+
genbadge coverage --input-file coverage.xml --output-file ./dist/coverage-badge.svg
97+
coverage html -d dist/coverage
98+
- uses: actions/upload-artifact@v4
99+
with:
100+
name: coverage
101+
retention-days: 1
102+
path: dist
103+
88104

89105
test-tf:
90106
runs-on: ubuntu-latest
@@ -140,6 +156,10 @@ jobs:
140156
shell: bash -l {0}
141157
steps:
142158
- uses: actions/checkout@v4
159+
- uses: actions/download-artifact@v4
160+
with:
161+
name: coverage
162+
path: dist
143163
- uses: actions/setup-python@v5
144164
with:
145165
python-version: '3.12'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__pycache__/
2+
.coverage
13
.env
24
.idea/
35
.tox/
@@ -6,6 +8,7 @@
68
**/tmp
79
build/
810
cache
11+
coverage.xml
912
dist/
1013
docs/
1114
typings/pooch/

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typeCheckingMode = "strict"
3030
useLibraryCodeForTypes = true
3131

3232
[tool.pytest.ini_options]
33-
addopts = " -n auto --capture=no --doctest-modules --failed-first"
33+
addopts = "--cov=bioimageio --cov-report=xml -n auto --capture=no --doctest-modules --failed-first"
3434

3535
[tool.ruff]
3636
line-length = 88

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"pdoc",
6262
"psutil", # parallel pytest with 'pytest -n auto'
6363
"pyright",
64+
"pytest-cov",
6465
"pytest-xdist", # parallel pytest
6566
"pytest",
6667
"torch>=1.6",

0 commit comments

Comments
 (0)