-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub action for code coverage #12
Conversation
.github/workflows/code-coverage.yml
Outdated
- name: Filter out 3rd party and mock files | ||
run: | | ||
echo "Filtering out 3rd party and mock files from coverage data..." | ||
lcov --remove cmake-build-unit-tests/coverage_unfiltered.info \ | ||
'*libs/3rdparty/googletest/*' \ | ||
'*/mock/*' \ | ||
'*/gmock/*' \ | ||
'*/usr/include/*' \ | ||
'*/gtest/*' \ | ||
--output-file cmake-build-unit-tests/coverage.info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than exclude a whole list of locations, only exclude the mock/test patterns and instead use options like:
• --directory: Specifies the directory containing .gcda and .gcno files.
• --capture: Captures coverage data.
• --include/--extract: Includes files matching specific patterns.
• --remove: Excludes files matching specific patterns.
• --no-external: Excludes coverage data for files outside the specified directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes Oliver, I have excluded the mock/test patterns but I also had to exclude 3rd party files because they were not getting excluded by using --no-external command in the latest commit. It works for excluding system libraries though
.github/workflows/code-coverage.yml
Outdated
- name: Test | ||
# Execute tests defined by the CMake configuration. | ||
run: | | ||
cmake -B cmake-build-unit-tests -S executables/unitTest -DBUILD_UNIT_TESTS=ON | ||
cmake --build cmake-build-unit-tests -j4 | ||
ctest --test-dir cmake-build-unit-tests -j4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we run the tests in this action, we should remove the test execution in the build.yml
file
I think this action should be split into parts. Similar to the documentation action:
Action 2 could be combined with the doc publish action. Additionally action 1 could also be integrated into the release workflow. But probably this should be done in another PR, because the permissions in the release workflow need to be fixed. |
@ThoFrank that change makes sense...we only want to re-publish the coverage results when a commit is done to the main branch. where is the zip file stored and how can contributors access it? @SuhashiniNaik Please also squash your commits to the feature branch. |
0898d89
to
3919dcc
Compare
0dcafad
to
5abf6d1
Compare
52d3e7d
to
0217983
Compare
d50761d
to
cd34715
Compare
Since we don't have debug symbols in the debug build now the code coverage info might be imprecise. This is fixed in #23 along with failing unit test. I suggest merging it first. |
0c9e3f6
to
71d68d9
Compare
edd6f30
to
9489c9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add code-coverage Github action Add code-coverage GitHub action Add code-coverage GitHub action
35da60b
to
d0327d8
Compare
This GitHub Action automates the generation and publishing of code coverage reports of the modules. It captures code coverage data using lcov, filters out third-party, mock files, gtest folders and system libraries.
Then it generates an HTML report that is deployed to GitHub Pages.
Changes made:
Added code-coverage.yml
Added CodeCoverage.cmake
Made changes in CMakeLists.txt