1
- docs_deploy : &docs
2
- docker :
3
- - image : node:8.10.0
4
- steps :
5
- - run :
6
- name : Check whether this is the original repo
7
- command : |
8
- if [[ "$CIRCLE_PROJECT_USERNAME" != "nipreps" ]]; then
9
- echo "Not in nipreps/niworkflows - skipping docs deploy."
10
- circleci step halt
11
- fi
12
- - checkout
13
- - attach_workspace :
14
- at : docs/_build
15
- - run :
16
- name : Disable jekyll builds
17
- command : touch docs/_build/html/.nojekyll
18
- - run :
19
- name : Install and configure dependencies
20
- command : |
21
- npm install -g --silent [email protected]
22
- git config user.email "[email protected] "
23
- git config user.name "Documentation Push"
24
- - add_ssh_keys :
25
- fingerprints :
26
- - " c8:a8:55:7d:1e:08:92:c2:86:29:7b:b4:4b:88:24:51"
27
- - run :
28
- name : Deploy docs to gh-pages branch
29
- command : gh-pages --dotfiles --message "doc(update) [skip ci]" --dist docs/_build/html
30
-
31
- version : 2
1
+ version : 2.1
2
+ orbs :
3
+ docker :
circleci/[email protected]
4
+
32
5
jobs :
33
6
build :
34
7
machine :
35
- image : ubuntu-1604:202007-01
8
+ # https://discuss.circleci.com/t/linux-machine-executor-images-2021-april-q2-update/39928
9
+ # upgrade Docker version
10
+ image : ubuntu-2004:202104-01
36
11
working_directory : /tmp/src/niworkflows
37
12
environment :
38
13
TZ : " /usr/share/zoneinfo/America/Los_Angeles"
39
14
SCRATCH : " /scratch"
40
15
steps :
41
16
- restore_cache :
42
17
keys :
43
- - build-v1-{{ .Branch }}-{{ epoch }}
18
+ - build-v1-{{ .Branch }}-{{ .Revision }}
19
+ - build-v1--{{ .Revision }}
44
20
- build-v1-{{ .Branch }}-
45
21
- build-v1-master-
46
22
- build-v1-
50
26
- run :
51
27
name : Docker authentication
52
28
command : |
53
- if [[ -n $DOCKER_PASS ]]; then
54
- docker login -u $DOCKER_USER -p $DOCKER_PASS
29
+ if [[ -n $DOCKER_PAT ]]; then
30
+ echo "$DOCKER_PAT" | docker login -u $DOCKER_USER --password-stdin
55
31
fi
56
32
- run :
57
33
name : Set up Docker registry
@@ -76,13 +52,13 @@ jobs:
76
52
set -e
77
53
if [[ "$success" = "0" ]]; then
78
54
echo "Pulling from local registry"
79
- docker tag localhost:5000/ubuntu ubuntu:xenial-20191010
55
+ docker tag localhost:5000/ubuntu ubuntu:focal-20210416
80
56
docker pull localhost:5000/niworkflows
81
57
docker tag localhost:5000/niworkflows niworkflows:latest
82
58
else
83
59
echo "Pulling from Docker Hub"
84
- docker pull ubuntu:xenial-20191010
85
- docker tag ubuntu:xenial-20191010 localhost:5000/ubuntu
60
+ docker pull ubuntu:focal-20210416
61
+ docker tag ubuntu:focal-20210416 localhost:5000/ubuntu
86
62
docker push localhost:5000/ubuntu
87
63
fi
88
64
107
83
docker exec -it registry /bin/registry garbage-collect --delete-untagged \
108
84
/etc/docker/registry/config.yml
109
85
- save_cache :
110
- key : build-v1-{{ .Branch }}-{{ epoch }}
86
+ key : build-v1-{{ .Branch }}-{{ .Revision }}
111
87
paths :
112
88
- /tmp/docker
113
89
- /tmp/images
@@ -227,7 +203,7 @@ jobs:
227
203
228
204
test_pytest :
229
205
machine :
230
- image : ubuntu-1604:202007 -01
206
+ image : ubuntu-2004:202104 -01
231
207
working_directory : /tmp/tests
232
208
steps :
233
209
- attach_workspace :
@@ -237,15 +213,16 @@ jobs:
237
213
command : python -m pip install codecov
238
214
- restore_cache :
239
215
keys :
240
- - build-v1-{{ .Branch }}-{{ epoch }}
216
+ - build-v1-{{ .Branch }}-{{ .Revision }}
217
+ - build-v1--{{ .Revision }}
241
218
- build-v1-{{ .Branch }}-
242
219
- build-v1-master-
243
220
- build-v1-
244
221
- run :
245
222
name : Docker authentication
246
223
command : |
247
- if [[ -n $DOCKER_PASS ]]; then
248
- docker login -u $DOCKER_USER -p $DOCKER_PASS
224
+ if [[ -n $DOCKER_PAT ]]; then
225
+ echo "$DOCKER_PAT" | docker login -u $DOCKER_USER --password-stdin
249
226
fi
250
227
- run :
251
228
name : Set up Docker registry
@@ -277,10 +254,9 @@ jobs:
277
254
no_output_timeout : 2h
278
255
command : |
279
256
mkdir -p $PWD/artifacts $PWD/summaries
280
- sudo setfacl -d -m group:ubuntu:rwx $PWD
281
- sudo setfacl -m group:ubuntu:rwx $PWD
282
- docker run -u $( id -u ) -it --rm=false -w /src/niworkflows \
257
+ docker run -u $( id -u ):$( id -g ) -it --rm -w /src/niworkflows \
283
258
-e COVERAGE_FILE=/tmp/summaries/.pytest.coverage \
259
+ -e SAVE_CIRCLE_ARTIFACTS="/tmp/artifacts/" \
284
260
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
285
261
-e FS_LICENSE=/etc/fslicense.txt \
286
262
-v /tmp/fslicense/license.txt:/etc/fslicense.txt:ro \
@@ -302,7 +278,7 @@ jobs:
302
278
name : Run reportlet tests
303
279
no_output_timeout : 2h
304
280
command : |
305
- docker run -u $( id -u ) - it --rm=false -w /src/niworkflows \
281
+ docker run -u $( id -u ):$( id -g ) - it --rm -w /src/niworkflows \
306
282
-e COVERAGE_FILE=/tmp/summaries/.reportlets.coverage \
307
283
-e SAVE_CIRCLE_ARTIFACTS="/tmp/artifacts/" \
308
284
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
@@ -450,7 +426,7 @@ jobs:
450
426
451
427
test_package :
452
428
docker :
453
- - image : circleci /python:3.8.5
429
+ - image : cimg /python:3.9
454
430
working_directory : /tmp/src/niworkflows
455
431
steps :
456
432
- checkout
@@ -474,7 +450,7 @@ jobs:
474
450
475
451
deploy_pypi :
476
452
docker :
477
- - image : circleci /python:3.8.5
453
+ - image : cimg /python:3.9
478
454
working_directory : /tmp/src/niworkflows
479
455
steps :
480
456
- checkout
@@ -503,12 +479,13 @@ jobs:
503
479
504
480
deploy_docker :
505
481
machine :
506
- image : ubuntu-1604:202007 -01
482
+ image : ubuntu-2004:202104 -01
507
483
working_directory : /tmp/src/
508
484
steps :
509
485
- restore_cache :
510
486
keys :
511
- - build-v1-{{ .Branch }}-{{ epoch }}
487
+ - build-v1-{{ .Branch }}-{{ .Revision }}
488
+ - build-v1--{{ .Revision }}
512
489
- build-v1-{{ .Branch }}-
513
490
- build-v1-master-
514
491
- build-v1-
@@ -518,8 +495,8 @@ jobs:
518
495
- run :
519
496
name : Docker authentication
520
497
command : |
521
- if [[ -n $DOCKER_PASS ]]; then
522
- docker login -u $DOCKER_USER -p $DOCKER_PASS
498
+ if [[ -n $DOCKER_PAT ]]; then
499
+ echo "$DOCKER_PAT" | docker login -u $DOCKER_USER --password-stdin
523
500
fi
524
501
- run :
525
502
name : Set up Docker registry
@@ -542,28 +519,17 @@ jobs:
542
519
name : Deploy to Docker Hub
543
520
no_output_timeout : 40m
544
521
command : |
545
- if [[ -n "$DOCKER_PASS" ]]; then
546
- docker login -u $DOCKER_USER -p $DOCKER_PASS
547
- docker push nipreps/niworkflows:latest
548
- docker tag nipreps/niworkflows nipreps/niworkflows:$CIRCLE_TAG
549
- docker push nipreps/niworkflows:$CIRCLE_TAG
550
- fi
522
+ docker push nipreps/niworkflows:latest
523
+ docker tag nipreps/niworkflows nipreps/niworkflows:$CIRCLE_TAG
524
+ docker push nipreps/niworkflows:$CIRCLE_TAG
551
525
552
526
build_docs :
553
527
docker :
554
- - image : circleci /python:3.8.5
528
+ - image : cimg /python:3.9
555
529
environment :
556
530
- FSLOUTPUTTYPE : NIFTI
557
531
- SUBJECTS_DIR : /tmp/subjects
558
532
steps :
559
- - restore_cache :
560
- keys :
561
- - docs-v1-{{ .Branch }}-{{ .Revision }}
562
- - docs-v1-{{ .Branch }}-
563
- - docs-v1-master
564
- - docs-v1-
565
- paths :
566
- - ./docs/_build/_html
567
533
- checkout
568
534
- run :
569
535
name : Create subjects folder
@@ -573,59 +539,21 @@ jobs:
573
539
command : sudo apt update && sudo apt -y install graphviz
574
540
- run :
575
541
name : Install deps
576
- command : python -m pip install --no-cache-dir -r docs/requirements.txt
577
- - run :
578
- name : Build only this commit
579
- command : make -C docs SPHINXOPTS="-W" BUILDDIR="_build/no_version_html" html
580
- - store_artifacts :
581
- path : ./docs/_build/no_version_html
582
- - run :
583
- name : Install niworkflows
584
542
command : |
585
- python -m pip install --no-cache-dir codecov
586
- python -m pip install --no-cache-dir .[all]
543
+ python -m pip install --no-cache-dir -U "pip>=20.3"
544
+ python -m pip install --no-cache-dir -r docs/requirements.txt
545
+ eval "$(pyenv init -)"
587
546
- run :
588
- name : Build only this commit with coverage collection
547
+ name : Install Niworkflows
589
548
command : |
590
- make -C docs/ clean
591
- export COVERAGE_FILE=/tmp/.coverage
592
- coverage run --source=niworkflows $( which sphinx-build ) \
593
- -b html -W -d docs/_build/no_version_doctrees ./docs/ docs/_build/no_version_html
594
- coverage xml -o /tmp/documentation.xml
595
- python -m codecov --file /tmp/documentation.xml --flags documentation -e CIRCLE_JOB
549
+ python -m pip install .
596
550
- run :
597
- name : Uninstall NiWorkflows
598
- command : |
599
- python -m pip uninstall -y niworkflows
600
- - run :
601
- name : Generate Versioned Docs
551
+ name : Build only this commit
602
552
command : |
603
- set +e
604
- force_versioned="$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[docs?[ _]?versions?\]' )"
605
- set -e
606
- if [[ "x${CIRCLE_TAG}" = "x" && "${CIRCLE_BRANCH}" != "master" && "x${force_versioned}" = "x" ]]; then
607
- echo "Not a tag or master branch - skipping versioned docs."
608
- circleci step halt
609
- else
610
- make -C docs/ clean
611
- make -f ./docs/Makefile versioned CURBRANCH=${CIRCLE_TAG:-$CIRCLE_BRANCH}
612
- fi
613
- - save_cache :
614
- key : docs-v1-{{ .Branch }}-{{ .Revision }}
615
- paths :
616
- - ./docs/_build/_html
617
- - persist_to_workspace :
618
- root : docs/_build
619
- paths : html
553
+ BRANCH=$( echo $CIRCLE_BRANCH | sed 's+/+_+g' )
554
+ make -C docs SPHINXOPTS="-W" BUILDDIR="$HOME/docs" OUTDIR=${CIRCLE_TAG:-$BRANCH} html
620
555
- store_artifacts :
621
- path : ./docs/_build/html
622
-
623
- deploy_docs_tag :
624
- << : *docs
625
-
626
- deploy_docs_master :
627
- << : *docs
628
-
556
+ path : ~/docs
629
557
630
558
workflows :
631
559
version : 2
@@ -697,23 +625,3 @@ workflows:
697
625
- /ds054\/.*/
698
626
tags :
699
627
only : /.*/
700
-
701
- - deploy_docs_master :
702
- requires :
703
- - test_pytest
704
- - test_package
705
- - build_docs
706
- filters :
707
- branches :
708
- only : /master/
709
- tags :
710
- ignore : /.*/
711
-
712
- - deploy_docs_tag :
713
- requires :
714
- - deploy_docker
715
- filters :
716
- branches :
717
- ignore : /.*/
718
- tags :
719
- only : /.*/
0 commit comments