File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : C/C++ Coverage
2+
3+ on :
4+ push :
5+ branches : [ main, v* ]
6+ pull_request :
7+ branches : [ main, v* ]
8+
9+ jobs :
10+ build-and-test :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v3
15+
16+ - name : Install dependencies
17+ run : sudo apt-get update && sudo apt-get install -y lcov gcc cmake make
18+
19+ - name : Configure CMake (with coverage flags)
20+ run : |
21+ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage"
22+
23+ - name : Build
24+ run : cmake --build build
25+
26+ - name : Run tests
27+ run : |
28+ cd build && ctest --output-on-failure
29+
30+ - name : Generate coverage report
31+ run : |
32+ lcov --capture --directory build --output-file coverage.info
33+ lcov --remove coverage.info '*/Unity/*' '*/cJSON/*' --output-file coverage.info
34+ lcov --list coverage.info
35+
36+ - name : Upload coverage artifact
37+ uses : actions/upload-artifact@v4
38+ with :
39+ name : coverage-report
40+ path : coverage.info
You can’t perform that action at this time.
0 commit comments