Skip to content

Commit fca5ff8

Browse files
committed
Merge branch 'master' of https://github.com/nipy/nipype into enh/crashtxt
2 parents 9fed6cb + addda24 commit fca5ff8

File tree

15 files changed

+136
-153
lines changed

15 files changed

+136
-153
lines changed

.circle/codecov.sh

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

.circle/tests.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ if [ "${CIRCLE_NODE_TOTAL:-}" != "4" ]; then
1313
exit 1
1414
fi
1515

16-
# These tests are manually balanced based on previous build timings.
16+
# These tests are manually balanced based on previous build timings.
1717
# They may need to be rebalanced in the future.
1818
case ${CIRCLE_NODE_INDEX} in
1919
0)
20-
docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py27 /usr/bin/run_pytests.sh py27 && \
21-
docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py35 /usr/bin/run_pytests.sh py35 && \
22-
docker run --rm -it -v $WORKDIR:/work -w /src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
23-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d && \
24-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d
20+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_pytests.sh && \
21+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_pytests.sh && \
22+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $WORKDIR:/work -w /src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
23+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d && \
24+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d
2525
;;
2626
1)
27-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 && \
28-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline
27+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 && \
28+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline
2929
;;
3030
2)
31-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
32-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
31+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
32+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
3333
;;
3434
3)
35-
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
36-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline && \
37-
docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow
35+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
36+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline && \
37+
docker run --rm=false -it -e CODECOV_TOKEN=${CODECOV_TOKEN} -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow
3838
;;
3939
esac

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
[run]
22
branch = True
3-
include = */nipype/*
4-
omit =
5-
*/nipype/external/*
6-
*/nipype/fixes/*
7-
*/setup.py

.dockerignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# python cache
2-
__pycache__/**/*
32
__pycache__
3+
**/__pycache__
4+
**/*.pyc
45
*.pyc
56

67
# python distribution
@@ -23,14 +24,14 @@ src/
2324
# other
2425
docs/**/*
2526
docs/
27+
.cache/
2628
.circle/**/*
2729
.circle/
2830
circle.yml
29-
.coverage
30-
.coveragerc
31-
codecov.yml
3231
rtd_requirements.txt
3332
Vagrantfile
3433
.travis.yml
35-
.noserc
34+
.mailmap
3635

36+
# Previous coverage results
37+
.coverage

.noserc

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ before_install:
4242
install:
4343
- travis_retry pip install -e .[$NIPYPE_EXTRAS]
4444
script:
45-
- py.test --doctest-modules nipype
45+
- py.test -v --doctest-modules nipype
4646
deploy:
4747
provider: pypi
4848
user: satra

Dockerfile

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ RUN conda config --add channels conda-forge; sync && \
7171
RUN sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/matplotlib/mpl-data/matplotlibrc && \
7272
python -c "from matplotlib import font_manager"
7373

74+
# Install codecov inside container
75+
RUN curl -so /usr/bin/codecov.io https://codecov.io/bash && \
76+
chmod 755 /usr/bin/codecov.io
77+
78+
# Install CI scripts
79+
COPY docker/files/run_* /usr/bin/
80+
RUN chmod +x /usr/bin/run_*
81+
82+
# Replace imglob with a Python3 compatible version
83+
COPY nipype/external/fsl_imglob.py /usr/bin/fsl_imglob.py
84+
RUN rm -rf ${FSLDIR}/bin/imglob && \
85+
chmod +x /usr/bin/fsl_imglob.py && \
86+
ln -s /usr/bin/fsl_imglob.py ${FSLDIR}/bin/imglob
87+
7488
# Installing dev requirements (packages that are not in pypi)
7589
WORKDIR /src/
7690
COPY requirements.txt requirements.txt
@@ -83,16 +97,6 @@ RUN cd /src/nipype && \
8397
pip install -e .[all] && \
8498
rm -rf ~/.cache/pip
8599

86-
# Install CI scripts
87-
COPY docker/files/run_* /usr/bin/
88-
RUN chmod +x /usr/bin/run_*
89-
90-
# Replace imglob with a Python3 compatible version
91-
COPY nipype/external/fsl_imglob.py /usr/bin/fsl_imglob.py
92-
RUN rm -rf ${FSLDIR}/bin/imglob && \
93-
chmod +x /usr/bin/fsl_imglob.py && \
94-
ln -s /usr/bin/fsl_imglob.py ${FSLDIR}/bin/imglob
95-
96100
WORKDIR /work/
97101

98102
ARG BUILD_DATE

