Skip to content
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

Merged
merged 4 commits into from
May 6, 2021

Conversation

Irallia
Copy link
Contributor

@Irallia Irallia commented Nov 16, 2020

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

.travis.yml Outdated Show resolved Hide resolved
@Irallia Irallia force-pushed the TEST/add_codecov_test branch 2 times, most recently from e4c868b to d85c316 Compare November 19, 2020 14:58
@eseiler
Copy link
Member

eseiler commented Nov 20, 2020

You can also try to run cmake and make locally. The only thing that won't happen when you build locally is the upload to codecov :)

@Irallia Irallia force-pushed the TEST/add_codecov_test branch 2 times, most recently from 8564338 to 5be818b Compare November 28, 2020 16:00
@Irallia Irallia force-pushed the TEST/add_codecov_test branch 3 times, most recently from 93f8b50 to 4c040f0 Compare April 30, 2021 10:13
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@d54a41d). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d54a41d...93aa8ad. Read the comment docs.

Copy link
Member

@eseiler eseiler left a 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).

@eseiler eseiler requested a review from marehr April 30, 2021 10:34
@eseiler eseiler marked this pull request as ready for review April 30, 2021 10:43
Co-authored-by: Lydia Buntrock <[email protected]>
Co-authored-by: David Heller <[email protected]>
@Irallia Irallia force-pushed the TEST/add_codecov_test branch from 4c040f0 to b62ca48 Compare April 30, 2021 10:52
.github/workflows/ci.yml Outdated Show resolved Hide resolved
Signed-off-by: Lydia Buntrock <[email protected]>
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@Irallia
Copy link
Contributor Author

Irallia commented Apr 30, 2021

We still have the warning in Submit coverage build

->  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

@Irallia Irallia force-pushed the TEST/add_codecov_test branch from 93aa8ad to 669783c Compare April 30, 2021 13:59
@eseiler
Copy link
Member

eseiler commented Apr 30, 2021

We still have the warning in Submit coverage build

->  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

Just revert it, please don't use a depth of 0 because it will pull the complete history.
When this PR is done, I can pull the changes from seqan3 which will also resolve this issue

@Irallia Irallia force-pushed the TEST/add_codecov_test branch 2 times, most recently from c534d80 to 44714ce Compare April 30, 2021 14:06
@Irallia
Copy link
Contributor Author

Irallia commented Apr 30, 2021

We still have the warning in Submit coverage build

->  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

Just revert it, please don't use a depth of 0 because it will pull the complete history.
When this PR is done, I can pull the changes from seqan3 which will also resolve this issue

Okay

Copy link
Member

@marehr marehr left a 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add_library(coverage_config INTERFACE)
add_library (coverage_config INTERFACE)

We put spaces between name and (

CMakeLists.txt Outdated
Comment on lines 38 to 39
-O0 # no optimization
-g # generate debug info
Copy link
Member

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 ()

Comment on lines 11 to 12
# Include code-coverage settings:
target_link_libraries("${PROJECT_NAME}" PUBLIC coverage_config)
Copy link
Member

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

Suggested change
# 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 ()

Comment on lines 237 to 239
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 }}"
Copy link
Member

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 }} ?

Copy link
Member

@eseiler eseiler Apr 30, 2021

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

Comment on lines +270 to +272
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
Copy link
Member

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

Copy link
Member

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]>
@Irallia Irallia force-pushed the TEST/add_codecov_test branch from de611b2 to b861b8e Compare May 3, 2021 10:02
@Irallia Irallia requested a review from marehr May 3, 2021 10:14
@Irallia
Copy link
Contributor Author

Irallia commented May 3, 2021

If you're okay with the changes, you can just sqash merge.

@marehr marehr merged commit 484b661 into seqan:master May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide coverage tests to check if all paths of the program are tested
4 participants