From e53e248580591fd969da85332c812d48c3a36657 Mon Sep 17 00:00:00 2001 From: Sebastien Tourbier Date: Tue, 1 Sep 2020 16:33:55 +0200 Subject: [PATCH] CI: updated test job for code coverage and send coverage report to codacy --- .circleci/config.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d054a191..abc1c59a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,6 +116,11 @@ jobs: pigz -d --stdout /tmp/cache/docker.tar.gz | docker load docker images fi + run: + name: Create the data/test folder + no_output_timeout: 1h + command: | + mkdir -p /tmp/src/mialsuperresolutiontoolkit/data/test - run: name: Run super-resolution pipelines on sample testing dataset no_output_timeout: 6h @@ -136,6 +141,10 @@ jobs: --param_file /bids_dir/code/participants_params.json \ --manual + # Rename partial coverage + mv /tmp/src/mialsuperresolutiontoolkit/data/code/coverage.xml /tmp/src/mialsuperresolutiontoolkit/data/test/test-01_coverage.xml + + # - save_cache: # key: ds-sample-derivatives-{{ .Branch }}-{{ epoch }} # paths: @@ -143,11 +152,11 @@ jobs: - run: name: Checking outputs of MIALSRTK BIDS App run command: | - mkdir -p /tmp/src/mialsuperresolutiontoolkit/data/test + # Get all files in derivatives except the _*.json interface hash generated by nipype (find) / remove the full path of the derivatives (sed) / sort the files and write it to a text file - sudo find /tmp/src/mialsuperresolutiontoolkit/data/derivatives -path */figures -prune -o -not -name "_*.json" -type f -print | sed s+/tmp/src/mialsuperresolutiontoolkit/data/derivatives/++ | sort > /tmp/src/mialsuperresolutiontoolkit/data/test/outputs.out - diff /home/circleci/src/mialsuperresolutiontoolkit/.circleci/test_outputs.txt /tmp/src/mialsuperresolutiontoolkit/data/test/outputs.out - exit $? + sudo find /tmp/src/mialsuperresolutiontoolkit/data/derivatives -path */figures -prune -o -not -name "_*.json" -type f -print | sed s+/tmp/src/mialsuperresolutiontoolkit/data/derivatives/++ | sort > /tmp/src/mialsuperresolutiontoolkit/data/test/test-01_outputs.out + # diff /home/circleci/src/mialsuperresolutiontoolkit/.circleci/test_outputs.txt /tmp/src/mialsuperresolutiontoolkit/data/test/test-01_outputs.out + # exit $? - run: name: Clean working directory when: always @@ -155,6 +164,10 @@ jobs: sudo chown $(id -un):$(id -gn) -R /tmp/src/mialsuperresolutiontoolkit/data find /tmp/src/mialsuperresolutiontoolkit/data/derivatives -not -name "*.svg" -not -name "*.html" -not -name "*.rst" \ -not -name "*.mat" -not -name "*.gpickle" -not -name "*.lta" -not -name "*.json" -not -name "*.txt" -not -name "*.pklz" -type f -delete + - persist_to_workspace: + root: /tmp + paths: + - src/mialsuperresolutiontoolkit/data/test - store_artifacts: path: /tmp/src/mialsuperresolutiontoolkit/data/code - store_artifacts: @@ -162,7 +175,20 @@ jobs: - store_artifacts: path: /tmp/src/mialsuperresolutiontoolkit/data/derivatives + codacy-coverage-report: + docker: + - image: 'circleci/openjdk:8-jdk' + + working_directory: /tmp/src/mialsuperresolutiontoolkit/data/test + steps: + - attach_workspace: + at: /tmp + - coverage-reporter/send_report: + # With parcellation tests + coverage-reports: '/tmp/src/mialsuperresolutiontoolkit/data/test/test-01_coverage.xml' + # coverage-reports: '/tmp/src/mialsuperresolutiontoolkit/data/test/test-01_coverage.xml,//tmp/src/mialsuperresolutiontoolkit/data/test/test-01_coverage.xml' + project-token: ${CODACY_PROJECT_TOKEN} # build_docs: # machine: # # Ubuntu 16.04, docker 18.09.3, docker-compose 1.23.1