@@ -39,10 +39,10 @@ jobs:
3939 run : cmake --build . -j$(nproc)
4040
4141 # -------------------------------------------------
42- # 2. FULL BUILD + TEST + SIMPLE DAG RUN + DOCS (RelWithDebInfo + Eigen)
42+ # 2. FULL BUILD + TEST + SIMPLE DAG RUN + COVERAGE + DOCS (RelWithDebInfo + Eigen)
4343 # -------------------------------------------------
4444 test_and_run :
45- name : Build & Test (RelWithDebInfo + Eigen)
45+ name : Build, Test & Coverage (RelWithDebInfo + Eigen)
4646 runs-on : ubuntu-latest
4747 needs : build_matrix
4848 if : github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
@@ -55,21 +55,42 @@ jobs:
5555 sudo apt-get update
5656 sudo apt-get install -y --no-install-recommends \
5757 make gcc g++ git libboost-all-dev \
58- doxygen graphviz python3-pip libeigen3-dev
58+ doxygen graphviz python3-pip libeigen3-dev lcov
5959 pip3 install --upgrade pip
6060 pip3 install cmake==3.21.3
6161
6262 - name : Configure
63- run : cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTS=ON
63+ run : cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON
6464
6565 - name : Build all targets
6666 working-directory : ${{ github.workspace }}/build
6767 run : cmake --build . -j$(nproc)
6868
69- - name : Run tests
69+ - name : Run tests with coverage
7070 working-directory : ${{ github.workspace }}/build
71- run : ctest --output-on-failure --output-junit test_results.xml
72- continue-on-error : true
71+ run : |
72+ # Run tests
73+ ctest --output-on-failure --output-junit test_results.xml
74+
75+ # Capture coverage ONLY from include/
76+ lcov --capture --directory . \
77+ --output-file coverage.info \
78+ --ignore-errors empty,mismatch \
79+ --include '*/OneStopParallel/include/*'
80+
81+ # Remove unused warnings + ignore tests/apps
82+ lcov --remove coverage.info '*/tests/*' '*/apps/*' \
83+ --ignore-errors unused,empty,mismatch \
84+ --output-file coverage.info
85+
86+ # Generate HTML report
87+ genhtml coverage.info --output-directory coverage_html
88+
89+ - name : Upload coverage artifacts
90+ uses : actions/upload-artifact@v4
91+ with :
92+ name : coverage-report
93+ path : build/coverage_html
7394
7495 - name : Upload test results
7596 uses : actions/upload-artifact@v4
0 commit comments