8
8
9
9
defaults :
10
10
run :
11
- shell : micromamba-shell {0}
11
+ shell : bash -el {0}
12
12
13
13
jobs :
14
14
black :
@@ -26,42 +26,58 @@ jobs:
26
26
runs-on : ubuntu-latest
27
27
strategy :
28
28
matrix :
29
- python-version : ['3.8', '3.9', '3.10', '3.11', '3.12']
30
29
include :
31
- - python-version : ' 3.12'
30
+ - python-version : ' 3.8'
31
+ conda-env : py38
32
+ - python-version : ' 3.9'
33
+ conda-env : wo-python
34
+ - python-version : ' 3.9'
35
+ conda-env : tf
36
+ - python-version : ' 3.10'
37
+ conda-env : wo-python
38
+ - python-version : ' 3.11'
39
+ conda-env : full
32
40
run-expensive-tests : true
41
+ - python-version : ' 3.12'
42
+ conda-env : wo-python
43
+ - python-version : ' 3.13'
44
+ conda-env : wo-python
33
45
steps :
46
+ - id : get-env-name
47
+ run : |
48
+ echo "env-name=conda-${{ matrix.conda-env }}-${{ matrix.python-version }}"
49
+ echo "env-name=conda-${{ matrix.conda-env }}-${{ matrix.python-version }}" >> $GITHUB_OUTPUT
50
+ shell : bash
34
51
- uses : actions/checkout@v4
35
- - name : Install Conda environment with Micromamba
36
- if : matrix.python-version != '3.8'
37
- uses : mamba-org/setup-micromamba@v1
38
- with :
39
- cache-downloads : true
40
- cache-environment : true
41
- environment-file : dev/env-wo-python.yaml
42
- create-args : >-
43
- python=${{ matrix.python-version }}
44
- post-cleanup : ' all'
45
- env :
46
- PIP_NO_DEPS : true
47
- - name : Install py3.8 environment
48
- if : matrix.python-version == '3.8'
49
- uses : mamba-org/setup-micromamba@v1
52
+ - uses : conda-incubator/setup-miniconda@v3
50
53
with :
51
- cache-downloads : true
52
- cache-environment : true
53
- environment-file : dev/env-py38.yaml
54
- post-cleanup : ' all'
55
- env :
56
- PIP_NO_DEPS : true
57
- - name : additional setup
58
- run : pip install --no-deps -e .
54
+ auto-update-conda : true
55
+ auto-activate-base : true
56
+ activate-environment : ${{steps.get-env-name.outputs.env-name}}
57
+ channel-priority : strict
58
+ miniforge-version : latest
59
59
- name : Get Date
60
60
id : get-date
61
61
run : |
62
62
echo "date=$(date +'%Y-%b')"
63
63
echo "date=$(date +'%Y-%b')" >> $GITHUB_OUTPUT
64
- shell : bash
64
+ echo "today=$(date -u '+%Y%m%d')"
65
+ echo "today=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
66
+ - name : Cache env
67
+ uses : actions/cache@v4
68
+ with :
69
+ path : ${{ env.CONDA }}/envs/${{steps.get-env-name.outputs.env-name}}
70
+ key : >-
71
+ conda-${{ runner.os }}-${{ runner.arch }}
72
+ -${{steps.get-date.outputs.today }}
73
+ -${{ hashFiles(matrix.conda-env) }}
74
+ -${{env.CACHE_NUMBER }}
75
+ env :
76
+ CACHE_NUMBER : 0
77
+ id : cache
78
+ - name : Update env
79
+ run : conda env update --name=${{steps.get-env-name.outputs.env-name}} --file=dev/env-${{matrix.conda-env}}.yaml python=${{matrix.python-version}}
80
+ if : steps.cache.outputs.cache-hit != 'true'
65
81
- uses : actions/cache@v4
66
82
with :
67
83
path : bioimageio_cache
@@ -77,148 +93,82 @@ jobs:
77
93
runs-on : ubuntu-latest
78
94
strategy :
79
95
matrix :
80
- python-version : ['3.8', '3.12']
81
96
include :
82
- - python-version : ' 3.12'
97
+ - python-version : ' 3.8'
98
+ conda-env : py3.8
99
+ - python-version : ' 3.9'
100
+ conda-env : tf
101
+ - python-version : ' 3.11'
102
+ conda-env : full
83
103
report-coverage : true
84
104
run-expensive-tests : true
85
- steps :
86
- - uses : actions/checkout@v4
87
- - name : Install Conda environment with Micromamba
88
- if : matrix.python-version != '3.8'
89
- uses : mamba-org/setup-micromamba@v1
90
- with :
91
- cache-downloads : true
92
- cache-environment : true
93
- environment-file : dev/env-wo-python.yaml
94
- create-args : >-
95
- python=${{ matrix.python-version }}
96
- post-cleanup : ' all'
97
- env :
98
- PIP_NO_DEPS : true
99
- - name : Install py3.8 environment
100
- if : matrix.python-version == '3.8'
101
- uses : mamba-org/setup-micromamba@v1
102
- with :
103
- cache-downloads : true
104
- cache-environment : true
105
- environment-file : dev/env-py38.yaml
106
- post-cleanup : ' all'
107
- env :
108
- PIP_NO_DEPS : true
109
- - name : additional setup spec
110
- run : |
111
- conda remove --yes --force bioimageio.spec || true # allow failure for cached env
112
- pip install --no-deps git+https://github.com/bioimage-io/spec-bioimage-io
113
- - name : additional setup core
114
- run : pip install --no-deps -e .
115
- - name : Get Date
116
- id : get-date
117
- run : |
118
- echo "date=$(date +'%Y-%b')"
119
- echo "date=$(date +'%Y-%b')" >> $GITHUB_OUTPUT
120
- shell : bash
121
- - uses : actions/cache@v4
122
- with :
123
- path : bioimageio_cache
124
- key : " test-spec-main-${{ steps.get-date.outputs.date }}"
125
- - name : pytest-spec-main
126
- run : pytest --disable-pytest-warnings
127
- env :
128
- BIOIMAGEIO_CACHE_PATH : bioimageio_cache
129
- RUN_EXPENSIVE_TESTS : ${{ matrix.run-expensive-tests && 'true' || 'false' }}
130
- - if : matrix.report-coverage && github.event_name == 'pull_request'
131
-
132
- with :
133
- coverageFile : coverage.xml
134
- token : ${{ secrets.GITHUB_TOKEN }}
135
- - if : matrix.report-coverage && github.ref == 'refs/heads/main'
136
- run : |
137
- pip install genbadge[coverage]
138
- genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
139
- coverage html -d dist/coverage
140
- - if : matrix.report-coverage && github.ref == 'refs/heads/main'
141
- uses : actions/upload-artifact@v4
142
- with :
143
- name : coverage
144
- retention-days : 1
145
- path : dist
146
-
147
-
148
- test-spec-main-tf :
149
- runs-on : ubuntu-latest
150
- strategy :
151
- matrix :
152
- python-version : ['3.9', '3.12']
153
- steps :
154
- - uses : actions/checkout@v4
155
- - uses : mamba-org/setup-micromamba@v1
156
- with :
157
- cache-downloads : true
158
- cache-environment : true
159
- environment-file : dev/env-tf.yaml
160
- condarc : |
161
- channel-priority: flexible
162
- create-args : >-
163
- python=${{ matrix.python-version }}
164
- post-cleanup : ' all'
165
- env :
166
- PIP_NO_DEPS : true
167
- - name : additional setup spec
168
- run : |
169
- conda remove --yes --force bioimageio.spec || true # allow failure for cached env
170
- pip install --no-deps git+https://github.com/bioimage-io/spec-bioimage-io
171
- - name : additional setup core
172
- run : pip install --no-deps -e .
173
- - name : Get Date
174
- id : get-date
175
- run : |
176
- echo "date=$(date +'%Y-%b')"
177
- echo "date=$(date +'%Y-%b')" >> $GITHUB_OUTPUT
178
- shell : bash
179
- - uses : actions/cache@v4
180
- with :
181
- path : bioimageio_cache
182
- key : " test-spec-main-tf-${{ steps.get-date.outputs.date }}"
183
- - run : pytest --disable-pytest-warnings
184
- env :
185
- BIOIMAGEIO_CACHE_PATH : bioimageio_cache
105
+ - python-version : ' 3.12'
106
+ conda-env : tf
186
107
187
- test-spec-conda-tf :
188
- runs-on : ubuntu-latest
189
- strategy :
190
- matrix :
191
- python-version : ['3.9', '3.12']
192
108
steps :
193
- - uses : actions/checkout@v4
194
- - uses : mamba-org/setup-micromamba@v1
195
- with :
196
- cache-downloads : true
197
- cache-environment : true
198
- environment-file : dev/env-tf.yaml
199
- condarc : |
200
- channel-priority: flexible
201
- create-args : >-
202
- python=${{ matrix.python-version }}
203
- post-cleanup : ' all'
204
- env :
205
- PIP_NO_DEPS : true
206
- - name : additional setup
207
- run : pip install --no-deps -e .
208
- - name : Get Date
209
- id : get-date
210
- run : |
211
- echo "date=$(date +'%Y-%b')"
212
- echo "date=$(date +'%Y-%b')" >> $GITHUB_OUTPUT
213
- shell : bash
214
- - uses : actions/cache@v4
215
- with :
216
- path : bioimageio_cache
217
- key : " test-spec-conda-tf-${{ steps.get-date.outputs.date }}"
218
- - name : pytest-spec-tf
219
- run : pytest --disable-pytest-warnings
220
- env :
221
- BIOIMAGEIO_CACHE_PATH : bioimageio_cache
109
+ - id : get-env-name
110
+ run : |
111
+ echo "env-name=main-${{ matrix.conda-env }}-${{ matrix.python-version }}"
112
+ echo "env-name=main-${{ matrix.conda-env }}-${{ matrix.python-version }}" >> $GITHUB_OUTPUT
113
+ - uses : actions/checkout@v4
114
+ - uses : conda-incubator/setup-miniconda@v3
115
+ with :
116
+ auto-update-conda : true
117
+ auto-activate-base : true
118
+ activate-environment : ${{steps.get-env-name.outputs.env-name}}
119
+ channel-priority : strict
120
+ miniforge-version : latest
121
+ - name : Get Date
122
+ id : get-date
123
+ run : |
124
+ echo "date=$(date +'%Y-week%U')"
125
+ echo "date=$(date +'%Y-week%U')" >> $GITHUB_OUTPUT
126
+ echo "today=$(date -u '+%Y%m%d')"
127
+ echo "today=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
128
+ - name : Cache env
129
+ uses : actions/cache@v4
130
+ with :
131
+ path : ${{ env.CONDA }}/envs/${{steps.get-env-name.outputs.env-name}}
132
+ key : >-
133
+ conda-${{ runner.os }}-${{ runner.arch }}
134
+ -${{steps.get-date.outputs.today }}
135
+ -${{ hashFiles(matrix.conda-env) }}
136
+ -${{env.CACHE_NUMBER }}
137
+ env :
138
+ CACHE_NUMBER : 0
139
+ id : cache
140
+ - name : Update env
141
+ run : |
142
+ conda env update --name=${{steps.get-env-name.outputs.env-name}} --file=dev/env-${{matrix.conda-env}}.yaml python=${{matrix.python-version}}
143
+ conda remove --yes --force bioimageio.spec
144
+ if : steps.cache.outputs.cache-hit != 'true'
145
+ - name : Install spec from main branch
146
+ run : pip install --no-deps git+https://github.com/bioimage-io/spec-bioimage-io
147
+ - uses : actions/cache@v4
148
+ with :
149
+ path : bioimageio_cache
150
+ key : " test-spec-main-${{ steps.get-date.outputs.date }}"
151
+ - name : pytest-spec-main
152
+ run : pytest --disable-pytest-warnings
153
+ env :
154
+ BIOIMAGEIO_CACHE_PATH : bioimageio_cache
155
+ RUN_EXPENSIVE_TESTS : ${{ matrix.run-expensive-tests && 'true' || 'false' }}
156
+ - if : matrix.report-coverage && github.event_name == 'pull_request'
157
+
158
+ with :
159
+ coverageFile : coverage.xml
160
+ token : ${{ secrets.GITHUB_TOKEN }}
161
+ - if : matrix.report-coverage && github.ref == 'refs/heads/main'
162
+ run : |
163
+ pip install genbadge[coverage]
164
+ genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
165
+ coverage html -d dist/coverage
166
+ - if : matrix.report-coverage && github.ref == 'refs/heads/main'
167
+ uses : actions/upload-artifact@v4
168
+ with :
169
+ name : coverage
170
+ retention-days : 1
171
+ path : dist
222
172
223
173
conda-build :
224
174
needs : test-spec-conda
@@ -253,9 +203,6 @@ jobs:
253
203
needs : [test-spec-main]
254
204
if : github.ref == 'refs/heads/main'
255
205
runs-on : ubuntu-latest
256
- defaults :
257
- run :
258
- shell : bash -l {0}
259
206
steps :
260
207
- uses : actions/checkout@v4
261
208
- uses : actions/download-artifact@v4
0 commit comments