[mutter] ci: Enable coverage reports in test build



commit 5c4938e47923333001508d39e5cd96bb2cdff186
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed May 6 15:27:41 2020 +0200

    ci: Enable coverage reports in test build
    
    While we don't have an high number of tests, we still have some code
    coverage and so we can track this via gitlab CI, given that it supports it
    natively.
    
    So add gcovr to the DockerFile dependency, build with -Db_coverage=true
    meson native parameter, and add another manual job to make ninja to generate
    the coverage reports on requests or in any master or tag ref.
    
    Keep the artifacts around to be able to browse the generated HTML files and
    eventually print the text reports so that they can be parsed by gitlab.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1236

 .gitlab-ci.yml        | 23 ++++++++++++++++++++++-
 .gitlab-ci/Dockerfile |  2 +-
 2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0e2fbbcae..0dad67390 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ stages:
  - review
  - build
  - test
+ - coverage
 
 check-commit-log:
   stage: review
@@ -17,7 +18,7 @@ check-commit-log:
 build-mutter:
   stage: build
   script:
-    - meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix 
/usr
+    - meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true 
--werror --prefix /usr
     - ninja -C build
     - ninja -C build install
   artifacts:
@@ -74,10 +75,30 @@ test-mutter:
     - >
       dbus-run-session -- xvfb-run -s '+iglx -noreset'
       meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
+  artifacts:
+    expire_in: 1 day
+    paths:
+      - build
   only:
     - merge_requests
     - /^.*$/
 
+test-mutter-coverage:
+  stage: coverage
+  dependencies:
+    - test-mutter
+  script:
+    - ninja -C build coverage
+    - cat build/meson-logs/coverage.txt
+  artifacts:
+    paths:
+      - build/meson-logs
+  when: manual
+  except:
+    refs:
+      - tags
+      - master
+
 can-build-gnome-shell:
   stage: test
   dependencies:
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index c3913793a..b09a9bb07 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -16,7 +16,7 @@ RUN dnf -y update && dnf -y upgrade && \
 
     # For running unit tests
     dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
-        '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center \
+        '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
         --setopt=install_weak_deps=False && \
 
     # GNOME Shell


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