Skip to content

Update coverage.yml

Update coverage.yml #8

Workflow file for this run

name: Coverage
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master and dev branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
if: "!contains(github.event.commits[0].message, '[skip cov]')"
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y gcc-11 g++-11 lcov cmake git
shell: bash
- name: Configure cmake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -D ENABLE_COVERAGE=ON
shell: bash
env:
CC: gcc-11
CXX: g++-11
- name: Build all applications
run: cmake --build ${{github.workspace}}/build
- name: Run tests
run: ctest --test-dir ${{github.workspace}}/build/tests
- name: Coverage
shell: bash
run: |
cd ${{github.workspace}}/build
lcov --no-external --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/include/*' '*/tests/*' --output-file coverage.info
geninfo --rc geninfo_unexecuted_blocks=1 --ignore-errors gcov --output-filename coverage.info .
genhtml coverage.info --output-directory out
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ${{github.workspace}}/build/out/index.html
token: ${{ secrets.CODECOV_TOKEN }}