From b2ebbc6d663bc1940990ae5f3efc6a7a737c0429 Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 14 Sep 2022 14:56:52 +0200 Subject: [PATCH] git: Added coverage checking to tests --- .github/workflows/tests.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d9c84e..2d4d499 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,8 @@ jobs: make \ python3 \ python3-pip \ - libmagic-dev + libmagic-dev \ + lcov sudo pip install jsonschema @@ -45,10 +46,10 @@ jobs: cd tests mkdir -p build cd build - CC=gcc-12 CXX=g++-12 cmake \ - -DCMAKE_C_FLAGS="-fuse-ld=lld" \ - -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ - -DLIBPL_ENABLE_TESTS=OFF \ + CC=gcc-12 CXX=g++-12 cmake \ + -DCMAKE_C_FLAGS="-fuse-ld=lld --coverage" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld --coverage" \ + -DLIBPL_ENABLE_TESTS=OFF \ .. make -j4 @@ -56,6 +57,18 @@ jobs: run: | cd tests/build ctest --output-on-failure + + - name: ⚗️ Generate Coverage Report + run: | + cd tests/build + lcov -d ./includes -d ./patterns --gcov-tool /usr/bin/gcov-12 -c -o coverage.info + + - name: ⬆️ Upload Coverage Report + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: tests/build/coverage.info + - name: 📎 Validate JSON Files run: | cd constants