@@ -2,13 +2,14 @@ name: CMake
22
33on :
44 push :
5- branches : [ master ]
65 pull_request :
76 branches : [ master ]
87
98env :
109 # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11- BUILD_TYPE : Release
10+ BUILD_TYPE : Debug
11+ GENERATE_COVERAGE : true
12+ LCOV_ROOT : ${{github.workspace}}/lcov
1213
1314jobs :
1415 build :
@@ -22,17 +23,37 @@ jobs:
2223 - uses : actions/checkout@v2
2324 with :
2425 submodules : recursive
25-
26+
27+ - name : Install lcov
28+ run : |
29+ mkdir -p "$LCOV_ROOT"
30+ wget https://github.com/linux-test-project/lcov/releases/download/v1.15/lcov-1.15.tar.gz --output-document="$LCOV_ROOT/lcov.tar.gz"
31+ tar -xf "$LCOV_ROOT/lcov.tar.gz" --strip-components=1 -C "$LCOV_ROOT"
32+ echo "$LCOV_ROOT/bin" >> $GITHUB_PATH
33+ shell : bash
34+
2635 - name : Configure CMake
2736 # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
2837 # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
29- run : cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
38+ run : cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILDER_ENABLE_PROFILING=true
3039
3140 - name : Build
3241 # Build your program with the given configuration
3342 run : cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
3443
3544 - name : Run Unit Tests
3645 working-directory : ${{github.workspace}}/build
37- run : ./test/unit-tests/unit-tests
38-
46+ run : ctest --verbose
47+
48+ - name : Generate code coverage report
49+ working-directory : ${{github.workspace}}/build
50+ run : |
51+ lcov --directory . --capture --output-file coverage.info
52+ lcov --remove coverage.info '/usr/*' "${{github.workspace}}/test/*" "${{github.workspace}}/external/*" --output-file coverage.info
53+ lcov --list coverage.info
54+
55+ - uses : coverallsapp/github-action@9ba913c152ae4be1327bfb9085dc806cedb44057
56+ name : Upload code coverage report to Coveralls
57+ with :
58+ path-to-lcov : ${{github.workspace}}/build/coverage.info
59+ github-token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments