@@ -12,21 +12,22 @@ jobs:
1212 CTEST_OUTPUT_ON_FAILURE : ON
1313 CTEST_PARALLEL_LEVEL : 1
1414 CMAKE_BUILD_TYPE : ${{ matrix.build_type }}
15- VERBOSE : 1 # to show all cmake scripts debug info
15+ VERBOSE : 1 # to show all cmake scripts debug info
1616
1717 strategy :
1818 fail-fast : false
1919 matrix :
2020 # Github Actions requires a single row to be added to the build matrix.
2121 # See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
22- name : [
23- ubuntu-22.04-gcc,
24- ubuntu-22.04-clang,
25- ubuntu-24.04-gcc,
26- ubuntu-24.04-clang,
27- ]
28-
29- build_type : [ Release ]
22+ name :
23+ [
24+ ubuntu-22.04-gcc,
25+ ubuntu-22.04-clang,
26+ ubuntu-24.04-gcc,
27+ ubuntu-24.04-clang,
28+ ]
29+
30+ build_type : [Release]
3031 include :
3132 - name : ubuntu-22.04-gcc
3233 os : ubuntu-22.04
4445 os : ubuntu-24.04
4546 compiler : gcc
4647
48+ - name : ubuntu-24.04-coverage
49+ os : ubuntu-24.04
50+ compiler : gcc
51+ build_type : Coverage
52+
4753 steps :
4854 - name : Checkout
4955 uses : actions/checkout@master
7985 - name : Build
8086 run : |
8187 make -C build
82-
88+
8389 - name : Run tests
8490 run : |
8591 ctest --verbose --test-dir build
92+
93+ - name : Install lcov
94+ if : matrix.build_type == 'Coverage'
95+ run : sudo apt-get -y install lcov
96+
97+ - name : Generate coverage report
98+ if : matrix.build_type == 'Coverage'
99+ run : |
100+ # 1. Capture coverage data from the build directory
101+ # lcov finds all the .gcno and .gcda files
102+ lcov --capture --directory build/ --output-file coverage.info
103+
104+ # 2. Filter to *only* include the main header file
105+ # This fulfills your request to not include examples/tests
106+ lcov --extract coverage.info "*/include/nanoflann.hpp" --output-file coverage_filtered.info
107+
108+ # 3. Print a summary to the console log for easy debugging
109+ echo "--- Coverage Summary for nanoflann.hpp ---"
110+ lcov --list coverage_filtered.info
111+ echo "------------------------------------------"
112+
113+ - name : Upload coverage to Codecov
114+ if : matrix.build_type == 'Coverage'
115+ uses : codecov/codecov-action@v4
116+ with :
117+ # The token is required for private repos, but recommended for all
118+ token : ${{ secrets.CODECOV_TOKEN }}
119+ # Path to the filtered report
120+ files : ./coverage_filtered.info
121+ # Optional name for this upload in the Codecov UI
122+ name : codecov-ubuntu-24.04
0 commit comments