test: Add code coverage support with CodeCov (#1681)

This commit is contained in:
iTrooz 2024-05-17 21:08:22 +02:00 committed by GitHub
parent f6953fd829
commit 44331506b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 8 deletions

3
.github/codecov.yml vendored Normal file
View File

@ -0,0 +1,3 @@
ignore:
- "lib/third_party" # Third party libraries should be ignored
- "lib/external" # Our own libraries should be checked in their own repositories

View File

@ -34,18 +34,11 @@ jobs:
restore-keys: ${{ runner.os }}-tests-build
max-size: 50M
- name: 📜 Restore CMakeCache
uses: actions/cache@v4
with:
path: |
build/CMakeCache.txt
key: ${{ runner.os }}-tests-build-${{ hashFiles('**/CMakeLists.txt') }}
- name: ⬇️ Install dependencies
run: |
sudo apt update
sudo bash dist/get_deps_debian.sh
sudo apt install gcovr -y
- name: 🛠️ Build
run: |
@ -73,6 +66,18 @@ jobs:
cd build
ctest --output-on-failure
# Generate report from all gcov .gcda files
- name: 🧪 Generate coverage report
run: |
gcovr --gcov-executable /usr/bin/gcov-12 -r . build --xml coverage_report.xml --verbose
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage_report.xml
langs:
name: 🧪 Langs
runs-on: ubuntu-22.04