diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 293d474e7..837ec793b 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -38,7 +38,7 @@ jobs: run: | mkdir build && cd build # run tests and populate lcov.info file - cmake -S ../ -DBUILD_TESTS=ON && make + cmake -S ../ -DBUILD_TESTS=ON -DBUILD_COV=ON && make - name: Generate HTML Analysis & Unit Test Coverage run: | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f2557ea22..a7fc3cfe8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -150,15 +150,18 @@ message(STATUS "Detecting lcov") # Find lcov find_program(LCOV lcov) +option(BUILD_COV "Generate coverage reports" OFF) if(LCOV) + if(BUILD_COV) add_custom_command(TARGET RUN_CPP_TESTS POST_BUILD COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "[==========]" COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan --bold "[Generating Coverage Reports]" - COMMAND lcov --directory .. --capture --output-file lcov.info --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch,mismatch + COMMAND lcov --directory .. --capture --output-file lcov.info --rc geninfo_unexecuted_blocks=1 #--ignore-errors mismatch,mismatch COMMAND lcov --remove lcov.info "*c++*" "*/googletest/*" "*/gtest*" "/usr/*" "/src" "/build" -o lcov.info --ignore-errors unused COMMAND mv lcov.info ../../.coverage ) + endif() else() message(STATUS "lcov not found. Coverage reports will not be generated") endif()