Skip to content

Commit 10a8180

Browse files
authored
Improve Code Coverage (#116)
* chore: Update coverage.yml to include CPU core count in build and test commands * chore: Update coverage.yml to remove unnecessary coverage exclusion * Fix coverage exclusion * Update codecov.yml
1 parent 3bf28af commit 10a8180

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/coverage.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'src/**'
1111
- 'tests/**'
1212
- 'CMakeLists.txt'
13+
- 'codecov.yml'
1314

1415
jobs:
1516
Coverage:
@@ -28,6 +29,10 @@ jobs:
2829
sudo apt-get install ccache lcov
2930
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
3031
32+
- name: Get number of CPU cores
33+
uses: SimenB/[email protected]
34+
id: cpu-cores
35+
3136
- name: Cache Build
3237
id: cache-build
3338
uses: actions/[email protected]
@@ -51,14 +56,16 @@ jobs:
5156
-DCMAKE_BUILD_TYPE=Release \
5257
5358
- name: Build
54-
run: cd build; make -j2; ccache --show-stats
59+
run: |
60+
cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
61+
ccache --show-stats
5562
5663
- name: Run Coverage
5764
run: |
5865
cd build
59-
ctest --verbose --output-on-failure
66+
ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
6067
lcov --directory . --capture --output-file coverage.info
61-
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*' --output-file coverage.info
68+
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' 'tests/CMakeFiles/ipc_toolkit_tests.dir/src/tests/*' --output-file coverage.info
6269
6370
- name: Upload coverage reports to Codecov
6471
uses: codecov/[email protected]

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ coverage:
99
target: 75%
1010
threshold: 5%
1111
only_pulls: true
12+
ignore:
13+
- "tests/*"

0 commit comments

Comments
 (0)