diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-09-22 16:41:22 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-09-27 13:22:22 +0200 |
commit | 1f1d48f96e0a298fbf1059c53debdab6f08791f3 (patch) | |
tree | fdb47616473624069960212ec939e71b569c452c /.github | |
parent | CI: run unit tests in a network namespace (diff) | |
download | systemd-1f1d48f96e0a298fbf1059c53debdab6f08791f3.tar.xz systemd-1f1d48f96e0a298fbf1059c53debdab6f08791f3.zip |
CI: add code coverage reports via lcov and coveralls.io
Diffstat (limited to '.github')
-rwxr-xr-x | .github/workflows/unit_tests.sh | 11 | ||||
-rw-r--r-- | .github/workflows/unit_tests.yml | 8 |
2 files changed, 17 insertions, 2 deletions
diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh index f661d45c99..edc69301a4 100755 --- a/.github/workflows/unit_tests.sh +++ b/.github/workflows/unit_tests.sh @@ -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) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index ca1e6e0c30..ade9323cbb 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -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 |