-
Notifications
You must be signed in to change notification settings - Fork 9
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
[TEST] Adds the codecoverage test #32
Conversation
e4c868b
to
d85c316
Compare
You can also try to run |
8564338
to
5be818b
Compare
93f8b50
to
4c040f0
Compare
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
==========================================
Coverage ? 100.00%
==========================================
Files ? 1
Lines ? 19
Branches ? 0
==========================================
Hits ? 19
Misses ? 0
Partials ? 0 Continue to review full report at Codecov.
|
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.
Cool!
At some point, we probably want to use seqan3's cmake stuff, but it does not seem that trivial, because we do the api/cli stuff differently.
I'll ask Marcel to have a glance at this and then we can merge this.
I would then maybe adapt the CI to better reflect our current seqan3 CI and clean up the workflow file (maybe even split it like in seqan3).
Co-authored-by: Lydia Buntrock <[email protected]> Co-authored-by: David Heller <[email protected]>
4c040f0
to
b62ca48
Compare
Signed-off-by: Lydia Buntrock <[email protected]>
We still have the warning in -> Issue detecting commit SHA. Please run actions/checkout with fetch-depth > 1 or set to 0 I try the solution of codecov/codecov-action#190 |
93aa8ad
to
669783c
Compare
Just revert it, please don't use a depth of |
c534d80
to
44714ce
Compare
Okay |
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.
A couple of small things. Great work, thank you!
CMakeLists.txt
Outdated
# Code Coverage Configuration | ||
add_library(coverage_config INTERFACE) | ||
|
||
option(CODE_COVERAGE "Enable coverage reporting" OFF) |
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.
option(CODE_COVERAGE "Enable coverage reporting" OFF) | |
option(SEQAN_APP_CODE_COVERAGE "Enable coverage reporting" OFF) |
This should have a proper unique name
CMakeLists.txt
Outdated
|
||
option(CODE_COVERAGE "Enable coverage reporting" OFF) | ||
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
message (STATUS "Hallo CMAKE_CXX_COMPILER_ID") |
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.
message (STATUS "Hallo CMAKE_CXX_COMPILER_ID") | |
message (STATUS "Hallo CMAKE_CXX_COMPILER_ID") |
?
CMakeLists.txt
Outdated
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
message (STATUS "Hallo CMAKE_CXX_COMPILER_ID") | ||
# Add required flags (GCC & LLVM/Clang) | ||
target_compile_options(coverage_config INTERFACE |
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.
target_compile_options(coverage_config INTERFACE | |
target_compile_options(seqan_app_coverage_config INTERFACE |
this needs some prefix
CMakeLists.txt
Outdated
else() | ||
target_link_libraries(coverage_config INTERFACE --coverage) | ||
endif() | ||
endif(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") |
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.
endif(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") | |
endif() |
CMakeLists.txt
Outdated
@@ -27,6 +27,25 @@ set (FontReset "${Esc}[m") | |||
# Dependency: SeqAn3. | |||
find_package (SeqAn3 QUIET REQUIRED HINTS lib/seqan3/build_system) | |||
|
|||
# Code Coverage Configuration | |||
add_library(coverage_config INTERFACE) |
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.
add_library(coverage_config INTERFACE) | |
add_library (coverage_config INTERFACE) |
We put spaces between name
and (
CMakeLists.txt
Outdated
-O0 # no optimization | ||
-g # generate debug 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.
These are not guaranteed to overwrite the build type.
I would just warn that CMAKE_BUILD_TYPE
isn't set to debug and remove the above lines
Something like
if (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "DEBUG")
message (WARNING "Please use build type debug, e.g. cmake -DCMAKE_BUILD_TYPE=DEBUG ...")
endif ()
src/CMakeLists.txt
Outdated
# Include code-coverage settings: | ||
target_link_libraries("${PROJECT_NAME}" PUBLIC coverage_config) |
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.
I would make this optional more clear
# Include code-coverage settings: | |
target_link_libraries("${PROJECT_NAME}" PUBLIC coverage_config) | |
# Include code-coverage settings if requested: | |
if (CODE_COVERAGE) | |
target_link_libraries ("${PROJECT_NAME}" PUBLIC coverage_config) | |
endif () |
.github/workflows/ci.yml
Outdated
cmake ../app -DCODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" | ||
else | ||
cmake ../app -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" |
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.
@eseiler The only difference is -DCODE_COVERAGE=ON
, can't we just add a ${{ matrix.additional_cmake_flags }}
?
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.
-DCODE_COVERAGE=${{ matrix.build_type == 'Coverage' && 'ON' || 'OFF' }}
should work (maybe setting it as env variable for this step is cleaner).
I would do this in my follow-up PR, because I probably change something anyways
lcov --directory ./app-build/ --capture --output-file ./app-build/app_coverage --gcov-tool gcov-10 | ||
lcov --remove ./app-build/app_coverage '/usr/*' '${{ github.workspace }}/app/lib/*' '${{ github.workspace }}/app-build/vendor/*' --output-file ./app-build/app_coverage | ||
lcov --list ./app-build/app_coverage |
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.
seqan3 we integrated that into cmake in "test/coverage", but I guess it is fine for now to just have this in CI
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, but it doesn't seem trivial to reuse it. As far as I can see it relies on a certain way the tests are configured...
Signed-off-by: Lydia Buntrock <[email protected]>
de611b2
to
b861b8e
Compare
If you're okay with the changes, you can just sqash merge. |
Resolves #30
Using the example https://github.com/codecov, we created a codecoverage for the app-template.
The documentation can be found here https://docs.codecov.io/docs/about-the-codecov-bash-uploader