Skip to content

Commit f16bb01

Browse files
committed
improve coverage reporting
1 parent a19fe9c commit f16bb01

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

.github/workflows/build.yaml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
path: bioimageio_cache
9494
key: ${{needs.populate-cache.outputs.cache-key}}
9595
- name: pytest
96-
run: pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
96+
run: pytest --cov bioimageio --cov-append --capture no --disable-pytest-warnings
9797
env:
9898
BIOIMAGEIO_CACHE_PATH: bioimageio_cache
9999
RUN_EXPENSIVE_TESTS: ${{ matrix.run-expensive-tests && 'true' || 'false' }}
@@ -104,20 +104,45 @@ jobs:
104104
path: bioimageio_cache
105105
key: ${{needs.populate-cache.outputs.cache-key}}
106106

107-
- if: matrix.report-coverage && github.event_name == 'pull_request'
108-
uses: orgoro/[email protected]
107+
- run: cp .coverage .coverage.${{matrix.python-version}}-${{matrix.numpy-version}}
108+
- uses: actions/upload-artifact@v4
109+
with:
110+
name: .coverage.${{matrix.python-version}}-${{matrix.numpy-version}}
111+
retention-days: 1
112+
path: .coverage.${{matrix.python-version}}-${{matrix.numpy-version}}
113+
include-hidden-files: true
114+
115+
coverage:
116+
needs: [test]
117+
runs-on: ubuntu-latest
118+
steps:
119+
- uses: actions/checkout@v4
120+
- uses: actions/setup-python@v6
121+
- run: |
122+
pip install coverage
123+
- uses: actions/download-artifact@v4
124+
with:
125+
pattern: .coverage.*
126+
merge-multiple: true
127+
- run: |
128+
ls -la .coverage*
129+
coverage combine
130+
coverage xml -o coverage.xml
131+
- uses: orgoro/[email protected]
109132
with:
110133
coverageFile: coverage.xml
111-
token: ${{secrets.GITHUB_TOKEN}}
112-
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
134+
token: ${{ secrets.GITHUB_TOKEN }}
135+
thresholdAll: 0.7
136+
thresholdNew: 0.9
137+
thresholdModified: 0.6
138+
- name: generate coverage badge and html report
113139
run: |
114140
pip install genbadge[coverage]
115141
genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
116142
coverage html -d dist/coverage
117-
- if: matrix.report-coverage && github.ref == 'refs/heads/main'
118-
uses: actions/upload-artifact@v4
143+
- uses: actions/upload-artifact@v4
119144
with:
120-
name: coverage
145+
name: coverage-summary
121146
retention-days: 1
122147
path: dist
123148

@@ -157,7 +182,7 @@ jobs:
157182
- uses: actions/checkout@v4
158183
- uses: actions/download-artifact@v4
159184
with:
160-
name: coverage
185+
name: coverage-summary
161186
path: dist
162187
- uses: actions/setup-python@v6
163188
with:

0 commit comments

Comments
 (0)