Skip to content

Commit 2da0295

Browse files
committed
Fix CodeCov
1 parent d3dcc22 commit 2da0295

File tree

1 file changed

+27
-44
lines changed

1 file changed

+27
-44
lines changed

.github/workflows/c-cpp.yml

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,45 @@ name: CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [main]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [main]
88

99
jobs:
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
20+
sudo apt-get install -y libgtest-dev googletest lcov
2221
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"
3226
33-
- name: Run Advanced Demo
34-
working-directory: ${{github.workspace}}/build
35-
run: ./demo_advanced
27+
- name: Build
28+
run: cmake --build build
3629

37-
- name: Run Unit Tests
38-
working-directory: ${{github.workspace}}/build
30+
- name: Run Tests
31+
working-directory: ./build
3932
run: ./ConcurrentHashMapTest
4033

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

Comments
 (0)