@@ -2,16 +2,15 @@ name: CI
2
2
3
3
on :
4
4
push :
5
- branches : [ " main" ]
5
+ branches : [main]
6
6
pull_request :
7
- branches : [ " main" ]
7
+ branches : [main]
8
8
9
9
env :
10
10
BUILD_TYPE : Release
11
11
12
12
jobs :
13
- build :
14
-
13
+ build-and-test :
15
14
runs-on : ubuntu-latest
16
15
17
16
env :
@@ -23,17 +22,32 @@ jobs:
23
22
- name : Install dependencies
24
23
run : |
25
24
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
30
27
31
28
- 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"
33
32
34
33
- name : Build
35
- run : cmake --build ${{github.workspace}}/ build
34
+ run : cmake --build build --clean-first
36
35
37
- - name : Run Unit Tests
38
- working-directory : ${{github.workspace}} /build
36
+ - name : Run Tests
37
+ working-directory : . /build
39
38
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