File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626
2727 - name : Test
2828 run : ctest --test-dir build -C Release --output-on-failure
29+
30+ coverage :
31+ runs-on : ubuntu-latest
32+ steps :
33+ - uses : actions/checkout@v4
34+
35+ - name : Install gcovr
36+ run : pip install gcovr
37+
38+ - name : Configure
39+ run : cmake -S . -B build -DBUILD_TESTING=ON -DENABLE_COVERAGE=ON
40+
41+ - name : Build
42+ run : cmake --build build
43+
44+ - name : Test
45+ run : ctest --test-dir build --output-on-failure
46+
47+ - name : Generate coverage report
48+ run : gcovr --xml coverage.xml --root . --filter 'include/' build/
49+
50+ - name : Upload coverage to Codecov
51+ uses : codecov/codecov-action@v5
52+ with :
53+ token : ${{ secrets.CODECOV_TOKEN }}
54+ files : coverage.xml
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
3636 PRIVATE CppGeometryLibrary GTest::GTest GTest::Main
3737 )
3838 add_test (NAME cpp_geometry_tests COMMAND cpp_geometry_tests )
39+
40+ option (ENABLE_COVERAGE "Enable gcov coverage instrumentation (GCC/Clang only)" OFF )
41+ if (ENABLE_COVERAGE)
42+ target_compile_options (cpp_geometry_tests PRIVATE --coverage )
43+ target_link_options (cpp_geometry_tests PRIVATE --coverage )
44+ endif ()
3945 endif ()
4046
4147 add_executable (cpp_geometry_sample samples/samples.cpp )
Original file line number Diff line number Diff line change 44 <a href="https://github.com/gistrec/cpp-geometry-library/actions/workflows/ci.yml">
55 <img src="https://github.com/gistrec/cpp-geometry-library/actions/workflows/ci.yml/badge.svg" alt="CI">
66 </a>
7+ <a href="https://codecov.io/gh/gistrec/cpp-geometry-library">
8+ <img src="https://codecov.io/gh/gistrec/cpp-geometry-library/graph/badge.svg" alt="Coverage">
9+ </a>
710 <a href="#">
811 <img src="https://img.shields.io/codacy/grade/bcff544711544d5fb7da95b68abf566d" alt="Code quality">
912 </a>
You can’t perform that action at this time.
0 commit comments