@@ -2,62 +2,45 @@ 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
jobs :
10
- build :
10
+ build-and-test :
11
11
runs-on : ubuntu-latest
12
12
13
13
steps :
14
14
- uses : actions/checkout@v4
15
- with :
16
- submodules : recursive
17
-
15
+
18
16
- name : Install dependencies
19
17
run : |
20
18
sudo apt-get update
21
- sudo apt-get install -y build-essential cmake libgtest-dev googletest
19
+ sudo apt-get install -y build-essential cmake
20
+ sudo apt-get install -y libgtest-dev googletest lcov
22
21
23
- - name : Configure CMake
24
- run : cmake -B ${{github.workspace}}/build
25
-
26
- - name : Build
27
- run : cmake --build ${{github.workspace}}/build
28
-
29
- - name : Run Basic Demo
30
- working-directory : ${{github.workspace}}/build
31
- run : ./demo_basic
22
+ - name : Configure CMake with Coverage
23
+ run : |
24
+ cmake -B build -DCMAKE_BUILD_TYPE=Debug \
25
+ -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage"
32
26
33
- - name : Run Advanced Demo
34
- working-directory : ${{github.workspace}}/build
35
- run : ./demo_advanced
27
+ - name : Build
28
+ run : cmake --build build
36
29
37
- - name : Run Unit Tests
38
- working-directory : ${{github.workspace}} /build
30
+ - name : Run Tests
31
+ working-directory : . /build
39
32
run : ./ConcurrentHashMapTest
40
33
41
- test :
42
- name : Run tests and collect coverage
43
- runs-on : ubuntu-latest
44
- steps :
45
- - name : Checkout
46
- uses : actions/checkout@v4
47
- with :
48
- fetch-depth : 2
49
-
50
- - name : Set up Node
51
- uses : actions/setup-node@v4
52
-
53
- - name : Install dependencies
54
- run : npm install
55
-
56
- - name : Run tests
57
- run : npx jest --coverage
58
-
59
- - name : Upload results to Codecov
60
- uses : codecov/codecov-action@v5
61
- with :
62
- token : ${{ secrets.CODECOV_TOKEN }}
63
- slug : diffstorm/ConcurrentHashMap
34
+ - name : Generate Coverage Report
35
+ run : |
36
+ lcov --capture --directory ./build --output-file coverage.info
37
+ lcov --remove coverage.info '/usr/*' '*/test/*' --output-file coverage.info
38
+ lcov --list coverage.info
39
+
40
+ - name : Upload to Codecov
41
+ uses : codecov/codecov-action@v5
42
+ with :
43
+ token : ${{ secrets.CODECOV_TOKEN }}
44
+ file : coverage.info
45
+ flags : cpp
46
+ name : Codecov-CPP
0 commit comments