[gjs: 3/13] CI: Use Meson-based script for code coverage jobs



commit dee5d2a05cc7d714913ffd76ac988eef274270d5
Author: Philip Chimento <philip endlessm com>
Date:   Wed Oct 16 15:55:31 2019 -0700

    CI: Use Meson-based script for code coverage jobs
    
    We have a script that runs a Meson build inside its own build tree and
    generates the coverage report from there. Use this to drive the coverage
    CI jobs instead of the autotools coverage script.

 .gitlab-ci.yml  | 36 +++++++++++++++---------------------
 test/test-ci.sh | 17 -----------------
 2 files changed, 15 insertions(+), 38 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 30903b87..db7d3865 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,14 +8,25 @@ stages:
 - manual
 - deploy
 
-.Coverage files: &cov_files [configure, Makefile, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, 
./installed-tests/scripts/*.trs, coverage/]
 .Regular files: &reg_files  [configure, Makefile, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, 
./installed-tests/scripts/*.trs]
 
 .coverage: &coverage
+  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
+  variables:
+    TASK_ID: "coverage"
+    coverage: '/^  lines.*(\d+\.\d+\%)/'
+  script:
+    - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+    - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
+    # This script runs the build inside its own build tree and generates the
+    # coverage report
+    - tools/run_coverage.sh
   artifacts:
     name: log_coverage
     when: always
-    paths: *cov_files
+    paths:
+      - _coverage/html
+      - _coverage_build/meson-logs/*log.txt
 
 # Regular build
 .build: &build
@@ -38,12 +49,6 @@ stages:
        fi
     '
 
-    # Run code coverage tests
-    - 'if [[ $BUILD_OPTS == *"--enable-code-coverage"* ]]; then
-         $(pwd)/test/test-ci.sh GJS_COVERAGE;
-       fi
-    '
-
     # Run valgrind
     - 'if [[ $BUILD_OPTS == *"--enable-valgrind"* ]]; then
          $(pwd)/test/test-ci.sh VALGRIND;
@@ -147,14 +152,9 @@ build_meson:
 # Generates
 # The Code Coverage Report
 coverage-automatic:
-  <<: *build
   <<: *coverage
+  when: on_success
   stage: source_check
-  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
-  variables:
-    TASK_ID: "coverage"
-    BUILD_OPTS: "--enable-code-coverage"
-    coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
   except:
     - schedules
   only:
@@ -168,7 +168,7 @@ pages:
   dependencies:
     - coverage-automatic
   script:
-    - mv $(pwd)/coverage/ public/ || true
+    - mv $(pwd)/_coverage/html/ public/ || true
   artifacts:
     paths:
       - public
@@ -259,14 +259,8 @@ codequality:
     - schedules
 
 coverage:
-  <<: *build
   <<: *coverage
   stage: manual
-  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
-  variables:
-    TASK_ID: "coverage"
-    BUILD_OPTS: "--enable-code-coverage"
-    coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
   when: manual
   except:
     - schedules
diff --git a/test/test-ci.sh b/test/test-ci.sh
index 447976fe..d84e81eb 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -67,10 +67,6 @@ do_Compare_With_Upstream_Master () {
 do_Create_Artifacts_Folder () {
     # Create the artifacts folders
     save_dir="$(pwd)"
-
-    if test "$1" = "GJS_COVERAGE"; then
-         mkdir -p "$save_dir"/coverage; touch "$save_dir"/coverage/doing-"$1"
-    fi
     mkdir -p "$save_dir"/analysis; touch "$save_dir"/analysis/doing-"$1"
 }
 
@@ -195,19 +191,6 @@ elif test "$1" = "SH_CHECKS"; then
     installed-tests/scripts/testExamples.sh > scripts.log
     do_Check_Script_Errors
 
-elif test "$1" = "GJS_COVERAGE"; then
-    # It doesn't (re)build, just run the 'Coverage Tests'
-    do_Print_Labels 'Code Coverage Report'
-    do_Set_Env
-
-    make check-code-coverage
-    cp "$(pwd)"/gjs-?.*.*-coverage.info "$save_dir"/coverage/
-    cp -r "$(pwd)"/gjs-?.*.*-coverage/* "$save_dir"/coverage/
-
-    echo '-----------------------------------------'
-    sed -e 's/<[^>]*>//g' "$save_dir"/coverage/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$'  | tr '\n' 
' '; echo
-    echo '-----------------------------------------'
-
 elif test "$1" = "CPPLINT"; then
     do_Print_Labels 'C/C++ Linter report '
 


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