Skip to content

Commit 4f8d29a

Browse files
committed
[FIX] CircleCI tests - error codes are not propagated
The former structure of the tests.sh file in which all the tests are called did not exit with error if one of the test commands errored, since the last exit code was from codecov, and no exit code tracking or propagation was done. This PR fixes that issue. Additionally, the scripts related to CircleCI have been split up into a new .circle/ folder.
1 parent e450340 commit 4f8d29a

File tree

5 files changed

+40
-37
lines changed

5 files changed

+40
-37
lines changed

.circle/codecov.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
#
3+
# This script pull all coverage files into the $CIRCLE_TEST_REPORTS folder
4+
# and sends data to codecov.
5+
#
6+
#
7+
set -u
8+
set -e
9+
10+
mkdir -p ${CIRCLE_TEST_REPORTS}/
11+
for report in $( ls ~/scratch/*.xml ); do
12+
rname=$( basename $report )
13+
cp ${report} ${CIRCLE_TEST_REPORTS}/${rname:: -4}_${CIRCLE_NODE_INDEX}.xml
14+
done
15+
16+
# Send coverage data to codecov.io
17+
curl -so codecov.io https://codecov.io/bash
18+
chmod 755 codecov.io
19+
find "${CIRCLE_TEST_REPORTS}/" -name 'coverage*.xml' -print0 | \
20+
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F unittests
21+
find "${CIRCLE_TEST_REPORTS}/" -name 'smoketests*.xml' -print0 | \
22+
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F smoketests

docker/files/tests.sh renamed to .circle/tests.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ fi
1414
# They may need to be rebalanced in the future.
1515
case ${CIRCLE_NODE_INDEX} in
1616
0)
17-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ level1 && \
18-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline
19-
;;
20-
1)
21-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow3d && \
22-
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow4d && \
2317
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py27 /usr/bin/run_pytests.sh py27 && \
2418
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py35 /usr/bin/run_pytests.sh py35 && \
25-
docker run --rm -it -v $SCRATCH:/scratch -w /root/src/nipype/doc nipype/nipype_test:py35 /usr/bin/run_builddocs.sh
19+
docker run --rm -it -v $SCRATCH:/scratch -w /root/src/nipype/doc nipype/nipype_test:py35 /usr/bin/run_builddocs.sh && \
20+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow3d && \
21+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow4d
22+
;;
23+
1)
24+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ level1 && \
25+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline
2626
;;
2727
2)
2828
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1 && \
@@ -34,14 +34,3 @@ case ${CIRCLE_NODE_INDEX} in
3434
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /root/examples/ level1_workflow
3535
;;
3636
esac
37-
38-
# Put the artifacts in place
39-
bash docker/files/teardown.sh
40-
41-
# Send coverage data to codecov.io
42-
curl -so codecov.io https://codecov.io/bash
43-
chmod 755 codecov.io
44-
find "${CIRCLE_TEST_REPORTS}/pytest" -name 'coverage*.xml' -print0 | \
45-
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F unittests
46-
find "${CIRCLE_TEST_REPORTS}/pytest" -name 'smoketests*.xml' -print0 | \
47-
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F smoketests

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ src/
2323
# other
2424
docs/**/*
2525
docs/
26+
.circle/**/*
27+
.circle/
28+
circle.yml
2629
.coverage
2730
.coveragerc
2831
codecov.yml
2932
rtd_requirements.txt
30-
circle.yml
3133
Vagrantfile
3234
.travis.yml
3335
.noserc

circle.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,28 @@ dependencies:
4343

4444
test:
4545
override:
46-
- bash docker/files/tests.sh :
46+
- bash .circle/tests.sh :
4747
timeout: 7200
4848
parallel: true
49+
post:
50+
# Send coverage data to codecov.io
51+
- bash .circle/codecov.sh
4952

5053
general:
5154
artifacts:
52-
- "~/docs"
53-
- "~/logs"
55+
- "~/scratch/docs"
56+
- "~/scratch/logs"
5457

5558
deployment:
5659
production:
5760
tag: /.*/
5861
commands:
62+
# Deploy to docker hub
5963
- if [[ -n "$DOCKER_PASS" ]]; then docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS && docker push nipype/nipype:latest; fi :
6064
timeout: 21600
6165
- if [[ -n "$DOCKER_PASS" ]]; then docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS && docker tag nipype/nipype nipype/nipype:$CIRCLE_TAG && docker push nipype/nipype:$CIRCLE_TAG; fi :
6266
timeout: 21600
67+
6368
# Automatic deployment to Pypi:
6469
# - printf "[distutils]\nindex-servers =\n pypi\n\n[pypi]\nusername:$PYPI_USER\npassword:$PYPI_PASS\n" > ~/.pypirc
6570
# - python setup.py sdist upload -r pypi

docker/files/teardown.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)