9
9
tags : [ '*' ]
10
10
pull_request :
11
11
branches : [ master, 'maint/*' ]
12
+ schedule :
13
+ - cron : ' 0 0 * * *'
14
+
15
+ concurrency :
16
+ group : python-${{ github.ref }}
17
+ cancel-in-progress : true
12
18
13
19
jobs :
20
+ check_if_skip :
21
+ runs-on : ubuntu-latest
22
+ outputs :
23
+ commit_message : ${{ steps.get_commit_message.outputs.commit_message }}
24
+ steps :
25
+ - name : Get repo
26
+ uses : actions/checkout@v3
27
+ with :
28
+ ref : ${{ github.event.pull_request.head.sha }}
29
+ - name : Print head git commit message
30
+ id : get_commit_message
31
+ run : |
32
+ if [[ -z "$COMMIT_MSG" ]]; then
33
+ COMMIT_MSG=$(git show -s --format=%s)
34
+ fi
35
+ echo $COMMIT_MSG
36
+ echo "::set-output name=commit_message::$COMMIT_MSG"
37
+ env :
38
+ COMMIT_MSG : ${{ github.event.head_commit.message }}
39
+
14
40
build :
15
- if : " !contains(github.event.head_commit.message, '[skip ci]')"
41
+ needs : check_if_skip
42
+ if : " !contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
16
43
runs-on : ubuntu-latest
17
- strategy :
18
- matrix :
19
- python-version : ["3.10"]
20
44
steps :
21
45
- uses : actions/checkout@v3
22
46
with :
23
47
fetch-depth : 0
24
- - name : Set up Python ${{ matrix.python-version }}
25
- uses : actions/setup-python@v3
48
+ - name : Set up Python 3
49
+ uses : actions/setup-python@v4
26
50
with :
27
- python-version : ${{ matrix.python-version }}
51
+ python-version : 3
28
52
- name : Display Python version
29
53
run : python -c "import sys; print(sys.version)"
30
54
- name : Check python version and install build
@@ -42,24 +66,40 @@ jobs:
42
66
43
67
get_data :
44
68
runs-on : ubuntu-latest
69
+ defaults :
70
+ run :
71
+ shell : bash -l {0}
45
72
steps :
46
73
- name : Create test data directory
47
74
run : mkdir -p $HOME/.cache/stanford-crn
48
75
- name : Load test data cache
49
- uses : actions/cache@v2
76
+ uses : actions/cache@v3
50
77
id : stanford-crn
51
78
with :
52
79
path : ~/.cache/stanford-crn/
53
80
key : data-v0-${{ github.ref_name }}-${{ github.sha }}
54
81
restore-keys : |
55
82
data-v0-${{ github.ref_name }}-
56
83
data-v0-
84
+ - name : Setup conda
85
+ uses : conda-incubator/setup-miniconda@v2
86
+ with :
87
+ auto-activate-base : true
88
+ activate-environment : " "
89
+ - name : Verify environment
90
+ run : |
91
+ conda info
92
+ which python
57
93
- name : Install datalad
58
94
run : |
59
- sudo apt-get update -y
60
- sudo apt-get install -y git-annex --no-install-recommends
61
- python -m pip install datalad==0.14.7 datalad-osf
95
+ python -m pip install datalad-installer
96
+ datalad-installer --sudo ok git-annex
97
+ python -m pip install datalad datalad-osf
62
98
datalad wtf
99
+ - name : Pacify git
100
+ run : |
101
+ git config --global user.email "[email protected] "
102
+ git config --global user.name "Niworkflows Action"
63
103
- name : Fetch test data
64
104
run : |
65
105
DS=$HOME/.cache/stanford-crn
83
123
install : wheel
84
124
- python-version : 3.9
85
125
install : editable
126
+
86
127
env :
87
128
INSTALL_TYPE : ${{ matrix.install }}
88
129
@@ -91,17 +132,17 @@ jobs:
91
132
with :
92
133
fetch-depth : 0
93
134
- name : Set up Python ${{ matrix.python-version }}
94
- uses : actions/setup-python@v3
135
+ uses : actions/setup-python@v4
95
136
with :
96
137
python-version : ${{ matrix.python-version }}
97
138
- name : Load test data cache
98
- uses : actions/cache@v2
139
+ uses : actions/cache@v3
99
140
id : stanford-crn
100
141
with :
101
142
path : ~/.cache/stanford-crn/
102
143
key : data-v0-${{ github.ref_name }}-${{ github.sha }}
103
144
- name : Load TemplateFlow cache
104
- uses : actions/cache@v2
145
+ uses : actions/cache@v3
105
146
id : templateflow
106
147
with :
107
148
path : ~/.cache/templateflow
@@ -142,20 +183,85 @@ jobs:
142
183
test "${INSTALLED_VERSION}" = "${THISVERSION}"
143
184
- name : Install test dependencies
144
185
run : python -m pip install "niworkflows[tests]"
186
+ - name : Set TEST_DATA_HOME
187
+ run : echo "TEST_DATA_HOME=$HOME/.cache/stanford-crn" >> $GITHUB_ENV
145
188
- name : Run tests
146
189
uses : GabrielBB/xvfb-action@v1
147
190
with :
148
191
run : pytest -sv --no-xvfb --doctest-modules --cov niworkflows niworkflows
149
192
- uses : codecov/codecov-action@v2
150
193
name : Submit to CodeCov
151
194
195
+ test-pre :
196
+ needs : [get_data, check_if_skip]
197
+ if : ${{ !contains(needs.check_if_skip.outputs.commit_message, '[skip pre]') }}
198
+ runs-on : ubuntu-latest
199
+ strategy :
200
+ matrix :
201
+ python-version : [3.7, 3.8, 3.9, "3.10"]
202
+ install : [repo]
203
+ pip-flags : ['--pre']
204
+
205
+ env :
206
+ INSTALL_TYPE : ${{ matrix.install }}
207
+ PIP_FLAGS : ${{ matrix.pip-flags }}
208
+
209
+ steps :
210
+ - name : Debug commit message
211
+ run : echo "${{ needs.check_if_skip.outputs.commit_message }}"
212
+ - uses : actions/checkout@v3
213
+ with :
214
+ fetch-depth : 0
215
+ - name : Set up Python ${{ matrix.python-version }}
216
+ uses : actions/setup-python@v4
217
+ with :
218
+ python-version : ${{ matrix.python-version }}
219
+ - name : Load test data cache
220
+ uses : actions/cache@v3
221
+ id : stanford-crn
222
+ with :
223
+ path : ~/.cache/stanford-crn/
224
+ key : data-v0-${{ github.ref_name }}-${{ github.sha }}
225
+ - name : Load TemplateFlow cache
226
+ uses : actions/cache@v3
227
+ id : templateflow
228
+ with :
229
+ path : ~/.cache/templateflow
230
+ key : templateflow-v0-${{ github.ref_name }}-${{ strategy.job-index }}-${{ github.sha }}
231
+ restore-keys : |
232
+ templateflow-v0-${{ github.ref_name }}-
233
+ templateflow-v0-
234
+ - name : Install package
235
+ run : python -m pip install $PIP_FLAGS .
236
+ - name : Check version
237
+ run : |
238
+ # Interpolate version
239
+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then
240
+ TAG=${GITHUB_REF##*/}
241
+ fi
242
+ THISVERSION=$( python get_version.py )
243
+ THISVERSION=${TAG:-$THISVERSION}
244
+ INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
245
+ echo "VERSION: \"${THISVERSION}\""
246
+ echo "INSTALLED: \"${INSTALLED_VERSION}\""
247
+ test "${INSTALLED_VERSION}" = "${THISVERSION}"
248
+ - name : Install test dependencies
249
+ run : python -m pip install $PIP_FLAGS "niworkflows[tests]"
250
+ - name : Set TEST_DATA_HOME
251
+ run : echo "TEST_DATA_HOME=$HOME/.cache/stanford-crn" >> $GITHUB_ENV
252
+ - name : Run tests
253
+ run : pytest -sv --doctest-modules -n auto --cov niworkflows niworkflows
254
+ - uses : codecov/codecov-action@v3
255
+ name : Submit to CodeCov
256
+
152
257
flake8 :
153
- if : " !contains(github.event.head_commit.message, '[skip ci]')"
258
+ needs : check_if_skip
259
+ if : " !contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
154
260
runs-on : ubuntu-latest
155
261
steps :
156
262
- uses : actions/checkout@v3
157
263
- name : Set up Python 3.7
158
- uses : actions/setup-python@v3
264
+ uses : actions/setup-python@v4
159
265
with :
160
266
python-version : 3.7
161
267
- run : pip install flake8
0 commit comments