Commit 3ef36277 authored by Antoine Berchet's avatar Antoine Berchet
Browse files

Test merge coverage from jobs

parent 8f4eb9a1
......@@ -126,6 +126,45 @@ release_tagging:
only:
- devel
# Check that coverage did not decreased
improved_coverage:
stage: coverage
image:
name: pycif/pycif-ubuntu:0.1
entrypoint: [""]
before_script:
- pip freeze
- pip install coverage
script:
- python3 -m coverage combine coverage_raw/.coverage_*
- coverage html -d reports/coverage
- coverage xml -o reports/coverage.xml
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
# - MAX=`if [ -f coverage/.master_cov ] ; then cat coverage/.master_cov ; else echo 0.00 ; fi`
# - CURRENT=`cat coverage/.current_coverage`
# - echo $CURRENT
# - echo $MAX
# - if [[ $CURRENT < $MAX ]] ; then echo "Coverage decreased!!!"; exit 1 ; else echo "Coverage did not decrease, good job!"; exit 0 ; fi;
artifacts:
when: always
paths:
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
# cache:
# paths:
# - coverage/.master_cov
# Generate figures and artifacts for the website
article:
......@@ -141,7 +180,11 @@ article:
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_article
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -149,6 +192,7 @@ article:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
- figures_artifact
only:
......@@ -167,7 +211,11 @@ article_uncertainties:
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_article_uncertainties
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -175,6 +223,7 @@ article_uncertainties:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
- figures_artifact
only:
......@@ -190,11 +239,15 @@ tests_dummy:
# - apt-get update
- pip freeze
script:
- tox -e py38 -e coverage -- -m "test_in_ci and dummy and fwd"
- tox -e py38 -e coverage -- -m "test_in_ci and dummy"
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_dummy
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -202,6 +255,7 @@ tests_dummy:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
# Run the tests for chimere (include downloading data)
......@@ -225,7 +279,11 @@ tests_chimere:
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_chimere
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -233,6 +291,7 @@ tests_chimere:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
# Run the tests for flexpart (include downloading data)
......@@ -254,7 +313,11 @@ tests_flexpart:
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_flexpart
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -262,6 +325,7 @@ tests_flexpart:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
# Run the tests for flexpart (include downloading data)
......@@ -283,7 +347,11 @@ tests_tm5:
after_script:
- mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_coverage
- echo 'TOTAL COVERAGE:'" $(cat coverage/.current_coverage)%"
- calc() { awk "BEGIN{print $*}"; }
- percent_coverage=`cat coverage/.current_coverage`
- tot_coverage=`calc ${percent_coverage}*100`
- echo 'TOTAL COVERAGE:'" ${tot_coverage}%"
- mv coverage_raw/.coverage coverage_raw/.coverage_tm5
coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts:
when: always
......@@ -291,6 +359,7 @@ tests_tm5:
- reports/pytest*.html
- reports/coverage/
- coverage/.current_coverage
- coverage_raw/
- examples_artifact
#
......@@ -351,22 +420,7 @@ tests_tm5:
# paths:
# - reports/flake8/
# Check that coverage did not decreased
# improved_coverage:
# stage: coverage
# image: bashell/alpine-bash
# script:
# - MAX=`if [ -f coverage/.master_cov ] ; then cat coverage/.master_cov ; else echo 0.00 ; fi`
# - CURRENT=`cat coverage/.current_coverage`
# - echo $CURRENT
# - echo $MAX
# - if [[ $CURRENT < $MAX ]] ; then echo "Coverage decreased!!!"; exit 1 ; else echo "Coverage did not decrease, good job!"; exit 0 ; fi;
# artifacts:
# paths:
# - coverage/.current_coverage
# cache:
# paths:
# - coverage/.master_cov
# Store the new coverage value only for the master and devel branches
# store_coverage:
......
......@@ -8,7 +8,7 @@ extra_volumns="-v /home/aberchet/Projects/PYCIF_DATA_TEST/:/tmp/PYCIF_DATA_TEST/
docker run \
-v $pycif_root_dir:/tmp/CIF/ \
$extra_volumns \
-it --entrypoint /tmp/CIF/bin/tox_command.sh pycif/pycif-tm5:0.2
-it --entrypoint /tmp/CIF/bin/tox_command.sh pycif/pycif-ubuntu:0.1
......
......@@ -2,4 +2,4 @@
cd /tmp/CIF/
pip freeze
tox -e py38 -e coverage -- -m 'test_in_ci and tm5 and fwd'
tox -e py38 -e coverage -- -m 'test_in_ci and dummy and fwd'
......@@ -7,7 +7,7 @@ requires=
deps=
numpy
setenv =
COVERAGE_FILE={envdir}/.coverage
COVERAGE_FILE={toxinidir}/coverage_raw/{envname}/.coverage
PYCIF_DATATEST=/tmp/PYCIF_DATA_TEST/
extras=test
skipsdist=True
......@@ -33,8 +33,9 @@ skip_install=true
deps=
coverage
commands =
/usr/bin/env bash -c '{envpython} -m coverage combine {toxworkdir}/py*/.coverage'
/usr/bin/env bash -c '{envpython} -m coverage combine {toxinidir}/coverage_raw/py*/.coverage'
; coverage report --show-missing
coverage html -d reports/coverage
coverage xml -o reports/coverage.xml
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment