Skip to content

Commit

Permalink
refactor upload to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkent committed Nov 19, 2020
1 parent 703aadb commit 6ac620b
Showing 1 changed file with 27 additions and 76 deletions.
103 changes: 27 additions & 76 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,6 @@ jobs:
- restore_cache:
keys:
- docker-v0-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- ds003-v0-{{ .Branch }}-
- ds003-v0-master-
- ds003-v0-
- run:
name: Install coverage and codecov
command: |
pyenv install 3.6.3
pyenv local 3.6.3
python -m pip install -U "coverage<5" codecov
- run:
name: Load Docker image layer cache
no_output_timeout: 30m
Expand All @@ -153,58 +142,24 @@ jobs:
pigz -d --stdout /tmp/cache/docker.tar.gz | docker load
docker images
fi
- run:
name: Install coverage and codecov
command: |
pyenv install 3.6.3
pyenv local 3.6.3
python -m pip install -U "coverage<5" codecov
- run:
name: Run pytest
no_output_timeout: 2h
command: |
mkdir -p /tmp/ds003/work
chmod 777 /tmp/ds003/work
mkdir -p /tmp/pytestcov
docker run --rm \
-v /tmp/ds003/work:/scratch \
-v /tmp/pytestcov:/scratch \
-e COVERAGE_FILE=/scratch/.coverage.pytest \
--entrypoint="/neurodocker/startup.sh" \
poldracklab/fitlins:latest \
bash -c '\
export PATH=/opt/miniconda-latest/envs/neuro/bin:$PATH \
&& pip install pytest \
&& coverage run --rcfile /src/fitlins/docker/multiproc.coveragerc `which pytest` /src/fitlins'
pytest --cov=fitlins --cov-report xml:/scratch/cov_pytest.xml /src/fitlins
- run:
name: Combine coverage and submit
name: Submit pytest coverage
command: |
pyenv local 3.6.3
python -m coverage combine \
--rcfile /tmp/src/fitlins/docker/multiproc.coveragerc \
/tmp/ds003/work/.coverage.*
sed -i -e 's/.opt.miniconda-latest.envs.neuro.lib.python3.6.site-packages/\/tmp\/src\/fitlins/g' .coverage
python -m coverage xml
python -m codecov --file coverage.xml --flags pytest -e CIRCLE_JOB
- store_artifacts:
path: /tmp/ds003
command: |
mkdir -p /tmp/pytestcov
chmod 777 /tmp/pytestcov
docker run -v /tmp/pytestcov:/scratch \
-e COVERAGE_FILE=/scratch/.coverage.pytest \
--entrypoint="/neurodocker/startup.sh" \
poldracklab/fitlins:latest \
pytest --cov=fitlins /src/fitlins
- run:
name: Combine coverage and submit
command: |
pyenv local 3.6.3
python -m coverage combine \
--rcfile /tmp/src/fitlins/docker/multiproc.coveragerc \
/tmp/pytestcov/.coverage*
sed -i -e 's/\/src\/fitlins/\/tmp\/src\/fitlins/g' .coverage
python -m coverage xml
python -m codecov --file coverage.xml --flags pytest -e CIRCLE_JOB
bash <(curl --retry 5 -s https://codecov.io/bash) \
-f /tmp/pytestcov/cov_pytest.xml \
-F pytest \
-e CIRCLE_JOB
test_ds003:
parameters:
Expand Down Expand Up @@ -235,12 +190,6 @@ jobs:
pigz -d --stdout /tmp/cache/docker.tar.gz | docker load
docker images
fi
- run:
name: Install coverage and codecov
command: |
pyenv install 3.6.3
pyenv local 3.6.3
python -m pip install -U "coverage<5" codecov
- run:
name: Run FitLins
no_output_timeout: 2h
Expand Down Expand Up @@ -305,15 +254,24 @@ jobs:
- run:
name: Combine coverage and submit
command: |
pyenv local 3.6.3
python -m coverage combine \
--rcfile /tmp/src/fitlins/docker/multiproc.coveragerc \
/tmp/ds003/work/.coverage.* \
/tmp/ds003/work_dbf*/.coverage.* \
sed -i -e 's/.opt.miniconda-latest.envs.neuro.lib.python3.6.site-packages/\/tmp\/src\/fitlins/g' .coverage
python -m coverage xml
python -m codecov --file coverage.xml --flags << parameters.estimator >> -e CIRCLE_JOB
# combine coverage
docker run --rm \
-v /tmp/ds003/work:/scratch0 \
-v /work_dbf:/scratch1 \
-v /tmp/ds003/work_dbf2:/scratch2 \
-w /scratch0 \
--entrypoint="/neurodocker/startup.sh" \
poldracklab/fitlins:latest \
bash -c "coverage combine \
/scratch0/.coverage* \
/scratch1/.coverage* \
/scratch2/.coverage* \
&& coverage xml"
# submit coverage
bash <(curl --retry 5 -s https://codecov.io/bash) \
-f /tmp/ds003/work/coverage.xml \
-F << parameters.estimator >> \
-e CIRCLE_JOB
- store_artifacts:
path: /tmp/ds003

Expand Down Expand Up @@ -480,7 +438,7 @@ workflows:
filters:
tags:
only: /.*/
- test_pytest:
- run_pytest:
requires:
- build
filters:
Expand All @@ -501,13 +459,6 @@ workflows:
filters:
tags:
only: /.*/
- run_pytest:
requires:
- build
- cache_test_data
filters:
tags:
only: /.*/
- deploy_master:
requires:
- test_ds003_nistats
Expand Down

0 comments on commit 6ac620b

Please sign in to comment.