Skip to content

Commit

Permalink
Add html_standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Dec 12, 2023
1 parent 2ff1fc0 commit 1a8fdb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,11 @@ jobs:
with:
generator: Ninja
configuration: ${{ matrix.configuration }}
cmake-args: '-DCODE_COVERAGE_TYPE=html_standalone'
cmake-target: coverage_report
- name: archive coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage_report/**
path: .build/coverage_report/index.html
retention-days: 30
15 changes: 15 additions & 0 deletions Builds/CMake/RippledCov.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@ if (coverage)
set(TEST_PARALLELISM ${PROCESSOR_COUNT})
endif()

if (DEFINED CODE_COVERAGE_TYPE)
set(CODE_COVERAGE_STYLE ${CODE_COVERAGE_TYPE})
elseif (DEFINED ENV{CODE_COVERAGE_TYPE})
set(CODE_COVERAGE_STYLE $ENV{CODE_COVERAGE_TYPE})
endif()

if (NOT GCOVR_PATH)
message(FATAL_ERROR "Cannot find gcovr, aborting ...")
endif()

set (GCOVR_ADDITIONAL_ARGS --exclude-noncode-lines --exclude-unreachable-branches -j ${PROCESSOR_COUNT} -s)
if ((NOT CODE_COVERAGE_STYLE) OR (CODE_COVERAGE_STYLE STREQUAL "html_detailed"))
list(APPEND GCOVR_ADDITIONAL_ARGS --html --html-details)
elseif (CODE_COVERAGE_STYLE STREQUAL "html_standalone")
list(APPEND GCOVR_ADDITIONAL_ARGS --html --html-self-contained)
elseif (CODE_COVERAGE_STYLE STREQUAL "html_nested")
list(APPEND GCOVR_ADDITIONAL_ARGS --html --html-nested)
elseif ()
message(FATAL_ERROR "Unsupported CODE_COVERAGE_TYPE=${CODE_COVERAGE_STYLE} ! Aborting...")
endif()

setup_target_for_coverage_gcovr_html(
NAME coverage_report
Expand Down

0 comments on commit 1a8fdb8

Please sign in to comment.