@@ -11,22 +11,10 @@ defaults:
11
11
shell : bash -el {0}
12
12
13
13
jobs :
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
-
25
14
populate-cache :
26
15
runs-on : ubuntu-latest
27
16
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
30
18
steps :
31
19
- name : Get Date
32
20
id : get-date
48
36
with :
49
37
path : bioimageio_cache
50
38
key : ${{steps.cache-key.outputs.cache-key}}
51
- - uses : actions/setup-python@v5
39
+ - uses : actions/setup-python@v6
52
40
if : steps.look-up.outputs.cache-hit != 'true'
53
41
with :
54
42
python-version : ' 3.12'
@@ -72,112 +60,62 @@ jobs:
72
60
- python-version : ' 3.9'
73
61
conda-env : dev
74
62
spec : conda
75
- - python-version : ' 3.10'
63
+ numpy-version : 1
64
+ - python-version : ' 3.9'
76
65
conda-env : dev
77
- spec : conda
78
- - python-version : ' 3.11'
79
- conda-env : full
80
66
spec : main
67
+ numpy-version : 2
68
+ - python-version : ' 3.10'
69
+ conda-env : full
81
70
run-expensive-tests : true
82
71
report-coverage : true
83
72
save-cache : true
84
- - python-version : ' 3.12'
85
- conda-env : dev
86
73
spec : conda
87
- - python-version : ' 3.13'
74
+ numpy-version : 1
75
+ - python-version : ' 3.11'
88
76
conda-env : dev
89
77
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
91
87
92
88
steps :
93
89
- 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
126
91
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
140
95
run : |
141
96
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}}.*
160
98
- name : Pyright
161
99
if : matrix.run-expensive-tests
162
100
run : |
163
101
pyright --version
164
102
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}}
166
104
uses : actions/cache/restore@v4
167
105
with :
168
106
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}}
170
108
- name : pytest
171
109
run : pytest --cov bioimageio --cov-report xml --cov-append --capture no --disable-pytest-warnings
172
110
env :
173
111
BIOIMAGEIO_CACHE_PATH : bioimageio_cache
174
112
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}}
176
114
if : matrix.save-cache
177
115
uses : actions/cache/save@v4
178
116
with :
179
117
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}}
181
119
182
120
- if : matrix.report-coverage && github.event_name == 'pull_request'
183
121
@@ -223,7 +161,7 @@ jobs:
223
161
shell : bash -l {0}
224
162
run : |
225
163
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
227
165
228
166
docs :
229
167
needs : test
@@ -235,7 +173,7 @@ jobs:
235
173
with :
236
174
name : coverage
237
175
path : dist
238
- - uses : actions/setup-python@v5
176
+ - uses : actions/setup-python@v6
239
177
with :
240
178
python-version : ' 3.12'
241
179
cache : ' pip'
@@ -253,10 +191,9 @@ jobs:
253
191
branch : gh-pages
254
192
folder : dist
255
193
256
- publish-pypi :
257
- name : Publish to PyPI
194
+ pip-build :
195
+ name : Build with pip and publish to PyPI
258
196
needs : test
259
- if : github.ref == 'refs/heads/main'
260
197
runs-on : ubuntu-latest
261
198
steps :
262
199
- name : Check out the repository
@@ -265,16 +202,18 @@ jobs:
265
202
fetch-depth : 2
266
203
267
204
- name : Set up Python
268
- uses : actions/setup-python@v5
205
+ uses : actions/setup-python@v6
269
206
with :
270
- python-version : ' 3.12 '
271
- - name : Upgrade pip
207
+ python-version : ' 3.10 '
208
+ - name : Install dependencies
272
209
run : |
273
210
python -m pip install --upgrade pip
274
211
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
278
217
279
218
- name : Check if there is a parent commit
280
219
id : check-parent-commit
@@ -283,34 +222,31 @@ jobs:
283
222
284
223
- name : Detect new version
285
224
id : check-version
286
- if : steps.check-parent-commit.outputs.sha
225
+ if : github.ref == 'refs/heads/main' && steps.check-parent-commit.outputs.sha
287
226
288
227
with :
289
228
create-tag : false
290
229
version-command : |
291
- bash -o pipefail - c "cat bioimageio/core/VERSION | jq -r '.version' "
230
+ python - c "from pathlib import Path;p = p_src if (p_src:=Path('src/ bioimageio/core/__init__.py')).exists() else Path('bioimageio/core/__init__.py');print(p.read_text().split('__version__ = \"')[1].split('\"')[0]) "
292
231
293
232
- name : Push tag
294
233
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
296
235
uses :
mathieudutour/[email protected]
297
236
with :
298
237
github_token : ${{ secrets.GITHUB_TOKEN }}
299
238
custom_tag : ${{ steps.check-version.outputs.current-version }}
300
239
301
- - name : Build package
302
- run : |
303
- python setup.py sdist bdist_wheel
304
-
305
240
- 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
307
242
uses : pypa/gh-action-pypi-publish@release/v1.12
308
243
with :
309
244
user : __token__
310
245
password : " ${{ secrets.PYPI_TOKEN }}"
311
246
packages-dir : dist/
312
247
verbose : true
313
248
- name : Publish the release notes
249
+ if : github.ref == 'refs/heads/main'
314
250
uses :
release-drafter/[email protected]
315
251
with :
316
252
publish : " ${{ steps.tag-version.outputs.new_tag != '' }}"
0 commit comments