Skip to content

Commit d6f6d39

Browse files
authored
Merge pull request #469 from oesteban/maint/fix-coverage-collection
MAINT: Revise code coverage collection
2 parents ac705eb + 7debffc commit d6f6d39

File tree

7 files changed

+42
-19
lines changed

7 files changed

+42
-19
lines changed

.circleci/config.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,15 @@ jobs:
219219
mkdir -p $PWD/artifacts $PWD/summaries
220220
sudo setfacl -d -m group:ubuntu:rwx $PWD
221221
sudo setfacl -m group:ubuntu:rwx $PWD
222-
docker run -u $( id -u ) -it --rm=false \
222+
docker run -u $( id -u ) -it --rm=false -w /src/niworkflows \
223+
-e COVERAGE_FILE=/tmp/summaries/.pytest.coverage \
223224
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
224225
-v ${PWD}:/tmp niworkflows:py3 \
225226
pytest --junit-xml=/tmp/summaries/pytest.xml \
226227
--cov niworkflows --cov-report xml:/tmp/summaries/unittests.xml \
227-
--ignore=/src/niworkflows/niworkflows/tests/ \
228-
--ignore=/src/niworkflows/niworkflows/func/tests/ \
229-
/src/niworkflows/niworkflows
228+
--ignore=niworkflows/tests/ \
229+
--ignore=niworkflows/func/tests/ \
230+
niworkflows/
230231
231232
- run:
232233
name: Submit unit test coverage
@@ -239,14 +240,15 @@ jobs:
239240
name: Run reportlet tests
240241
no_output_timeout: 2h
241242
command: |
242-
docker run -u $( id -u ) -it --rm=false \
243+
docker run -u $( id -u ) -it --rm=false -w /src/niworkflows \
244+
-e COVERAGE_FILE=/tmp/summaries/.reportlets.coverage \
243245
-e SAVE_CIRCLE_ARTIFACTS="/tmp/artifacts/" \
244246
-e TEST_DATA_HOME=/data -v /tmp/data:/data \
245247
-v /tmp/fslicense/license.txt:/opt/freesurfer/license.txt:ro \
246248
-v ${PWD}:/tmp niworkflows:py3 \
247249
pytest -n auto --junit-xml=/tmp/summaries/reportlets.xml \
248250
--cov niworkflows --cov-report xml:/tmp/summaries/reportlets.xml \
249-
/src/niworkflows/niworkflows/tests/
251+
niworkflows/tests/
250252
- run:
251253
name: Submit reportlet test coverage
252254
command: |
@@ -309,15 +311,16 @@ jobs:
309311
no_output_timeout: 2h
310312
command: |
311313
mkdir -p /tmp/masks/reports && \
312-
docker run -ti --rm=false \
314+
docker run -ti --rm=false -w /src/niworkflows \
315+
-e COVERAGE_FILE=/tmp/masks/.coverage \
313316
-v /tmp/data:/tmp/data -v /tmp/masks:/tmp/masks \
314317
-e FMRIPREP_REGRESSION_SOURCE=/tmp/data/fmriprep_bold_truncated \
315318
-e FMRIPREP_REGRESSION_TARGETS=/tmp/data/fmriprep_bold_mask \
316319
-e FMRIPREP_REGRESSION_REPORTS=/tmp/masks/reports \
317320
niworkflows:py3 \
318321
pytest --junit-xml=/tmp/masks/regression.xml \
319322
--cov niworkflows --cov-report xml:/tmp/masks/coverage.xml \
320-
/src/niworkflows/niworkflows/func/tests/
323+
niworkflows/func/tests/
321324
322325
- run:
323326
name: Submit masks test coverage
@@ -424,6 +427,24 @@ jobs:
424427
command: make -C docs SPHINXOPTS="-W" BUILDDIR="_build/no_version_html" html
425428
- store_artifacts:
426429
path: ./docs/_build/no_version_html
430+
- run:
431+
name: Install niworkflows
432+
command: |
433+
pip install --no-cache-dir codecov
434+
pip install --no-cache-dir -e .[all]
435+
- run:
436+
name: Build only this commit with coverage collection
437+
command: |
438+
make -C docs/ clean
439+
export COVERAGE_FILE=/tmp/.coverage
440+
coverage run --source=niworkflows $( which sphinx-build ) \
441+
-b html -W -d docs/_build/no_version_doctrees ./docs/ docs/_build/no_version_html
442+
coverage xml -o /tmp/documentation.xml
443+
python -m codecov --file /tmp/documentation.xml --flags documentation -e CIRCLE_JOB
444+
- run:
445+
name: Uninstall NiWorkflows
446+
command: |
447+
pip uninstall -y niworkflows
427448
- run:
428449
name: Generate Versioned Docs
429450
command: |
@@ -434,6 +455,7 @@ jobs:
434455
echo "Not a tag or master branch - skipping versioned docs."
435456
circleci step halt
436457
else
458+
make -C docs/ clean
437459
make -f ./docs/Makefile versioned CURBRANCH=${CIRCLE_TAG:-$CIRCLE_BRANCH}
438460
fi
439461
- save_cache:

