4444 - name : Install dependencies
4545 if : steps.look-up.outputs.cache-hit != 'true'
4646 run : |
47- pip install --upgrade pip
4847 pip install -e .[dev]
4948 - run : pytest --disable-pytest-warnings tests/test_bioimageio_collection.py::test_rdf_format_to_populate_cache
5049 if : steps.look-up.outputs.cache-hit != 'true'
9493 path : bioimageio_cache
9594 key : ${{needs.populate-cache.outputs.cache-key}}
9695 - name : pytest
97- run : pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
96+ run : pytest --cov bioimageio.core --cov-append --capture no --disable-pytest-warnings
9897 env :
9998 BIOIMAGEIO_CACHE_PATH : bioimageio_cache
10099 RUN_EXPENSIVE_TESTS : ${{ matrix.run-expensive-tests && 'true' || 'false' }}
@@ -105,25 +104,50 @@ jobs:
105104 path : bioimageio_cache
106105 key : ${{needs.populate-cache.outputs.cache-key}}
107106
108- - if : matrix.report-coverage && github.event_name == 'pull_request'
109- 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+ 110132 with :
111133 coverageFile : coverage.xml
112- token : ${{secrets.GITHUB_TOKEN}}
113- - 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
114139 run : |
115140 pip install genbadge[coverage]
116141 genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
117142 coverage html -d dist/coverage
118- - if : matrix.report-coverage && github.ref == 'refs/heads/main'
119- uses : actions/upload-artifact@v4
143+ - uses : actions/upload-artifact@v4
120144 with :
121- name : coverage
145+ name : coverage-summary
122146 retention-days : 1
123147 path : dist
124148
125149 conda-build :
126- needs : test
150+ needs : test # only so we run tests even if the pinned bioimageio.spec version is not yet published on conda-forge yet
127151 runs-on : ubuntu-latest
128152 steps :
129153 - uses : actions/checkout@v4
@@ -159,7 +183,7 @@ jobs:
159183 - uses : actions/checkout@v4
160184 - uses : actions/download-artifact@v4
161185 with :
162- name : coverage
186+ name : coverage-summary
163187 path : dist
164188 - uses : actions/setup-python@v6
165189 with :
@@ -179,65 +203,66 @@ jobs:
179203 branch : gh-pages
180204 folder : dist
181205
182- pip-build :
183- name : Build with pip and publish to PyPI
184- needs : [test, conda-build]
206+ build :
185207 runs-on : ubuntu-latest
186208 steps :
187- - name : Check out the repository
188- uses : actions/checkout@v4
189- with :
190- fetch-depth : 2
191-
192- - name : Set up Python
193- uses : actions/setup-python@v6
209+ - uses : actions/checkout@v4
210+ - uses : actions/setup-python@v6
194211 with :
195212 python-version : ' 3.10'
213+ cache : ' pip'
196214 - name : Install dependencies
197- run : |
198- python -m pip install --upgrade pip
199- pip --version
200- pip install --upgrade build
201- pip install .
215+ run : pip install --upgrade build
202216 - name : Build package
203- run : |
204- python -m build
217+ run : python -m build
218+ - uses : actions/upload-artifact@v4
219+ with :
220+ path : dist/
221+ name : dist
205222
223+ publish :
224+ needs : [test, build, conda-build, docs]
225+ runs-on : ubuntu-latest
226+ environment :
227+ name : release
228+ url : https://pypi.org/project/bioimageio.core/
229+ permissions :
230+ contents : write # required for tag creation
231+ id-token : write # required for pypi publish action
232+ steps :
233+ - name : Check out the repository
234+ uses : actions/checkout@v4
235+ with :
236+ fetch-depth : 2
206237 - name : Check if there is a parent commit
207238 id : check-parent-commit
208239 run : |
209240 echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
210241
211242 - name : Detect new version
212- id : check -version
243+ id : tag -version
213244 if : github.ref == 'refs/heads/main' && steps.check-parent-commit.outputs.sha
214245215246 with :
216- create-tag : false
247+ create-tag : true
217248 version-command : |
218249 python -c "from pathlib import Path;import json;print(p_src.read_text().split('__version__ = \"')[1].split('\"')[0] if (p_src:=Path('src/bioimageio/core/__init__.py')).exists() else json.loads(Path('bioimageio/core/VERSION').read_text())['version'])"
219-
220- - name : Push tag
221- id : tag-version
222- if : github.ref == 'refs/heads/main' && steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
223- uses :
mathieudutour/[email protected] 250+ - uses : actions/download-artifact@v4
251+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.tag
224252 with :
225- github_token : ${{ secrets.GITHUB_TOKEN }}
226- custom_tag : ${{ steps.check-version.outputs.current-version }}
227-
253+ name : dist
254+ path : dist
228255 - name : Publish package on PyPI
229- if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
230- uses : pypa/gh-action-pypi-publish@release/v1.12
256+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.tag
257+ uses : pypa/gh-action-pypi-publish@release/v1
231258 with :
232- user : __token__
233- password : ' ${{ secrets.PYPI_TOKEN }}'
234259 packages-dir : dist/
235- verbose : true
260+
236261 - name : Publish the release notes
237262 if : github.ref == 'refs/heads/main'
238263 uses :
release-drafter/[email protected] 239264 with :
240- publish : " ${{ steps.tag-version.outputs.new_tag != '' }}"
241- tag : ' ${{ steps.tag-version.outputs.new_tag }}'
265+ publish : " ${{ steps.tag-version.outputs.tag != '' }}"
266+ tag : ' ${{ steps.tag-version.outputs.tag }}'
242267 env :
243268 GITHUB_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
0 commit comments