# HG changeset patch # User Thierry Florac # Date 1574869294 -3600 # Node ID 3e1e16d5bbafb2a64d31dbe644b4f764ffe61f4c # Parent a5ac0ef9b40ba7d580bf186994960c512e444406 Added code coverage status diff -r a5ac0ef9b40b -r 3e1e16d5bbaf .gitlab-ci.yml --- a/.gitlab-ci.yml Tue Nov 26 10:40:06 2019 +0100 +++ b/.gitlab-ci.yml Wed Nov 27 16:41:34 2019 +0100 @@ -26,7 +26,18 @@ test: stage: test script: - - ./bin/test + - pip install anybadge + - mkdir ./coverage + - ./bin/test --coverage coverage | tee ./coverage/coverage.log + - GLOBAL_COVER=$(/bin/grep -e '^[[:space:]]*[[:digit:]]\+[[:space:]]\+[[:digit:]]\+\%' ./coverage/coverage.log | + awk 'BEGIN { lines=0; cov=0 } + { lines = lines + $1; cov = cov + $1 * $2 / 100 } + END { printf "%.2f", cov / lines * 100 }') + - anybadge --label=Coverage --file=./coverage/coverage.svg --value=$GLOBAL_COVER 20=red 40=orange 60=yellow 80=green + - echo "Global tests coverage is $GLOBAL_COVER %" + artifacts: + paths: + - ./coverage/ dist: stage: dist