.codecov.yml

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

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ src/
1818
.git/
1919
.github/
2020
.gitignore
21+
.gitattributes
22+
.gitmodules
2123

2224
# ci
2325
.circleci/

.gitmodules

Whitespace-only changes.

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ before_install:
4747
- python -m pip --version
4848
- |
4949
if [ "$INSTALL_TYPE" == "pip" ]; then
50-
PACKAGE="."
50+
PACKAGE="-e ."
5151
elif [ "$INSTALL_TYPE" == "sdist" ]; then
5252
python setup.py sdist
5353
PACKAGE="$( ls dist/*.tar.gz )"
@@ -93,4 +93,4 @@ script:
9393
9494
after_script:
9595
- python -m pip install codecov
96-
- codecov
96+
- python -m codecov --flags travis --file cov.xml -e $TRAVIS_JOB_NUMBER

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ RUN python -c "from matplotlib import font_manager" && \
150150
WORKDIR /src/
151151
COPY requirements.txt requirements.txt
152152
RUN pip install --no-cache-dir -r requirements.txt && \
153-
rm -rf $HOME/.cache/pip
153+
rm -rf $HOME/.cache/pip requirements.txt
154154

155155
# Precaching atlases
156156
RUN python -c "from templateflow import api as tfapi; \
@@ -161,7 +161,8 @@ RUN python -c "from templateflow import api as tfapi; \
161161
tfapi.get(['OASIS30ANTs', 'NKI'], resolution=1, desc='BrainCerebellumRegistration', suffix='mask'); "
162162

163163
COPY . niworkflows/
164-
RUN pip install --no-cache-dir /src/niworkflows[all] && \
164+
WORKDIR /src/niworkflows/
165+
RUN pip install --no-cache-dir -e .[all] && \
165166
rm -rf $HOME/.cache/pip
166167

167168
# Cleanup and ensure perms.

setup.cfg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ install_requires =
4040
transforms3d
4141
templateflow >= 0.4.2
4242
test_requires =
43+
coverage < 5
4344
pytest >= 4.4
44-
pytest-xdist >= 1.28
4545
pytest-cov
46-
coverage
46+
pytest-xdist >= 1.28
4747
packages = find:
4848
include_package_data = True
4949

@@ -62,9 +62,9 @@ exclude =
6262

6363
[options.extras_require]
6464
doc =
65-
sphinx >= 2.1.2
6665
pydot >= 1.2.3
6766
pydotplus
67+
sphinx >= 2.1.2
6868
sphinx_rtd_theme
6969
sphinxcontrib-apidoc ~= 0.3.0
7070
sphinxcontrib-napoleon
@@ -78,10 +78,10 @@ pointclouds =
7878
style =
7979
flake8 >= 3.7.0
8080
test =
81+
coverage < 5
8182
pytest >= 4.4
82-
pytest-xdist >= 1.28
8383
pytest-cov
84-
coverage
84+
pytest-xdist >= 1.28
8585
tests =
8686
%(test)s
8787
all =

0 commit comments

Comments
 (0)