From 900439cdd87694a317ea77085985c47f79587a7f Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Thu, 26 Sep 2024 21:18:47 +0200 Subject: [PATCH] ci: unit_tests: collect coverage Install both gcovr and ninja from pypi, so a single tool (pip) is used. Signed-off-by: Marcin Niestroj --- .github/workflows/lint_build_unit_test.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_build_unit_test.yml b/.github/workflows/lint_build_unit_test.yml index 2b3af32b4..733aa7f95 100644 --- a/.github/workflows/lint_build_unit_test.yml +++ b/.github/workflows/lint_build_unit_test.yml @@ -46,9 +46,9 @@ jobs: with: submodules: 'recursive' - - name: Install ninja + - name: Install gcovr and ninja run: | - sudo apt install -y ninja-build + pip install gcovr ninja - name: Run unit tests run: | @@ -59,6 +59,22 @@ jobs: --output-on-failure \ --timeout 2 + - name: Coverage + run: | + gcovr \ + --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \ + --merge-mode-functions=separate \ + --json coverage.json \ + build + + - name: Upload test coverage artifacts + uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: unit-test-coverage + path: | + coverage.json + linux_build: runs-on: ubuntu-latest steps: