From 44331506b20c060067c3635f8cc1eb65b9f9eb57 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Fri, 17 May 2024 21:08:22 +0200 Subject: [PATCH] test: Add code coverage support with CodeCov (#1681) --- .github/codecov.yml | 3 +++ .github/workflows/tests.yml | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..c1bf9f84b --- /dev/null +++ b/.github/codecov.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38e947f40..6d08cc84e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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