]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
CI: add code coverage reports via lcov and coveralls.io
authorLuca Boccassi <luca.boccassi@microsoft.com>
Wed, 22 Sep 2021 14:41:22 +0000 (15:41 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 27 Sep 2021 11:22:22 +0000 (12:22 +0100)
.github/workflows/unit_tests.sh
.github/workflows/unit_tests.yml
README.md

index f661d45c99b053bf27031af0c6863ac5ec81d51c..edc69301a4d8ff0561099e3569877b2c91937b24 100755 (executable)
@@ -8,6 +8,7 @@ ADDITIONAL_DEPS=(
     fdisk
     iproute2
     jekyll
+    lcov
     libfdisk-dev
     libfido2-dev
     libp11-kit-dev
@@ -45,10 +46,18 @@ for phase in "${PHASES[@]}"; do
                 export CC=clang
                 export CXX=clang++
             fi
-            meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true -Dman=true build
+            if [[ "$phase" = "RUN_GCC" ]]; then
+                MESON_ARGS+=(-Db_coverage=true)
+                # See FIXME below
+                (set +x; while :; do echo -ne "\n[WATCHDOG] $(date)\n"; sleep 30; done) &
+            fi
+            meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true -Dman=true "${MESON_ARGS[@]}" build
             ninja -C build -v
             # Some of the unsafe tests irreparably break the host's network connectivity, so run them in a namespace
             unshare -n bash -c 'ip link set dev lo up; meson test -C build --print-errorlogs'
+            if [[ "$phase" = "RUN_GCC" ]]; then
+                ninja -C build coverage
+            fi
             ;;
         RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN)
             MESON_ARGS=(--optimization=1)
index ca1e6e0c30f5102d7182121ce1feda77bfac2fe4..ade9323cbb02d5bb546c09453fb43fb17dbce672 100644 (file)
@@ -16,8 +16,14 @@ jobs:
         run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_ASAN_UBSAN]
     steps:
       - name: Repository checkout
-        uses: actions/checkout@v1
+        uses: actions/checkout@v2
       - name: Install build dependencies
         run: sudo -E .github/workflows/unit_tests.sh SETUP
       - name: Build & test (${{ matrix.run_phase }})
         run: sudo -E .github/workflows/unit_tests.sh RUN_${{ matrix.run_phase }}
+      - name: Coveralls
+        if: matrix.run_phase == 'GCC' && github.repository == 'systemd/systemd'
+        uses: coverallsapp/github-action@master
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          path-to-lcov: ./build/meson-logs/coverage.info
index 6734e92a24b4d61086c1a891a543685b853854d5..180b34de2289ace2cd42eeb63ebbc3d4c5bedf57 100644 (file)
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ System and Service Manager
 [![CentOS CI - Arch](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch&job=upstream-vagrant-archlinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux/)<br/>
 [![CentOS CI - Arch (sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch%20(sanitizers)&job=upstream-vagrant-archlinux-sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/)<br/>
 [![Fossies codespell report](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.svg)](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.html)</br>
+[![Coverage Status](https://coveralls.io/repos/github/systemd/systemd/badge.svg?branch=main)](https://coveralls.io/github/systemd/systemd?branch=main)</br>
 [![Packaging status](https://repology.org/badge/tiny-repos/systemd.svg)](https://repology.org/project/systemd/versions)
 
 ## Details