From b5fb44220d6ce6e2a676d58638afa0b49564279a Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Sat, 16 Oct 2021 19:58:34 +0200 Subject: [PATCH] ci: Use new codecov uploader (#2541) * ci: Use new codecov uploader The bash uploader is deprecated Ref: https://about.codecov.io/blog/codecov-uploader-deprecation-plan/ * Collect coverage report using lcov * Remove branch coverage There are a lot of hidden branches in the C++ code which doesn't make it very useful --- .github/workflows/ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44b1caec..449e0921 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,10 @@ jobs: libnl-genl-3-dev \ libmpdclient-dev fi + + if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then + sudo apt-get install -y lcov + fi - uses: actions/checkout@v2 with: submodules: true @@ -107,13 +111,28 @@ jobs: run: | cd $BUILD_DIR make + - name: Collect initial coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + run: | + lcov --capture --initial --no-external --directory . -o cov_base.info - name: Tests if: ${{ matrix.polybar_build_type == 'tests' }} run: | cd $BUILD_DIR make check - cd $POLYBAR_DIR - bash <(curl -s https://codecov.io/bash) -F unittests -a "-ap" -Z + - name: Collect coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + run: | + lcov --capture --no-external --directory . -o cov_tests.info + lcov --add-tracefile cov_base.info --add-tracefile cov_tests.info -o cov_total.info + lcov --remove cov_total.info ${PWD}'/build/*' ${PWD}'/tests/*' ${PWD}'/lib/*' -o cov.info + - name: Upload Coverage + if: ${{ matrix.polybar_build_type == 'tests' }} + uses: codecov/codecov-action@v2 + with: + flags: unittests + files: ./cov.info + fail_ci_if_error: true - name: Upload Logs if: failure() uses: actions/upload-artifact@v2