Skip to content

Add GitHub action for code-coverage #6

Add GitHub action for code-coverage

Add GitHub action for code-coverage #6

Workflow file for this run

name: Code Coverage Report
on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-coverage:
uses: ./.github/workflows/build-coverage.yml
create-coverage:
runs-on: ubuntu-latest
needs: build-coverage
steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'
- name: Configure CMake
run: cmake -B cmake-build-posix -S executables/referenceApp -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build cmake-build-posix --target app.referenceApp -j --config ${{env.BUILD_TYPE}}
- name: Test
# Execute tests defined by the CMake configuration.
run: |
cmake -B cmake-build-unit-tests -S executables/unitTest -DBUILD_UNIT_TESTS=ON
cmake --build cmake-build-unit-tests -j4
ctest --test-dir cmake-build-unit-tests -j4
coverage:
runs-on: ubuntu-latest
needs: build

Check failure on line 37 in .github/workflows/code-coverage.yml

View workflow run for this annotation

GitHub Actions / Code Coverage Report

Invalid workflow file

The workflow is not valid. .github/workflows/code-coverage.yml (Line: 37, Col: 12): Job 'coverage' depends on unknown job 'build'.
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