Add Github action for Code-coverage #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Coverage Report | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
#Code coverage | |
- name: Install lcov | |
run: sudo apt install lcov | |
- name: Capture code coverage | |
run: | | |
echo "Capturing code coverage..." | |
lcov --capture --directory . \ | |
--output-file cmake-build-unit-tests/coverage_unfiltered.info | |
- name: Filter out 3rd party and mock files | |
run: | | |
echo "Filtering out 3rd party and mock files from coverage data..." | |
lcov --remove cmake-build-unit-tests/coverage_unfiltered.info \ | |
'*libs/3rdparty/googletest/*' \ | |
'*/mock/*' \ | |
'*/gmock/*' \ | |
--output-file cmake-build-unit-tests/coverage.info | |
- name: Generate HTML coverage report | |
run: | | |
echo "Generating HTML coverage report..." | |
genhtml cmake-build-unit-tests/coverage.info \ | |
--output-directory cmake-build-unit-tests/coverage | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: cmake-build-unit-tests/coverage | |
force_orphan: true |