From 51f25b52e488039923ccafd5b200174a281f9e01 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 24 Feb 2023 09:39:34 +1100 Subject: [PATCH] Extract test coverage statistics from the gcov job In older GitLab versions, the regular expression used for extracting test coverage statistics from the output of GitLab CI jobs was configured in the project's settings, using GitLab's web interface. That changed in recent GitLab versions [1]; the previous configuration method was removed from the web interface altogether as of GitLab 15.0. The relevant regular expression is now supposed to be set in the relevant job's definition in .gitlab-ci.yml. Set the regular expression used for extracting test coverage statistics in the definition of the "gcov" GitLab CI job. Use the regular expression suggested in GitLab's documentation [2]. [1] https://docs.gitlab.com/ee/update/deprecations.html#test-coverage-project-cicd-setting [2] https://docs.gitlab.com/ee/ci/pipelines/settings.html#test-coverage-examples (cherry picked from commit db7af9fcc1c91c3290982b555bdf1c55f6a73d66) --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a2c10bb57..004e2a789c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1601,6 +1601,7 @@ gcov: - gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories fuzz --exclude-directories lib/samples --exclude tests --html-details -o coverage.html - gcovr --root . --exclude-directories bin/tests --exclude-directories doc --exclude-directories fuzz --exclude-directories lib/samples --exclude tests -o coverage.txt - tail -n 3 coverage.txt + coverage: /^TOTAL.*\s+(\d+\%)$/ artifacts: paths: - coverage*.html