circle.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- sudo apt-get -y update && sudo apt-get install -y wget bzip2
2525
# Create work folder and force group permissions
2626
- mkdir -p $WORKDIR && sudo setfacl -d -m group:ubuntu:rwx $WORKDIR && sudo setfacl -m group:ubuntu:rwx $WORKDIR
27-
- mkdir -p $HOME/docker $HOME/examples $WORKDIR/pytest $WORKDIR/logs
27+
- mkdir -p $HOME/docker $HOME/examples $WORKDIR/tests $WORKDIR/crashfiles $WORKDIR/logs ${CIRCLE_TEST_REPORTS}/tests/
2828
override:
2929
- if [[ -e $HOME/docker/cache.tar ]]; then docker load --input $HOME/docker/cache.tar; fi :
3030
timeout: 6000
@@ -49,13 +49,15 @@ test:
4949
timeout: 7200
5050
parallel: true
5151
post:
52-
# Send coverage data to codecov.io
53-
- bash .circle/codecov.sh
52+
# Place reports in the appropriate folder
53+
- cp ${WORKDIR}/tests/*.xml ${CIRCLE_TEST_REPORTS}/tests/
5454

5555
general:
5656
artifacts:
5757
- "~/work/docs"
5858
- "~/work/logs"
59+
- "~/work/tests"
60+
- "~/work/crashfiles"
5961

6062
deployment:
6163
production:

codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ coverage:
2222
threshold: 100
2323
flags:
2424
- "smoketests"
25+
ignore: # files and folders that will be removed during processing
26+
- "nipype/external/*"
27+
- "tools/*"
28+
- "doc/*"

docker/files/run_examples.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ arr=$@
88
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
99
example_id=${tmp_var//[^A-Za-z0-9_-]/_}
1010

11-
mkdir -p ${HOME}/.nipype ${WORKDIR}/logs/example_${example_id}
11+
mkdir -p ${HOME}/.nipype ${WORKDIR}/logs/example_${example_id} ${WORKDIR}/tests ${WORKDIR}/crashfiles
1212
echo "[logging]" > ${HOME}/.nipype/nipype.cfg
1313
echo "workflow_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
1414
echo "interface_level = DEBUG" >> ${HOME}/.nipype/nipype.cfg
@@ -17,23 +17,21 @@ echo "log_to_file = true" >> ${HOME}/.nipype/nipype.cfg
1717
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> ${HOME}/.nipype/nipype.cfg
1818

1919
# Set up coverage
20-
echo "[run]" >> .coveragerc
21-
echo "branch = True" >> .coveragerc
22-
echo "source = /src/nipype" >> .coveragerc
23-
echo "include = */nipype/*" >> .coveragerc
24-
echo "omit =" >> .coveragerc
25-
echo " */nipype/external/*" >> .coveragerc
26-
echo " */nipype/fixes/*" >> .coveragerc
27-
echo " */setup.py" >> .coveragerc
20+
export COVERAGE_FILE=${WORKDIR}/tests/.coverage.${example_id}
21+
if [ "$2" == "MultiProc" ]; then
22+
echo "concurrency = multiprocessing" >> /src/nipype/.coveragerc
23+
fi
2824

25+
coverage run /src/nipype/tools/run_examples.py $@
26+
exit_code=$?
2927

30-
parallel=""
31-
if [ "$2" == "MultiProc" ]; then
32-
parallel="--concurrency=multiprocessing"
28+
# Generate coverage report and submit if token is defined
29+
coverage xml -o ${WORKDIR}/tests/smoketest_${example_id}.xml
30+
if [ "${CODECOV_TOKEN}" != "" ]; then
31+
codecov.io -f ${WORKDIR}/tests/smoketest_${example_id}.xml -t "${CODECOV_TOKEN}" -F smoketests
3332
fi
3433

35-
coverage run ${parallel} /src/nipype/tools/run_examples.py $@
36-
test_exit=$?
37-
coverage xml -o "${WORKDIR}/smoketest_${example_id}.xml"
34+
# Collect crashfiles
35+
find /work -name "crash-*" -maxdepth 1 -exec mv {} ${WORKDIR}/crashfiles/ \;
36+
exit $exit_code
3837

39-
exit $test_exit

docker/files/run_pytests.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ set -e
33
set -x
44
set -u
55

6+
7+
TESTPATH=${1:-/src/nipype/}
68
WORKDIR=${WORK:-/work}
79
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )
810

911
# Create necessary directories
10-
mkdir -p ${WORKDIR}/crashfiles ${WORKDIR}/logs/py${PYTHON_VERSION}
12+
mkdir -p ${WORKDIR}/tests ${WORKDIR}/crashfiles ${WORKDIR}/logs/py${PYTHON_VERSION}
1113

1214
# Create a nipype config file
1315
mkdir -p ${HOME}/.nipype
@@ -21,19 +23,28 @@ if [[ "${PYTHON_VERSION}" -lt "30" ]]; then
2123
echo 'profile_runtime = true' >> ${HOME}/.nipype/nipype.cfg
2224
fi
2325

24-
cd /src/nipype/
25-
make clean
2626
# Run tests using pytest
27-
py.test -n ${CIRCLE_NCPUS:-4} --doctest-modules --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}.xml --cov=nipype nipype
27+
export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION}
28+
py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml --cov nipype --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml ${TESTPATH}
29+
exit_code=$?
2830

31+
if [ "${CODECOV_TOKEN}" != "" ]; then
32+
codecov.io -f ${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml -t "${CODECOV_TOKEN}" -F unittests
33+
fi
2934

3035
# Workaround: run here the profiler tests in python 3
3136
if [[ "${PYTHON_VERSION}" -ge "30" ]]; then
3237
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
3338
echo 'profile_runtime = true' >> ${HOME}/.nipype/nipype.cfg
34-
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_profiler.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_profiler.xml --cov=nipype nipype/interfaces/tests/test_runtime_profiler.py
35-
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_multiproc.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_multiproc.xml --cov=nipype nipype/pipeline/plugins/tests/test_multiproc*.py
39+
export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION}_extra
40+
py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}_extra.xml --cov nipype --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}_extra.xml /src/nipype/nipype/interfaces/tests/test_runtime_profiler.py /src/nipype/nipype/pipeline/plugins/tests/test_multiproc*.py
41+
exit_code=$(( $exit_code + $? ))
42+
43+
if [ "${CODECOV_TOKEN}" != "" ]; then
44+
codecov.io -f ${WORKDIR}/tests/coverage_py${PYTHON_VERSION}_extra.xml -t "${CODECOV_TOKEN}" -F unittests
45+
fi
3646
fi
3747

38-
# Copy crashfiles to scratch
39-
find /src/nipype/ -name "crash-*" -exec cp {} ${WORKDIR}/crashfiles/ \;
48+
# Collect crashfiles
49+
find /work -name "crash-*" -maxdepth 1 -exec mv {} ${WORKDIR}/crashfiles/ \;
50+
exit ${exit_code}

0 commit comments

Comments
 (0)