[librsvg: 2/14] CI: Move the coverage script to an actual shell script




commit adc2d2e0e21258bad797b4400fb2382988886989
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Sep 26 12:18:24 2022 -0500

    CI: Move the coverage script to an actual shell script
    
    I sometimes run this at home, and cutting&pasting things from
    .gitlab-ci.yml gets old pretty fast.  So let's make this reusable.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/754>

 .gitlab-ci.yml            | 20 ++------------------
 ci/build-with-coverage.sh | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e43eaf5fb..8f0318939 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -302,25 +302,9 @@ coverage:
     - job: opensuse-container@x86_64.stable
     - job: check
       artifacts: false
-  variables:
-    # Mixed gcc and Rust/LLVM coverage for the C API tests:
-    # https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15
-    CC: "clang"
-    CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
-    # RUSTFLAGS: "-Cinstrument-coverage"
-    RUSTDOCFLAGS: "-Cinstrument-coverage"
-    LLVM_PROFILE_FILE: "coverage-profiles/coverage-%p-%m.profraw"
-    LDFLAGS: "--coverage -L/usr/lib64/clang/14.0.6/lib/linux"
-    LIBS: "-lclang_rt.profile-x86_64"
-    RUSTC_BOOTSTRAP: "1"   # hack to make -Zprofile work on the non-nightly compiler
-    CARGO_INCREMENTAL: "0" # -Zprofile (gcov) doesn't like incremental compilation
-    RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off"
   script:
-    - mkdir -p _build
-    - cd _build
-    - ../autogen.sh --disable-gtk-doc --disable-vala --enable-debug
-    - make
-    - make -k check
+    - source ./ci/env.sh
+    - bash -x ./ci/build-with-coverage.sh
   after_script:
     - source ./ci/env.sh
     - bash -x ./ci/gen-coverage.sh
diff --git a/ci/build-with-coverage.sh b/ci/build-with-coverage.sh
new file mode 100644
index 000000000..9d4dea737
--- /dev/null
+++ b/ci/build-with-coverage.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -eux -o pipefail
+
+# Mixed gcc and Rust/LLVM coverage for the C API tests:
+# https://searchfox.org/mozilla-central/source/browser/config/mozconfigs/linux64/code-coverage#15
+export CC="clang"
+export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
+# RUSTFLAGS: "-Cinstrument-coverage"
+export RUSTDOCFLAGS="-Cinstrument-coverage"
+export LLVM_PROFILE_FILE="coverage-profiles/coverage-%p-%m.profraw"
+export LDFLAGS="--coverage -L/usr/lib64/clang/14.0.6/lib/linux"
+export LIBS="-lclang_rt.profile-x86_64"
+export RUSTC_BOOTSTRAP="1"   # hack to make -Zprofile work on the non-nightly compiler
+export CARGO_INCREMENTAL="0" # -Zprofile (gcov) doesn't like incremental compilation
+export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off"
+
+mkdir -p _build
+cd _build
+../autogen.sh --disable-gtk-doc --disable-vala --enable-debug
+make
+make -k check


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