@@ -2,16 +2,15 @@ name: CI
22
33on :
44 push :
5- branches : [ " main" ]
5+ branches : [main]
66 pull_request :
7- branches : [ " main" ]
7+ branches : [main]
88
99env :
1010 BUILD_TYPE : Release
1111
1212jobs :
13- build :
14-
13+ build-and-test :
1514 runs-on : ubuntu-latest
1615
1716 env :
@@ -23,17 +22,32 @@ jobs:
2322 - name : Install dependencies
2423 run : |
2524 sudo apt-get update
26- sudo apt-get install -y build-essential cmake libgtest-dev googletest
27-
28- - name : Create build directory
29- run : mkdir build
25+ sudo apt-get install -y build-essential cmake lcov
26+ sudo apt-get install -y libgtest-dev googletest
3027
3128 - name : Configure CMake
32- run : cmake -B ${{github.workspace}}/build
29+ run : |
30+ cmake -B build -DCMAKE_BUILD_TYPE=Debug \
31+ -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fprofile-update=atomic -O0"
3332
3433 - name : Build
35- run : cmake --build ${{github.workspace}}/ build
34+ run : cmake --build build --clean-first
3635
37- - name : Run Unit Tests
38- working-directory : ${{github.workspace}} /build
36+ - name : Run Tests
37+ working-directory : . /build
3938 run : ./test/flexitimerTest
39+
40+ - name : Generate Coverage Report
41+ run : |
42+ lcov --capture --directory ./build --output-file coverage.info \
43+ --rc geninfo_unexecuted_blocks=1 \
44+ --ignore-errors mismatch,negative
45+ lcov --remove coverage.info '/usr/*' --output-file coverage.info
46+ lcov --list coverage.info || true # Prevent failure on warnings
47+
48+ - name : Upload to Codecov
49+ uses : codecov/codecov-action@v5
50+ with :
51+ token : ${{ secrets.CODECOV_TOKEN }}
52+ file : coverage.info
53+ fail_ci_if_error : false
0 commit comments