Skip to content

Commit

Permalink
Improve Code Coverage (#116)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
zfergus authored Aug 9, 2024
1 parent 3bf28af commit 10a8180
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'src/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'codecov.yml'

jobs:
Coverage:
Expand All @@ -28,6 +29,10 @@ jobs:
sudo apt-get install ccache lcov
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Get number of CPU cores
uses: SimenB/[email protected]
id: cpu-cores

- name: Cache Build
id: cache-build
uses: actions/[email protected]
Expand All @@ -51,14 +56,16 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
- name: Build
run: cd build; make -j2; ccache --show-stats
run: |
cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
ccache --show-stats
- name: Run Coverage
run: |
cd build
ctest --verbose --output-on-failure
ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*tests/*' --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' 'tests/CMakeFiles/ipc_toolkit_tests.dir/src/tests/*' --output-file coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ coverage:
target: 75%
threshold: 5%
only_pulls: true
ignore:
- "tests/*"

0 comments on commit 10a8180

Please sign in to comment.