Skip to content

Commit 9f9bfb1

Browse files
committed
attempt fixing ci
1 parent 49e1643 commit 9f9bfb1

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717
run: |
1818
sudo apt-get update
1919
sudo apt-get install -y cmake build-essential libgtest-dev lcov
20+
cd /usr/src/googletest
21+
sudo cmake .
22+
sudo make
23+
sudo make install
2024
2125
- name: Configure & build (with coverage)
2226
run: cmake -S . -B build \
@@ -34,13 +38,7 @@ jobs:
3438
run: ctest --test-dir build --output-on-failure
3539

3640
- name: Capture coverage
37-
run: |
38-
cd build
39-
# TODO: remove
40-
find . -name '*.gcda'
41-
lcov -d . -c -o coverage.info
42-
# move the report back up so the next steps can find it
43-
mv coverage.info ..
41+
run: lcov -d build -c -o coverage.info
4442

4543
- name: Filter coverage
4644
run: lcov -r coverage.info '/usr/*' '*/test/*' -o coverage.filtered.info

CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ project(capancdt_proximity_sensor_lib LANGUAGES CXX)
33

44
option(ENABLE_COVERAGE "Enable coverage reporting" OFF)
55
if(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+
# apply to *all* subsequent targets
8+
add_compile_options(--coverage -O0 -g)
9+
add_link_options(--coverage)
1210
endif()
1311

1412
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ Install GTest and lcov for testing. On ubuntu you can do this with:
188188
sudo 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 cp *.a /usr/lib
198+
```
199+
191200
Build the project:
192201

193202
```bash

0 commit comments

Comments
 (0)