-
Notifications
You must be signed in to change notification settings - Fork 32
/
config.yml
384 lines (374 loc) · 12.4 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
version: 2
jobs:
build:
docker:
- image: docker:18.01.0-ce-git
working_directory: /tmp/src/fitlins
steps:
- run:
name: Install parallel gzip and Python 3
command: |
apk add --no-cache pigz python3
- checkout
- setup_remote_docker
- run:
name: Fetch latest release image
no_output_timeout: 10m
command: |
docker pull poldracklab/fitlins:latest
- run:
name: Build image
no_output_timeout: 30m
command: |
THISVERSION=$( python3 -c 'import fitlins; print(fitlins.__version__)' )
echo "Building version ${CIRCLE_TAG:-$THISVERSION}"
docker build \
--cache-from=poldracklab/fitlins \
--rm=false \
--tag poldracklab/fitlins:latest \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" .
- run:
name: Verify executable can be run
command: docker run --rm -it poldracklab/fitlins:latest --help
- run:
name: Check version
command: |
THISVERSION=$( python3 -c 'import fitlins; print(fitlins.__version__)' )
THISVERSION="${CIRCLE_TAG:-$THISVERSION}"
DOCKERVERSION=$(docker run --rm -it poldracklab/fitlins:latest --version \
| tail -n 1 | sed -e 's/.*fit/fit/' -e 's/[\r\n]//g')
echo "$THISVERSION"
echo "$DOCKERVERSION"
test "$DOCKERVERSION" = "fitlins v$THISVERSION"
- run:
name: Docker save
no_output_timeout: 40m
command: |
mkdir -p /tmp/cache
docker save poldracklab/fitlins:latest \
| pigz -2 -p 3 > /tmp/cache/docker.tar.gz
- persist_to_workspace:
root: /tmp
paths:
- src/fitlins
- save_cache:
key: docker-v0-{{ .Branch }}-{{ .Revision }}-{{ epoch }}
paths:
- /tmp/cache/docker.tar.gz
cache_test_data:
docker:
- image: markiewicz/datalad:0.0.1
working_directory: /tmp/data
steps:
- restore_cache:
keys:
- ds003-v0-{{ .Branch }}-
- ds003-v0-master-
- ds003-v0-
- run:
name: Set git ID
command: |
git config --global user.name 'FitLins CircleCI User'
git config --global user.email '[email protected]'
- run:
name: Install fMRIPrep derivatives of ds000003
command: |
datalad install -r ///labs/poldrack/ds003_fmriprep
datalad update ds003_fmriprep/
datalad get ds003_fmriprep/sub-0{1,2,3}/func/*_space-MNI152NLin2009cAsym_desc-*.nii.gz
datalad get ds003_fmriprep/sub-0{1,2,3}/func/*_desc-confounds_*.tsv
- run:
name: Download a model for ds000003
command: |
mkdir -p ds003_models
curl -sSL https://raw.githubusercontent.com/effigies/BIDS-examples/enh/models/ds003/models/model-001_smdl.json \
-o ds003_models/model-001_smdl.json
- save_cache:
key: ds003-v0-{{ .Branch }}-{{ .BuildNum }}
paths:
- /tmp/data
build_docs:
docker:
- image: python:latest
working_directory: /tmp/src/fitlins
steps:
- run:
name: Check Python version and upgrade pip
command: |
python --version
python -m pip install -U pip setuptools
- run:
name: Install pandoc
command: |
apt-get update
apt-get install -y pandoc
- checkout
- run:
name: Install FitLins
command: |
python -m pip install ".[docs]"
- run:
name: Build docs
command: |
make html
- store_artifacts:
path: /tmp/src/fitlins/docs/_build/html
test_ds003:
machine:
image: circleci/classic:201711-01
working_directory: /tmp/src/fitlins
steps:
- attach_workspace:
at: /tmp
- restore_cache:
keys:
- docker-v0-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- ds003-v0-{{ .Branch }}-
- ds003-v0-master-
- ds003-v0-
- run:
name: Install coverage and codecov
command: |
pyenv install 3.6.3
pyenv local 3.6.3
python -m pip install -U coverage codecov
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
docker info
set +o pipefail
if [ -f /tmp/cache/docker.tar.gz ]; then
sudo apt update && sudo apt -y install pigz
pigz -d --stdout /tmp/cache/docker.tar.gz | docker load
docker images
fi
- run:
name: Run FitLins
no_output_timeout: 2h
command: |
mkdir -p /tmp/ds003/work /tmp/ds003/derivatives
chmod 777 /tmp/ds003/work /tmp/ds003/derivatives
export CONDA_PREFIX=/opt/miniconda-latest/envs/neuro
docker run --rm -it -v /tmp/data/ds003_fmriprep:/data:ro \
-v /tmp/ds003/derivatives:/out \
-v /tmp/ds003/work:/scratch \
-v /tmp/data/ds003_models:/models \
-e COVERAGE_FILE=/scratch/.coverage \
--entrypoint="/neurodocker/startup.sh" \
poldracklab/fitlins:latest \
coverage run \
--rcfile /src/fitlins/docker/multiproc.coveragerc \
$CONDA_PREFIX/bin/fitlins /data/sourcedata /out dataset \
-d /data -m /models/model-001_smdl.json -w /scratch \
--participant-label 01 02 03 --space MNI152NLin2009cAsym \
--n-cpus 2
- run:
name: Combine coverage and submit
command: |
pyenv local 3.6.3
python -m coverage combine \
--rcfile /tmp/src/fitlins/docker/multiproc.coveragerc \
/tmp/ds003/work/.coverage.*
sed -i -e 's/.opt.miniconda-latest.envs.neuro.lib.python3.6.site-packages/\/tmp\/src\/fitlins/g' .coverage
python -m coverage xml
python -m codecov --file coverage.xml --flags ds003 -e CIRCLE_JOB
- store_artifacts:
path: /tmp/ds003
test_packaging:
docker:
- image: python:latest
working_directory: /tmp/src/fitlins
steps:
- run:
name: Check Python version and upgrade pip
command: |
python --version
python -m pip install -U pip setuptools virtualenv twine
- checkout
- run:
name: Build FitLins
command: |
virtualenv --python=python /tmp/venv/build
source /tmp/venv/build/bin/activate
pip install --upgrade "pip>=19.1" setuptools wheel
python setup.py sdist
pip wheel --no-deps -w dist/ .
- store_artifacts:
path: /tmp/src/fitlins/dist
- run:
name: Check sdist distribution
command: |
THISVERSION=$( python -c 'import fitlins; print(fitlins.__version__)' )
THISVERSION="${CIRCLE_TAG:-$THISVERSION}"
twine check dist/fitlins*.tar.gz
virtualenv --python=python /tmp/venv/sdist
source /tmp/venv/sdist/bin/activate
pip install --upgrade "pip>=19.1" setuptools wheel
pip install dist/fitlins*.tar.gz
which fitlins | grep sdist\\/bin
INSTALLED_VERSION=$(fitlins --version)
echo "VERSION: \"$THISVERSION\""
echo "INSTALLED: \"$INSTALLED_VERSION\""
test "$INSTALLED_VERSION" = "fitlins v$THISVERSION"
- run:
name: Check wheel distribution
command: |
THISVERSION=$( python -c 'import fitlins; print(fitlins.__version__)' )
THISVERSION="${CIRCLE_TAG:-$THISVERSION}"
twine check dist/fitlins*.whl
virtualenv --python=python /tmp/venv/wheel
source /tmp/venv/wheel/bin/activate
pip install --upgrade "pip>=19.1" setuptools wheel
pip install dist/fitlins*.whl
which fitlins | grep wheel\\/bin
INSTALLED_VERSION=$(fitlins --version)
echo "VERSION: \"$THISVERSION\""
echo "INSTALLED: \"$INSTALLED_VERSION\""
test "$INSTALLED_VERSION" = "fitlins v$THISVERSION"
deploy_pypi:
docker:
- image: python:latest
working_directory: /tmp/src/fitlins
steps:
- run:
name: Check Python version and upgrade pip
command: |
python --version
python -m pip install -U pip setuptools virtualenv twine
- checkout
- run:
name: Build FitLins
command: |
virtualenv --python=python /tmp/venv/build
source /tmp/venv/build/bin/activate
pip install --upgrade "pip>=19.1" setuptools wheel
python setup.py sdist
pip wheel --no-deps -w dist/ .
- store_artifacts:
path: /tmp/src/fitlins/dist
- run:
name: Upload packages to PyPI
command: |
twine check dist/fitlins*
twine upload dist/fitlins*
deploy_master:
machine:
image: circleci/classic:201711-01
working_directory: /tmp/src/fitlins
steps:
- restore_cache:
keys:
- docker-v0-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
docker info
set +o pipefail
if [ -f /tmp/cache/docker.tar.gz ]; then
zcat /tmp/cache/docker.tar.gz | docker load
docker images
fi
- run:
name: Deploy to Docker Hub
no_output_timeout: 40m
command: |
if [[ -n "$DOCKER_PASS" ]]; then
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker tag poldracklab/fitlins poldracklab/fitlins:master
docker push poldracklab/fitlins:master
fi
deploy_docker:
machine:
image: circleci/classic:201711-01
working_directory: /tmp/src/fitlins
steps:
- restore_cache:
keys:
- docker-v0-{{ .Branch }}-{{ .Revision }}
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
command: |
docker info
set +o pipefail
if [ -f /tmp/cache/docker.tar.gz ]; then
zcat /tmp/cache/docker.tar.gz | docker load
docker images
fi
- run:
name: Deploy to Docker Hub
no_output_timeout: 40m
command: |
if [[ -n "$DOCKER_PASS" ]]; then
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push poldracklab/fitlins:latest
docker tag poldracklab/fitlins poldracklab/fitlins:$CIRCLE_TAG
docker push poldracklab/fitlins:$CIRCLE_TAG
fi
deployable:
docker:
- image: busybox:latest
steps:
- run: echo Deploying!
workflows:
version: 2
fitlins_tests:
jobs:
- build:
filters:
branches:
ignore: /doc\/.*/
tags:
only: /.*/
- cache_test_data:
filters:
branches:
ignore: /doc\/.*/
tags:
only: /.*/
- build_docs:
filters:
tags:
only: /.*/
- test_ds003:
requires:
- build
- cache_test_data
filters:
tags:
only: /.*/
- test_packaging:
filters:
tags:
only: /.*/
- deploy_master:
requires:
- test_ds003
filters:
branches:
only: master
- deploy_docker:
requires:
- test_ds003
- build_docs
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- deploy_pypi:
requires:
- test_ds003
- build_docs
- test_packaging
filters:
branches:
ignore: /.*/
tags:
only: /.*/