-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (48 loc) · 2.08 KB
/
cmake.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
59
60
61
name: CMake
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Debug, Release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y lcov valgrind
- name: Configure CMake (Debug)
if: matrix.build_type == 'Debug'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
- name: Configure CMake
if: matrix.build_type == 'Release'
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test with coverage and memory sanitizer
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure -T Test -T Coverage -T MemCheck
- name: Upload coverage reports to Codecov
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Test without coverage and memory sanitizer
if: matrix.build_type == 'Release' || matrix.os != 'ubuntu-latest'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure -T Test
- name: Make coverage report
if: matrix.build_type == 'Debug' && matrix.os == 'ubuntu-latest'
run: |
lcov --capture --directory ${{github.workspace}}/build --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info