File tree Expand file tree Collapse file tree 3 files changed +24
-13
lines changed
Expand file tree Collapse file tree 3 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11- runs-on : ubuntu-latest
11+ strategy :
12+ matrix :
13+ os : [ubuntu-22.04, ubuntu-24.04]
14+ runs-on : ${{ matrix.os }}
1215
1316 steps :
1417 - uses : actions/checkout@v3
@@ -19,13 +22,13 @@ jobs:
1922 sudo apt-get install -y cmake build-essential libgtest-dev lcov
2023
2124 - name : Configure & build (with coverage)
22- run : cmake -S . -B build \
25+ run : |
26+ cmake -S . -B build \
2327 -DENABLE_COVERAGE=ON \
2428 -DBUILD_TESTING=ON \
2529 -DCMAKE_BUILD_TYPE=Debug
2630
27- - name : Build
28- run : cmake --build build --parallel
31+ cmake --build build --parallel
2932
3033 - name : Zero coverage counters
3134 run : lcov -d build -z
@@ -34,18 +37,18 @@ jobs:
3437 run : ctest --test-dir build --output-on-failure
3538
3639 - name : Capture coverage
37- run : lcov -d build -c -o coverage.info
40+ run : lcov -c - d build/CMakeFiles/capancdt_proximity_sensor_lib.dir/src -o coverage.info
3841
3942 - name : Filter coverage
40- run : lcov -r coverage.info '/usr/*' '*/test/*' -o coverage.filtered.info
43+ run : lcov --ignore-errors unused - r coverage.info '/usr/*' '*/test/*' -o coverage.filtered.info
4144
4245 - name : Generate HTML report
4346 run : genhtml coverage.filtered.info --output-directory coverage-report
4447
4548 - name : Upload coverage-report
4649 uses : actions/upload-artifact@v4
4750 with :
48- name : coverage-report
51+ name : coverage-report-${{ matrix.os }}
4952 path : coverage-report
5053
5154 - name : Upload coverage reports to Codecov
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ project(capancdt_proximity_sensor_lib LANGUAGES CXX)
33
44option (ENABLE_COVERAGE "Enable coverage reporting" OFF )
55if (ENABLE_COVERAGE)
6- message (STATUS "Building with coverage support" )
7- # GCC/Clang coverage instrumentation
8- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -g" )
9- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -O0 -g" )
10- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" )
11- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
6+ message (STATUS "Building with coverage instrumentation" )
7+ set (COVERAGE_FLAGS "--coverage -O0 -g" )
8+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_FLAGS} " )
9+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} " )
10+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" )
1211endif ()
1312
1413set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib)
Original file line number Diff line number Diff line change @@ -188,6 +188,15 @@ Install GTest and lcov for testing. On ubuntu you can do this with:
188188sudo apt-get install libgtest-dev lcov
189189```
190190
191+ You may need to build GTest:
192+
193+ ``` bash
194+ cd /usr/src/googletest
195+ sudo cmake .
196+ sudo make
197+ sudo make install
198+ ```
199+
191200Build the project:
192201
193202``` bash
You can’t perform that action at this time.
0 commit comments