From: Evgeny Vereshchagin Date: Tue, 2 Nov 2021 15:18:19 +0000 (+0000) Subject: ci: build coverage reports on Coveralls X-Git-Tag: v2.38-rc1~188 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b027550704f20f74c3196964472651b5efbc896d;p=thirdparty%2Futil-linux.git ci: build coverage reports on Coveralls Signed-off-by: Evgeny Vereshchagin --- diff --git a/.github/workflows/cibuild-setup-ubuntu.sh b/.github/workflows/cibuild-setup-ubuntu.sh index 12a28f2f4c..1ea51c542a 100755 --- a/.github/workflows/cibuild-setup-ubuntu.sh +++ b/.github/workflows/cibuild-setup-ubuntu.sh @@ -18,6 +18,7 @@ PACKAGES=( socat asciidoctor meson + lcov ) PACKAGES_OPTIONAL=( diff --git a/.github/workflows/cibuild.sh b/.github/workflows/cibuild.sh index 023ab6ed3f..6d821b1c43 100755 --- a/.github/workflows/cibuild.sh +++ b/.github/workflows/cibuild.sh @@ -5,6 +5,7 @@ COMPILER="${COMPILER:?}" COMPILER_VERSION="${COMPILER_VERSION}" CFLAGS=(-O1 -g) CXXFLAGS=(-O1 -g) +LDFLAGS=() if [[ "$COMPILER" == clang ]]; then CC="clang${COMPILER_VERSION:+-$COMPILER_VERSION}" @@ -27,6 +28,12 @@ for phase in "${PHASES[@]}"; do --enable-werror ) + if [[ "$COVERAGE" == "yes" ]]; then + CFLAGS+=(--coverage) + CXXFLAGS+=(--coverage) + LDFLAGS+=(--coverage) + fi + if [[ "$SANITIZE" == "yes" ]]; then opts+=(--enable-asan --enable-ubsan) CFLAGS+=(-fno-omit-frame-pointer) @@ -42,7 +49,7 @@ for phase in "${PHASES[@]}"; do sudo -E git clean -xdf ./autogen.sh - CC="$CC" CXX="$CXX" CFLAGS="${CFLAGS[@]}" CXXFLAGS="${CXXFLAGS[@]}" ./configure "${opts[@]}" + CC="$CC" CXX="$CXX" CFLAGS="${CFLAGS[@]}" CXXFLAGS="${CXXFLAGS[@]}" LDFLAGS="${LDFLAGS[@]}" ./configure "${opts[@]}" ;; MAKE) make -j @@ -89,6 +96,13 @@ for phase in "${PHASES[@]}"; do fi ./tests/run.sh --show-diff + + if [[ "$COVERAGE" == "yes" ]]; then + lcov --directory . --capture --initial --output-file coverage.info.initial + lcov --directory . --capture --output-file coverage.info.run --no-checksum --rc lcov_branch_coverage=1 + lcov -a coverage.info.initial -a coverage.info.run --rc lcov_branch_coverage=1 -o coverage.info.raw + lcov --extract coverage.info.raw "$(pwd)/*" --rc lcov_branch_coverage=1 --output-file coverage.info + fi ;; DISTCHECK) make distcheck diff --git a/.github/workflows/cibuild.yml b/.github/workflows/cibuild.yml index 9db288f47e..811537cc88 100644 --- a/.github/workflows/cibuild.yml +++ b/.github/workflows/cibuild.yml @@ -37,6 +37,28 @@ jobs: run: sudo -E .github/workflows/cibuild.sh CHECK - name: Make install run: .github/workflows/cibuild.sh INSTALL + coveralls: + runs-on: ubuntu-latest + if: github.repository == 'util-linux/util-linux' + env: + COMPILER: gcc + COMPILER_VERSION: 10 + SANITIZE: no + COVERAGE: yes + steps: + - name: Repository checkout + uses: actions/checkout@v1 + - name: Ubuntu setup + run: sudo -E .github/workflows/cibuild-setup-ubuntu.sh + - name: Configure & Make + run: .github/workflows/cibuild.sh CONFIGURE MAKE + - name: Check + run: sudo -E .github/workflows/cibuild.sh CHECK + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./coverage.info meson: needs: build runs-on: ubuntu-latest