Skip to content

Commit 8422b57

Browse files
committed
CI: Update much of Circle config to match master
1 parent c48a428 commit 8422b57

File tree

1 file changed

+37
-134
lines changed

1 file changed

+37
-134
lines changed

.circleci/config.yml

Lines changed: 37 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,22 @@
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+
325
jobs:
336
build:
347
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
3611
working_directory: /tmp/src/niworkflows
3712
environment:
3813
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
3914
SCRATCH: "/scratch"
4015
steps:
4116
- restore_cache:
4217
keys:
43-
- build-v1-{{ .Branch }}-{{ epoch }}
18+
- build-v1-{{ .Branch }}-{{ .Revision }}
19+
- build-v1--{{ .Revision }}
4420
- build-v1-{{ .Branch }}-
4521
- build-v1-master-
4622
- build-v1-
@@ -50,8 +26,8 @@ jobs:
5026
- run:
5127
name: Docker authentication
5228
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
5531
fi
5632
- run:
5733
name: Set up Docker registry
@@ -76,13 +52,13 @@ jobs:
7652
set -e
7753
if [[ "$success" = "0" ]]; then
7854
echo "Pulling from local registry"
79-
docker tag localhost:5000/ubuntu ubuntu:xenial-20191010
55+
docker tag localhost:5000/ubuntu ubuntu:focal-20210416
8056
docker pull localhost:5000/niworkflows
8157
docker tag localhost:5000/niworkflows niworkflows:latest
8258
else
8359
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
8662
docker push localhost:5000/ubuntu
8763
fi
8864
@@ -107,7 +83,7 @@ jobs:
10783
docker exec -it registry /bin/registry garbage-collect --delete-untagged \
10884
/etc/docker/registry/config.yml
10985
- save_cache:
110-
key: build-v1-{{ .Branch }}-{{ epoch }}
86+
key: build-v1-{{ .Branch }}-{{ .Revision }}
11187
paths:
11288
- /tmp/docker
11389
- /tmp/images
@@ -227,7 +203,7 @@ jobs:
227203

228204
test_pytest:
229205
machine:
230-
image: ubuntu-1604:202007-01
206+
image: ubuntu-2004:202104-01
231207
working_directory: /tmp/tests
232208
steps:
233209
- attach_workspace:
@@ -237,15 +213,16 @@ jobs:
237213
command: python -m pip install codecov
238214
- restore_cache:
239215
keys:
240-
- build-v1-{{ .Branch }}-{{ epoch }}
216+
- build-v1-{{ .Branch }}-{{ .Revision }}
217+
- build-v1--{{ .Revision }}
241218
- build-v1-{{ .Branch }}-
242219
- build-v1-master-
243220
- build-v1-
244221
- run:
245222
name: Docker authentication
246223
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
249226
fi
250227
- run:
251228
name: Set up Docker registry
@@ -277,10 +254,9 @@ jobs:
277254
no_output_timeout: 2h
278255
command: |
279256
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 \
283258
-e COVERAGE_FILE=/tmp/summaries/.pytest.coverage \
259+
-e SAVE_CIRCLE_ARTIFACTS="/tmp/artifacts/" \
284260
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
285261
-e FS_LICENSE=/etc/fslicense.txt \
286262
-v /tmp/fslicense/license.txt:/etc/fslicense.txt:ro \
@@ -302,7 +278,7 @@ jobs:
302278
name: Run reportlet tests
303279
no_output_timeout: 2h
304280
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 \
306282
-e COVERAGE_FILE=/tmp/summaries/.reportlets.coverage \
307283
-e SAVE_CIRCLE_ARTIFACTS="/tmp/artifacts/" \
308284
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
@@ -503,12 +479,13 @@ jobs:
503479
504480
deploy_docker:
505481
machine:
506-
image: ubuntu-1604:202007-01
482+
image: ubuntu-2004:202104-01
507483
working_directory: /tmp/src/
508484
steps:
509485
- restore_cache:
510486
keys:
511-
- build-v1-{{ .Branch }}-{{ epoch }}
487+
- build-v1-{{ .Branch }}-{{ .Revision }}
488+
- build-v1--{{ .Revision }}
512489
- build-v1-{{ .Branch }}-
513490
- build-v1-master-
514491
- build-v1-
@@ -518,8 +495,8 @@ jobs:
518495
- run:
519496
name: Docker authentication
520497
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
523500
fi
524501
- run:
525502
name: Set up Docker registry
@@ -542,12 +519,9 @@ jobs:
542519
name: Deploy to Docker Hub
543520
no_output_timeout: 40m
544521
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
551525
552526
build_docs:
553527
docker:
@@ -556,14 +530,6 @@ jobs:
556530
- FSLOUTPUTTYPE: NIFTI
557531
- SUBJECTS_DIR: /tmp/subjects
558532
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
567533
- checkout
568534
- run:
569535
name: Create subjects folder
@@ -573,59 +539,16 @@ jobs:
573539
command: sudo apt update && sudo apt -y install graphviz
574540
- run:
575541
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-
command: |
585-
python -m pip install --no-cache-dir codecov
586-
python -m pip install --no-cache-dir .[all]
587-
- run:
588-
name: Build only this commit with coverage collection
589-
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
596-
- run:
597-
name: Uninstall NiWorkflows
598542
command: |
599-
python -m pip uninstall -y niworkflows
543+
python -m pip install --no-cache-dir -U "pip>=20.3"
544+
python -m pip install --no-cache-dir -r docs/requirements.txt
600545
- run:
601-
name: Generate Versioned Docs
546+
name: Build only this commit
602547
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
548+
BRANCH=$( echo $CIRCLE_BRANCH | sed 's+/+_+g' )
549+
make -C docs SPHINXOPTS="-W" BUILDDIR="$HOME/docs" OUTDIR=${CIRCLE_TAG:-$BRANCH} html
620550
- store_artifacts:
621-
path: ./docs/_build/html
622-
623-
deploy_docs_tag:
624-
<<: *docs
625-
626-
deploy_docs_master:
627-
<<: *docs
628-
551+
path: ~/docs
629552

630553
workflows:
631554
version: 2
@@ -697,23 +620,3 @@ workflows:
697620
- /ds054\/.*/
698621
tags:
699622
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

Comments
 (0)