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,60 @@ 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 : setup
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
+ echo "env-file=dev/env-${{ matrix.conda-env }}.yaml"
51
+ echo "env-file=dev/env-${{ matrix.conda-env }}.yaml" >> $GITHUB_OUTPUT
52
+ [ ! -f dev/env-${{ matrix.conda-env }}.yaml ] && exit 1
34
53
- 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
54
+ - uses : conda-incubator/setup-miniconda@v3
38
55
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
50
- 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 .
56
+ auto-update-conda : true
57
+ auto-activate-base : true
58
+ activate-environment : ${{steps.setup.outputs.env-name}}
59
+ channel-priority : strict
60
+ miniforge-version : latest
59
61
- name : Get Date
60
62
id : get-date
61
63
run : |
62
64
echo "date=$(date +'%Y-%b')"
63
65
echo "date=$(date +'%Y-%b')" >> $GITHUB_OUTPUT
64
- shell : bash
66
+ echo "today=$(date -u '+%Y%m%d')"
67
+ echo "today=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
68
+ - name : Cache env
69
+ uses : actions/cache@v4
70
+ with :
71
+ path : ${{ env.CONDA }}/envs/${{steps.setup.outputs.env-name}}
72
+ key : >-
73
+ conda-${{ runner.os }}-${{ runner.arch }}-
74
+ -${{steps.get-date.outputs.today }}-
75
+ -${{ hashFiles(matrix.conda-env) }}-
76
+ -${{env.CACHE_NUMBER }}
77
+ env :
78
+ CACHE_NUMBER : 0
79
+ id : cache
80
+ - name : Update env
81
+ run : conda env update --name=${{steps.setup.outputs.env-name}} --file=${{steps.setup.output.env-file}} python=${{matrix.python-version}}
82
+ if : steps.cache.outputs.cache-hit != 'true'
65
83
- uses : actions/cache@v4
66
84
with :
67
85
path : bioimageio_cache
@@ -77,148 +95,82 @@ jobs:
77
95
runs-on : ubuntu-latest
78
96
strategy :
79
97
matrix :
80
- python-version : ['3.8', '3.12']
81
98
include :
82
- - python-version : ' 3.12'
99
+ - python-version : ' 3.8'
100
+ conda-env : py3.8
101
+ - python-version : ' 3.9'
102
+ conda-env : tf
103
+ - python-version : ' 3.11'
104
+ conda-env : full
83
105
report-coverage : true
84
106
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
107
+ - python-version : ' 3.12'
108
+ conda-env : tf
186
109
187
- test-spec-conda-tf :
188
- runs-on : ubuntu-latest
189
- strategy :
190
- matrix :
191
- python-version : ['3.9', '3.12']
192
110
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
111
+ - id : setup
112
+ run : |
113
+ echo "env-name=main-${{ matrix.conda-env }}-${{ matrix.python-version }}"
114
+ echo "env-name=main-${{ matrix.conda-env }}-${{ matrix.python-version }}" >> $GITHUB_OUTPUT
115
+ - uses : actions/checkout@v4
116
+ - uses : conda-incubator/setup-miniconda@v3
117
+ with :
118
+ auto-update-conda : true
119
+ auto-activate-base : true
120
+ activate-environment : ${{steps.setup.outputs.env-name}}
121
+ channel-priority : strict
122
+ miniforge-version : latest
123
+ - name : Get Date
124
+ id : get-date
125
+ run : |
126
+ echo "date=$(date +'%Y-week%U')"
127
+ echo "date=$(date +'%Y-week%U')" >> $GITHUB_OUTPUT
128
+ echo "today=$(date -u '+%Y%m%d')"
129
+ echo "today=$(date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
130
+ - name : Cache env
131
+ uses : actions/cache@v4
132
+ with :
133
+ path : ${{ env.CONDA }}/envs/${{steps.setup.outputs.env-name}}
134
+ key : >-
135
+ conda-${{ runner.os }}-${{ runner.arch }}
136
+ -${{steps.get-date.outputs.today }}
137
+ -${{ hashFiles(matrix.conda-env) }}
138
+ -${{env.CACHE_NUMBER }}
139
+ env :
140
+ CACHE_NUMBER : 0
141
+ id : cache
142
+ - name : Update env
143
+ run : |
144
+ conda env update --name=${{steps.setup.outputs.env-name}} --file=dev/env-${{matrix.conda-env}}.yaml python=${{matrix.python-version}}
145
+ conda remove --yes --force bioimageio.spec
146
+ if : steps.cache.outputs.cache-hit != 'true'
147
+ - name : Install spec from main branch
148
+ run : pip install --no-deps git+https://github.com/bioimage-io/spec-bioimage-io
149
+ - uses : actions/cache@v4
150
+ with :
151
+ path : bioimageio_cache
152
+ key : " test-spec-main-${{ steps.get-date.outputs.date }}"
153
+ - name : pytest-spec-main
154
+ run : pytest --disable-pytest-warnings
155
+ env :
156
+ BIOIMAGEIO_CACHE_PATH : bioimageio_cache
157
+ RUN_EXPENSIVE_TESTS : ${{ matrix.run-expensive-tests && 'true' || 'false' }}
158
+ - if : matrix.report-coverage && github.event_name == 'pull_request'
159
+
160
+ with :
161
+ coverageFile : coverage.xml
162
+ token : ${{ secrets.GITHUB_TOKEN }}
163
+ - if : matrix.report-coverage && github.ref == 'refs/heads/main'
164
+ run : |
165
+ pip install genbadge[coverage]
166
+ genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg
167
+ coverage html -d dist/coverage
168
+ - if : matrix.report-coverage && github.ref == 'refs/heads/main'
169
+ uses : actions/upload-artifact@v4
170
+ with :
171
+ name : coverage
172
+ retention-days : 1
173
+ path : dist
222
174
223
175
conda-build :
224
176
needs : test-spec-conda
@@ -253,9 +205,6 @@ jobs:
253
205
needs : [test-spec-main]
254
206
if : github.ref == 'refs/heads/main'
255
207
runs-on : ubuntu-latest
256
- defaults :
257
- run :
258
- shell : bash -l {0}
259
208
steps :
260
209
- uses : actions/checkout@v4
261
210
- uses : actions/download-artifact@v4
0 commit comments