14
14
15
15
16
16
jobs :
17
+ check_if_skip :
18
+ runs-on : ubuntu-latest
19
+ outputs :
20
+ commit_message : ${{ steps.get_commit_message.outputs.commit_message }}
21
+ steps :
22
+ - name : Get repo
23
+ uses : actions/checkout@v3
24
+ with :
25
+ ref : ${{ github.event.pull_request.head.sha }}
26
+ - name : Print head git commit message
27
+ id : get_commit_message
28
+ run : |
29
+ COMMIT_MSG=${{ github.event.head_commit.message }}
30
+ if [[ -z $COMMIT_MSG ]]; then
31
+ COMMIT_MSG=$(git show -s --format=%s)
32
+ fi
33
+ echo $COMMIT_MSG
34
+ echo "::set-output name=commit_message::$COMMIT_MSG"
35
+
17
36
build :
18
- if : " !contains(github.event.head_commit.message, '[skip ci]')"
37
+ needs : check_if_skip
38
+ if : " !contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
19
39
runs-on : ubuntu-latest
20
40
strategy :
21
41
matrix :
@@ -95,17 +115,90 @@ jobs:
95
115
matrix :
96
116
python-version : [3.7, 3.8, 3.9]
97
117
install : [repo]
98
- pip-flags : ['', '--pre']
99
118
include :
100
119
- python-version : 3.9
101
120
install : sdist
102
- pip-flags : ' '
103
121
- python-version : 3.9
104
122
install : wheel
105
- pip-flags : ' '
106
123
- python-version : 3.9
107
124
install : editable
108
- pip-flags : ' '
125
+
126
+ env :
127
+ INSTALL_TYPE : ${{ matrix.install }}
128
+
129
+ steps :
130
+ - uses : actions/checkout@v3
131
+ with :
132
+ fetch-depth : 0
133
+ - name : Set up Python ${{ matrix.python-version }}
134
+ uses : actions/setup-python@v3
135
+ with :
136
+ python-version : ${{ matrix.python-version }}
137
+ - name : Load test data cache
138
+ uses : actions/cache@v2
139
+ id : stanford-crn
140
+ with :
141
+ path : ~/.cache/stanford-crn/
142
+ key : data-v0-${{ github.ref_name }}-${{ github.sha }}
143
+ - name : Load TemplateFlow cache
144
+ uses : actions/cache@v2
145
+ id : templateflow
146
+ with :
147
+ path : ~/.cache/templateflow
148
+ key : templateflow-v0-${{ github.ref_name }}-${{ strategy.job-index }}-${{ github.sha }}
149
+ restore-keys : |
150
+ templateflow-v0-${{ github.ref_name }}-
151
+ templateflow-v0-
152
+ - name : Fetch packages
153
+ uses : actions/download-artifact@v3
154
+ with :
155
+ name : dist
156
+ path : dist/
157
+ - name : Select archive
158
+ run : |
159
+ if [ "$INSTALL_TYPE" = "sdist" ]; then
160
+ ARCHIVE=$( ls dist/*.tar.gz )
161
+ elif [ "$INSTALL_TYPE" = "wheel" ]; then
162
+ ARCHIVE=$( ls dist/*.whl )
163
+ elif [ "$INSTALL_TYPE" = "repo" ]; then
164
+ ARCHIVE="."
165
+ elif [ "$INSTALL_TYPE" = "editable" ]; then
166
+ ARCHIVE="-e ."
167
+ fi
168
+ echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
169
+ - name : Install package
170
+ run : python -m pip install $ARCHIVE
171
+ - name : Check version
172
+ run : |
173
+ # Interpolate version
174
+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then
175
+ TAG=${GITHUB_REF##*/}
176
+ fi
177
+ THISVERSION=$( python get_version.py )
178
+ THISVERSION=${TAG:-$THISVERSION}
179
+ INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
180
+ echo "VERSION: \"${THISVERSION}\""
181
+ echo "INSTALLED: \"${INSTALLED_VERSION}\""
182
+ test "${INSTALLED_VERSION}" = "${THISVERSION}"
183
+ - name : Install test dependencies
184
+ run : python -m pip install "niworkflows[tests]"
185
+ - name : Run tests
186
+ uses : GabrielBB/xvfb-action@v1
187
+ with :
188
+ run : pytest -sv --no-xvfb --doctest-modules --cov niworkflows niworkflows
189
+ - uses : codecov/codecov-action@v2
190
+ name : Submit to CodeCov
191
+
192
+ test-pre :
193
+ needs : [build, get_data, check_if_skip]
194
+ if : ${{ !contains(needs.check_if_skip.outputs.commit_message, '[skip pre]') }}
195
+ runs-on : ubuntu-latest
196
+ strategy :
197
+ matrix :
198
+ python-version : [3.7, 3.8, 3.9]
199
+ install : [repo]
200
+ pip-flags : ['--pre']
201
+ include :
109
202
# VTK won't build official 3.10 wheels before 9.2.0
110
203
# PyVista has posted dev versions, at least
111
204
- python-version : ' 3.10'
@@ -117,6 +210,8 @@ jobs:
117
210
PIP_FLAGS : ${{ matrix.pip-flags }}
118
211
119
212
steps :
213
+ - name : Debug commit message
214
+ run : echo "${{ needs.check_if_skip.outputs.commit_message }}"
120
215
- uses : actions/checkout@v3
121
216
with :
122
217
fetch-depth : 0
@@ -180,7 +275,8 @@ jobs:
180
275
name : Submit to CodeCov
181
276
182
277
flake8 :
183
- if : " !contains(github.event.head_commit.message, '[skip ci]')"
278
+ needs : check_if_skip
279
+ if : " !contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
184
280
runs-on : ubuntu-latest
185
281
steps :
186
282
- uses : actions/checkout@v3
0 commit comments