Skip to content

Commit d4babef

Browse files
committed
updated workflow to generate coverage report 🤞
1 parent 02b61d9 commit d4babef

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎.github/workflows/cmake-multi-platform.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@ jobs:
5050
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
5151
if [ "$RUNNER_OS" = "Linux" ]; then
5252
echo "vcpkg-setup-file=bootstrap-vcpkg.sh" >> "$GITHUB_OUTPUT"
53+
echo "enable_coverage=ON" >> "$GITHUB_OUTPUT"
5354
elif [ "$RUNNER_OS" = "Windows" ]; then
5455
echo "vcpkg-setup-file=bootstrap-vcpkg.bat" >> "$GITHUB_OUTPUT"
56+
echo "enable_coverage=OFF" >> "$GITHUB_OUTPUT"
5557
fi
5658
59+
- name: Install lcov Linux
60+
id: install-lcov
61+
if: runner.os == Linux
62+
run: |
63+
sudo apt update
64+
sudo apt install lcov
65+
5766
- name: Cache vcpkg
5867
id: cache-vcpkg
5968
uses: actions/cache@v3
@@ -78,11 +87,18 @@ jobs:
7887
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
7988
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
8089
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
90+
-DENABLE_COVERAGE=${{ steps.strings.outputs.enable_coverage }}
8191
-S ${{ github.workspace }}
8292
8393
- name: Build
8494
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j
8595

8696
- name: Test
97+
if: runner.os == Windows
8798
working-directory: ${{ steps.strings.outputs.build-output-dir }}/tests
8899
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure
100+
101+
- name: Test + Coverage
102+
if: runner.os != Windows
103+
working-directory: ${{ steps.strings.outputs.build-output-dir }}/tests
104+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -t coverage

0 commit comments

Comments
 (0)