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: ...@@ -126,6 +126,45 @@ release_tagging:
only: only:
- devel - 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 # Generate figures and artifacts for the website
article: article:
...@@ -141,7 +180,11 @@ article: ...@@ -141,7 +180,11 @@ article:
after_script: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -149,6 +192,7 @@ article: ...@@ -149,6 +192,7 @@ article:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
- figures_artifact - figures_artifact
only: only:
...@@ -167,7 +211,11 @@ article_uncertainties: ...@@ -167,7 +211,11 @@ article_uncertainties:
after_script: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -175,6 +223,7 @@ article_uncertainties: ...@@ -175,6 +223,7 @@ article_uncertainties:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
- figures_artifact - figures_artifact
only: only:
...@@ -190,11 +239,15 @@ tests_dummy: ...@@ -190,11 +239,15 @@ tests_dummy:
# - apt-get update # - apt-get update
- pip freeze - pip freeze
script: 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: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -202,6 +255,7 @@ tests_dummy: ...@@ -202,6 +255,7 @@ tests_dummy:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
# Run the tests for chimere (include downloading data) # Run the tests for chimere (include downloading data)
...@@ -225,7 +279,11 @@ tests_chimere: ...@@ -225,7 +279,11 @@ tests_chimere:
after_script: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -233,6 +291,7 @@ tests_chimere: ...@@ -233,6 +291,7 @@ tests_chimere:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
# Run the tests for flexpart (include downloading data) # Run the tests for flexpart (include downloading data)
...@@ -254,7 +313,11 @@ tests_flexpart: ...@@ -254,7 +313,11 @@ tests_flexpart:
after_script: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -262,6 +325,7 @@ tests_flexpart: ...@@ -262,6 +325,7 @@ tests_flexpart:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
# Run the tests for flexpart (include downloading data) # Run the tests for flexpart (include downloading data)
...@@ -283,7 +347,11 @@ tests_tm5: ...@@ -283,7 +347,11 @@ tests_tm5:
after_script: after_script:
- mkdir -p coverage - mkdir -p coverage
- xmlstarlet sel -t -v "//coverage/@line-rate" reports/coverage.xml > coverage/.current_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\.]+\%)$/' coverage: '/^TOTAL COVERAGE: ([0-9\.]+\%)$/'
artifacts: artifacts:
when: always when: always
...@@ -291,6 +359,7 @@ tests_tm5: ...@@ -291,6 +359,7 @@ tests_tm5:
- reports/pytest*.html - reports/pytest*.html
- reports/coverage/ - reports/coverage/
- coverage/.current_coverage - coverage/.current_coverage
- coverage_raw/
- examples_artifact - examples_artifact
# #
...@@ -351,22 +420,7 @@ tests_tm5: ...@@ -351,22 +420,7 @@ tests_tm5:
# paths: # paths:
# - reports/flake8/ # - 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 the new coverage value only for the master and devel branches
# store_coverage: # store_coverage:
......
...@@ -8,7 +8,7 @@ extra_volumns="-v /home/aberchet/Projects/PYCIF_DATA_TEST/:/tmp/PYCIF_DATA_TEST/ ...@@ -8,7 +8,7 @@ extra_volumns="-v /home/aberchet/Projects/PYCIF_DATA_TEST/:/tmp/PYCIF_DATA_TEST/
docker run \ docker run \
-v $pycif_root_dir:/tmp/CIF/ \ -v $pycif_root_dir:/tmp/CIF/ \
$extra_volumns \ $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 @@ ...@@ -2,4 +2,4 @@
cd /tmp/CIF/ cd /tmp/CIF/
pip freeze 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= ...@@ -7,7 +7,7 @@ requires=
deps= deps=
numpy numpy
setenv = setenv =
COVERAGE_FILE={envdir}/.coverage COVERAGE_FILE={toxinidir}/coverage_raw/{envname}/.coverage
PYCIF_DATATEST=/tmp/PYCIF_DATA_TEST/ PYCIF_DATATEST=/tmp/PYCIF_DATA_TEST/
extras=test extras=test
skipsdist=True skipsdist=True
...@@ -33,8 +33,9 @@ skip_install=true ...@@ -33,8 +33,9 @@ skip_install=true
deps= deps=
coverage coverage
commands = 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 report --show-missing
coverage html -d reports/coverage coverage html -d reports/coverage
coverage xml -o reports/coverage.xml 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