@@ -11,22 +11,10 @@ defaults:
1111 shell : bash -el {0}
1212
1313jobs :
14- black :
15- runs-on : ubuntu-latest
16- steps :
17- - uses : actions/checkout@v4
18- - uses : psf/black@stable
19- with :
20- options : " --check"
21- src : " ."
22- jupyter : true
23- version : " 24.3"
24-
2514 populate-cache :
2615 runs-on : ubuntu-latest
2716 outputs :
28- cache-key : ${{steps.cache-key.outputs.cache-key}}
29- cache-key-light : ${{steps.cache-key.outputs.cache-key}}-light
17+ cache-key : ${{steps.cache-key.outputs.cache-key}}-0
3018 steps :
3119 - name : Get Date
3220 id : get-date
4836 with :
4937 path : bioimageio_cache
5038 key : ${{steps.cache-key.outputs.cache-key}}
51- - uses : actions/setup-python@v5
39+ - uses : actions/setup-python@v6
5240 if : steps.look-up.outputs.cache-hit != 'true'
5341 with :
5442 python-version : ' 3.12'
@@ -72,112 +60,62 @@ jobs:
7260 - python-version : ' 3.9'
7361 conda-env : dev
7462 spec : conda
75- - python-version : ' 3.10'
63+ numpy-version : 1
64+ - python-version : ' 3.9'
7665 conda-env : dev
77- spec : conda
78- - python-version : ' 3.11'
79- conda-env : full
8066 spec : main
67+ numpy-version : 2
68+ - python-version : ' 3.10'
69+ conda-env : full
8170 run-expensive-tests : true
8271 report-coverage : true
8372 save-cache : true
84- - python-version : ' 3.12'
85- conda-env : dev
8673 spec : conda
87- - python-version : ' 3.13'
74+ numpy-version : 1
75+ - python-version : ' 3.11'
8876 conda-env : dev
8977 spec : main
90- save-cache : true
78+ numpy-version : 2
79+ - python-version : ' 3.12'
80+ conda-env : dev
81+ spec : conda
82+ numpy-version : 1
83+ # - python-version: '3.13'
84+ # conda-env: '313'
85+ # spec: main
86+ # numpy-version: 2
9187
9288 steps :
9389 - uses : actions/checkout@v4
94- - id : setup
95- run : |
96- echo "env-name=${{ matrix.spec }}-${{ matrix.conda-env }}-${{ matrix.python-version }}"
97- echo "env-name=${{ matrix.spec }}-${{ matrix.conda-env }}-${{ matrix.python-version }}" >> $GITHUB_OUTPUT
98- echo "env-file=dev/env-${{ matrix.conda-env }}.yaml"
99- echo "env-file=dev/env-${{ matrix.conda-env }}.yaml" >> $GITHUB_OUTPUT
100- - name : check on env-file
101- shell : python
102- run : |
103- from pathlib import Path
104- from pprint import pprint
105- if not (env_path:=Path("${{steps.setup.outputs.env-file}}")).exists():
106- if env_path.parent.exists():
107- pprint(env_path.parent.glob("*"))
108- else:
109- pprint(Path().glob("*"))
110- raise FileNotFoundError(f"{env_path} does not exist")
111-
112- - uses : conda-incubator/setup-miniconda@v3
113- with :
114- auto-update-conda : true
115- auto-activate-base : true
116- activate-environment : ${{steps.setup.outputs.env-name}}
117- channel-priority : strict
118- miniforge-version : latest
119- - name : Get Date
120- id : get-date
121- run : |
122- echo "today=$(date -u '+%Y%m%d')"
123- echo "today=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
124- - name : Restore cached env
125- uses : actions/cache/restore@v4
90+ - uses : actions/setup-python@v6
12691 with :
127- path : ${{env.CONDA}}/envs/${{steps.setup.outputs.env-name}}
128- key : >-
129- conda-${{runner.os}}-${{runner.arch}}
130- -${{steps.get-date.outputs.today}}
131- -${{hashFiles(steps.setup.outputs.env-file)}}
132- -${{env.CACHE_NUMBER}}
133- env :
134- CACHE_NUMBER : 0
135- id : cache-env
136- - name : Install env
137- run : conda env update --name=${{steps.setup.outputs.env-name}} --file=${{steps.setup.outputs.env-file}} python=${{matrix.python-version}}
138- if : steps.cache-env.outputs.cache-hit != 'true'
139- - name : Install uncached pip dependencies
92+ python-version : ${{matrix.python-version}}
93+ cache : ' pip'
94+ - name : Install dependencies
14095 run : |
14196 pip install --upgrade pip
142- pip install --no-deps -e .
143- - name : Install uncached pip dependencies for 'full' environment
144- if : matrix.conda-env == 'full'
145- run : |
146- pip install git+https://github.com/ChaoningZhang/MobileSAM.git
147- - name : Cache env
148- if : steps.cache-env.outputs.cache-hit != 'true'
149- uses : actions/cache/save@v4
150- with :
151- path : ${{env.CONDA}}/envs/${{steps.setup.outputs.env-name}}
152- key : >-
153- conda-${{runner.os}}-${{runner.arch}}
154- -${{steps.get-date.outputs.today}}
155- -${{hashFiles(steps.setup.outputs.env-file)}}
156- -${{env.CACHE_NUMBER}}
157- env :
158- CACHE_NUMBER : 0
159- - run : conda list
97+ pip install -e .[dev] numpy==${{matrix.numpy-version}}.*
16098 - name : Pyright
16199 if : matrix.run-expensive-tests
162100 run : |
163101 pyright --version
164102 pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }}
165- - name : Restore bioimageio cache ${{matrix.run-expensive-tests && needs.populate-cache.outputs.cache-key || needs.populate-cache.outputs.cache-key-light }}
103+ - name : Restore bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
166104 uses : actions/cache/restore@v4
167105 with :
168106 path : bioimageio_cache
169- key : ${{matrix.run-expensive-tests && needs.populate-cache.outputs.cache-key || needs.populate-cache.outputs.cache-key-light }}
107+ key : ${{needs.populate-cache.outputs.cache-key}}
170108 - name : pytest
171109 run : pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
172110 env :
173111 BIOIMAGEIO_CACHE_PATH : bioimageio_cache
174112 RUN_EXPENSIVE_TESTS : ${{ matrix.run-expensive-tests && 'true' || 'false' }}
175- - name : Save bioimageio cache ${{matrix.run-expensive-tests && needs.populate-cache.outputs.cache-key || needs.populate-cache.outputs.cache-key-light }}
113+ - name : Save bioimageio cache ${{needs.populate-cache.outputs.cache-key}}
176114 if : matrix.save-cache
177115 uses : actions/cache/save@v4
178116 with :
179117 path : bioimageio_cache
180- key : ${{matrix.run-expensive-tests && needs.populate-cache.outputs.cache-key || needs.populate-cache.outputs.cache-key-light }}
118+ key : ${{needs.populate-cache.outputs.cache-key}}
181119
182120 - if : matrix.report-coverage && github.event_name == 'pull_request'
183121@@ -223,7 +161,7 @@ jobs:
223161 shell : bash -l {0}
224162 run : |
225163 mkdir -p ./pkgs/noarch
226- conda-build -c conda-forge conda-recipe --no-test -- output-folder ./pkgs
164+ conda-build -c conda-forge conda-recipe --output-folder ./pkgs
227165
228166 docs :
229167 needs : test
@@ -235,7 +173,7 @@ jobs:
235173 with :
236174 name : coverage
237175 path : dist
238- - uses : actions/setup-python@v5
176+ - uses : actions/setup-python@v6
239177 with :
240178 python-version : ' 3.12'
241179 cache : ' pip'
@@ -253,10 +191,9 @@ jobs:
253191 branch : gh-pages
254192 folder : dist
255193
256- publish-pypi :
257- name : Publish to PyPI
194+ pip-build :
195+ name : Build with pip and publish to PyPI
258196 needs : test
259- if : github.ref == 'refs/heads/main'
260197 runs-on : ubuntu-latest
261198 steps :
262199 - name : Check out the repository
@@ -265,16 +202,18 @@ jobs:
265202 fetch-depth : 2
266203
267204 - name : Set up Python
268- uses : actions/setup-python@v5
205+ uses : actions/setup-python@v6
269206 with :
270- python-version : ' 3.12 '
271- - name : Upgrade pip
207+ python-version : ' 3.10 '
208+ - name : Install dependencies
272209 run : |
273210 python -m pip install --upgrade pip
274211 pip --version
275- pip install wheel .[tests]
276- - name : run tests
277- run : pytest --disable-pytest-warnings
212+ pip install --upgrade build
213+ pip install .
214+ - name : Build package
215+ run : |
216+ python -m build
278217
279218 - name : Check if there is a parent commit
280219 id : check-parent-commit
@@ -283,34 +222,31 @@ jobs:
283222
284223 - name : Detect new version
285224 id : check-version
286- if : steps.check-parent-commit.outputs.sha
225+ if : github.ref == 'refs/heads/main' && steps.check-parent-commit.outputs.sha
287226288227 with :
289228 create-tag : false
290229 version-command : |
291- bash -o pipefail -c "cat bioimageio/core/VERSION | jq -r '. version'"
230+ 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']) "
292231
293232 - name : Push tag
294233 id : tag-version
295- if : steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
234+ if : github.ref == 'refs/heads/main' && steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
296235 uses :
mathieudutour/[email protected] 297236 with :
298237 github_token : ${{ secrets.GITHUB_TOKEN }}
299238 custom_tag : ${{ steps.check-version.outputs.current-version }}
300239
301- - name : Build package
302- run : |
303- python setup.py sdist bdist_wheel
304-
305240 - name : Publish package on PyPI
306- if : steps.tag-version.outputs.new_tag
241+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
307242 uses : pypa/gh-action-pypi-publish@release/v1.12
308243 with :
309244 user : __token__
310245 password : " ${{ secrets.PYPI_TOKEN }}"
311246 packages-dir : dist/
312247 verbose : true
313248 - name : Publish the release notes
249+ if : github.ref == 'refs/heads/main'
314250 uses :
release-drafter/[email protected] 315251 with :
316252 publish : " ${{ steps.tag-version.outputs.new_tag != '' }}"
0 commit comments