Skip to content

Merge pull request #78 from benvenutti/feature/rename-hack-commmand-p… #152

Merge pull request #78 from benvenutti/feature/rename-hack-commmand-p…

Merge pull request #78 from benvenutti/feature/rename-hack-commmand-p… #152

Workflow file for this run

name: coverage
on: [push]
jobs:
coverage:
runs-on: ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -o Acquire::Retries=3 lcov
- name: Create build directory
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE \
-DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DCODE_COVERAGE=ON
- name: Build
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config Debug --verbose
- name: Gather baseline coverage
working-directory: ${{runner.workspace}}/build
run: lcov --directory . --capture --initial --output-file baseline.info
- name: Test
working-directory: ${{runner.workspace}}/build
run: ctest --build-config Debug --extra-verbose .
- name: Gather test coverage
working-directory: ${{runner.workspace}}/build
run: lcov --directory . --capture --output-file test.info
- name: Generate coverage report
working-directory: ${{runner.workspace}}/build
run: |
# combine baseline and test coverage data:
lcov -a baseline.info -a test.info --output-file coverage.info
# filter paths from report:
lcov --remove coverage.info '/usr/include/*' --output-file coverage.info
lcov --remove coverage.info '*/catch2-src/*' --output-file coverage.info
lcov --remove coverage.info '*/cli11_proj-src/*' --output-file coverage.info
# generate the HTML files:
genhtml --demangle-cpp -o coverage coverage.info
- name: Upload results to Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{runner.workspace}}/build/coverage.info
github-token: ${{ secrets.GITHUB_TOKEN }}