From fc0a532aa63e09a455b5064a215d0bb1df04dbe6 Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Fri, 21 Apr 2023 19:17:52 +0200
Subject: [PATCH] Add lcov coverage results in the pages

---
 .gitlab/common.yml   | 2 +-
 .gitlab/coverage.yml | 2 +-
 .gitlab/pages.yml    | 2 +-
 .gitlab/test.sh      | 1 +
 READMEDEV.org        | 6 ++++--
 tools/coverage.sh    | 1 +
 tools/pages.sh       | 1 +
 7 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.gitlab/common.yml b/.gitlab/common.yml
index 50833083b..496fc815e 100644
--- a/.gitlab/common.yml
+++ b/.gitlab/common.yml
@@ -38,7 +38,7 @@ default:
   stage: test
   script:
     - ./.gitlab/test.sh
-  coverage: /^\s*lines:\s*\d+.\d+\%/
+  coverage: /^\s*lines......:\s*\d+.\d+\%/
   artifacts:
     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
     expire_in: 2 days
diff --git a/.gitlab/coverage.yml b/.gitlab/coverage.yml
index d2393faac..cc923befb 100644
--- a/.gitlab/coverage.yml
+++ b/.gitlab/coverage.yml
@@ -11,7 +11,7 @@ coverage:
   stage: analyse
   script:
     - tools/coverage.sh
-  coverage: /^\s*lines:\s*\d+.\d+\%/
+  coverage: /^\s*lines......:\s*\d+.\d+\%/
   artifacts:
     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
     expire_in: 2 days
diff --git a/.gitlab/pages.yml b/.gitlab/pages.yml
index 8ae81ed8b..e47546195 100644
--- a/.gitlab/pages.yml
+++ b/.gitlab/pages.yml
@@ -2,7 +2,7 @@
 pages:
   stage: deploy
   extends: .only-master
-  dependencies: []
+  dependencies: [coverage]
   artifacts:
     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
     expire_in: 1 week
diff --git a/.gitlab/test.sh b/.gitlab/test.sh
index 6432472ae..677a10162 100755
--- a/.gitlab/test.sh
+++ b/.gitlab/test.sh
@@ -21,6 +21,7 @@ then
   cd $CI_PROJECT_DIR || fatal
   gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o ${LOGNAME}.cov --root $CI_PROJECT_DIR || fatal
   lcov --directory build-$VERSION --capture --output-file ${LOGNAME}.lcov || fatal
+  lcov --summary ${LOGNAME}.lcov || fatal
   cp ${LOGNAME}.junit junit.xml || fatal
   cp ${LOGNAME}.cov coverage.xml || fatal
 else
diff --git a/READMEDEV.org b/READMEDEV.org
index 82173c5e2..8c9f722ae 100644
--- a/READMEDEV.org
+++ b/READMEDEV.org
@@ -97,8 +97,10 @@ developers must follow and that should be read by contributors.
 
 * CDash tests dashboard
   To see details about the tests performed during the [[https://gitlab.inria.fr/solverstack/chameleon/pipelines][pipelines]] visit
-  [[https://my.cdash.org/index.php?project=Chameleon][CDash]].
+  [[https://my.cdash.org/index.php?project=Chameleon][CDash]]. It has been stopped for now because the CDash server is somehow
+  slow and our jobs may fail because of that.
 
 * Static and dynamic analysis
   To see details about the analysis job performed during the
-  [[https://gitlab.inria.fr/solverstack/chameleon/pipelines][pipelines]] visit [[https://sonarqube.bordeaux.inria.fr/sonarqube/dashboard?id=hiepacs%3Achameleon%3Agitlab%3Asolverstack%3Amaster][Sonarqube]].
+  [[https://gitlab.inria.fr/solverstack/chameleon/pipelines][pipelines]] visit [[https://sonarqube.inria.fr/sonarqube/dashboard?id=hiepacs%3Achameleon%3Agitlab%3Asolverstack][Sonarqube]].
+  See also the coverage of unitary tests here : [[https://solverstack.gitlabpages.inria.fr/chameleon/coverage][LCOV coverage]].
diff --git a/tools/coverage.sh b/tools/coverage.sh
index d1344a854..be6298089 100755
--- a/tools/coverage.sh
+++ b/tools/coverage.sh
@@ -22,5 +22,6 @@ do
 done
 lcov $INPUT_FILES -o chameleon.lcov
 lcov --summary chameleon.lcov
+genhtml -o coverage chameleon.lcov
 lcov_cobertura chameleon.lcov --output chameleon_coverage.xml
 gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR}
diff --git a/tools/pages.sh b/tools/pages.sh
index aad9ce35a..1878e8000 100755
--- a/tools/pages.sh
+++ b/tools/pages.sh
@@ -67,3 +67,4 @@ cp build-$VERSION/doc/user/*.jpg public/
 cp build-$VERSION/doc/user/*.svg public/
 cp -r build-$VERSION/doc/dev/html/* public/dev/
 cp tmp_fig/* public/
+cp -r coverage public/
-- 
GitLab