[at-spi2-core: 2/7] Use grcov to generate the coverage report




commit fee3e3d08054300c13622aa6890e5d09cc2ddc6d
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jun 3 19:04:44 2022 -0500

    Use grcov to generate the coverage report
    
    Also output a Cobertura XML report so Gitlab can show per-line
    coverage in diffs for a merge request.

 .gitlab-ci.yml | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bcd7d0cb..38f39765 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -147,18 +147,19 @@ coverage:
     - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
     - meson compile -C _build
     - meson install -C _build
-    - mkdir -p _coverage
-    - lcov --config-file ci/lcovrc --directory _build --capture --initial --output-file 
"_coverage/${CI_JOB_NAME}-baseline.lcov"
     - dbus-run-session -- ci/run-tests.sh
-    - lcov --config-file ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
-    - bash -x ci/gen-coverage.sh
+    - grcov _build --source-dir ./ --prefix-dir ../ --output-type cobertura --branch --ignore-not-existing 
-o coverage.xml
+    - grcov _build --source-dir ./ --prefix-dir ../ --output-type html --branch --ignore-not-existing -o 
_coverage
     - mkdir -p public/
-    - cp -r _coverage/coverage public/
-  coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
+    - cp -r _coverage public/coverage
+    - grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", 
$1 * 100 }'
+  coverage: '/Coverage: \d+\.\d+/'
   artifacts:
     name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     expire_in: 2 days
     when: always
+    reports:
+      cobertura: coverage.xml
     paths:
       - "_build/meson-logs"
       - public
@@ -193,4 +194,4 @@ pages:
   rules:
     - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH)
     # Restrict it to the gnome namespace to avoid every fork pushing a set of pages by default
-    # - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "gnome")
\ No newline at end of file
+    # - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "gnome")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]