@@ -2,38 +2,46 @@ name: CI
22
33on :
44 push :
5- branches : [ " main" ]
5+ branches : [main]
66 pull_request :
7- branches : [ " main" ]
7+ branches : [main]
88
99jobs :
10- build :
10+ build-and-test :
1111 runs-on : ubuntu-latest
1212
1313 steps :
1414 - uses : actions/checkout@v4
15- with :
16- submodules : recursive
17-
15+
1816 - name : Install dependencies
1917 run : |
2018 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 lcov
20+ sudo apt-get install -y libgtest-dev googletest
2221
2322 - name : Configure CMake
24- run : cmake -B ${{github.workspace}}/build
25-
23+ run : |
24+ cmake -B build -DCMAKE_BUILD_TYPE=Debug \
25+ -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fprofile-update=atomic -O0"
26+
2627 - name : Build
27- run : cmake --build ${{github.workspace}}/ build
28+ run : cmake --build build --clean-first
2829
29- - name : Run Basic Demo
30- working-directory : ${{github.workspace}} /build
31- run : ./demo_basic
30+ - name : Run Tests
31+ working-directory : . /build
32+ run : ./ConcurrentHashMapTest
3233
33- - name : Run Advanced Demo
34- working-directory : ${{github.workspace}}/build
35- run : ./demo_advanced
34+ - name : Generate Coverage Report
35+ run : |
36+ lcov --capture --directory ./build --output-file coverage.info \
37+ --rc geninfo_unexecuted_blocks=1 \
38+ --ignore-errors mismatch,negative
39+ lcov --remove coverage.info '/usr/*' --output-file coverage.info
40+ lcov --list coverage.info || true # Prevent failure on warnings
3641
37- - name : Run Unit Tests
38- working-directory : ${{github.workspace}}/build
39- run : ./ConcurrentHashMapTest
42+ - name : Upload to Codecov
43+ uses : codecov/codecov-action@v5
44+ with :
45+ token : ${{ secrets.CODECOV_TOKEN }}
46+ file : coverage.info
47+ fail_ci_if_error : false
0 commit comments