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
This commit is contained in:
Patrick Ziegler 2021-10-16 19:58:34 +02:00 committed by GitHub
parent 4d90ac2f4c
commit b5fb44220d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 2 deletions

View File

@ -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