-
Notifications
You must be signed in to change notification settings - Fork 20
58 lines (47 loc) · 2.2 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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-13 g++-13 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-13
CXX: g++-13
- 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 --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,mismatch --output-filename coverage.info
genhtml coverage.info --output-directory out
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ${{github.workspace}}/build/out/index.html