[gnome-settings-daemon/wip/claudio/CI: 9/13] CI: add code coverage report



commit 3c66e4f647899548411a80432b30daed45a28183
Author: Claudio André <claudioandre br gmail com>
Date:   Thu Jul 12 17:33:18 2018 -0300

    CI: add code coverage report
    
    It works only if enabled via CI/CD Settings. More info available at
    https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-parsing.

 .gitlab-ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ce3663bb..bf543db4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,7 @@ stages:
   - build
   - test
   - manual
+  - delivery
 
 .Log files: &log_files  [./*.log, _build/meson-logs/]
 
@@ -82,7 +83,50 @@ test:
         meson test -C _build --verbose --no-stdsplit
       fi
 
+# Runs the coverage test.
+coverage:
+  <<: *save_build_logs
+  stage: test
+  variables:
+    BUILD_OPTS: "-Db_coverage=true"
+    coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
+  only:
+    - master@GNOME/gnome-settings-daemon
+
+  script:
+    - *environment_information
+    - *build_procedure
+    - *run_tests
+
+    - ninja -C _build coverage-html
+
+    # Parse the report to get the coverage result
+    - |
+      echo == Coverage ==
+      sed -e 's/<[^>]*>//g' _build/meson-logs/coveragereport/index.html | tr -d ' \t' | grep -A3 -P 
'^Lines:$'  | tr '\n' ' '; echo
+
+##
+# Stage: Delivery
+#
+# Publishes the Coverage Report generated above
+##
+pages:
+  stage: delivery
+  dependencies:
+    - coverage
+  script:
+    - mv _build/meson-logs/coveragereport/ public/
+  artifacts:
+    paths:
+      - public
+  only:
+    - master@GNOME/gnome-settings-daemon
+
+##
+# Stage: Manual
+#
 # Runs the sanitizers [address, thread, undefined, and memory].
+##
 .sanitizer: &sanitizer
   <<: *save_build_logs
   stage: manual


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