-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (52 loc) · 1.39 KB
/
run-tests.yaml
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
62
on:
push:
branches:
- master
pull_request:
name: Run unit tests
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC, coverage enabled",
os: ubuntu-latest,
cov: true
}
- {
name: "macOS Latest Clang",
os: macos-latest,
cov: false
}
steps:
- uses: actions/checkout@v4
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Configure the build
if: ${{ ! matrix.config.cov }}
run: cmake -S . -B build
- name: Configure the build with coverage
if: ${{ matrix.config.cov }}
run: cmake -S . -B build -DCODE_COVERAGE=ON
- name: Run the build
run: cmake --build build
- name: Run the tests
run: |
cd build
ctest
- name: Generate code coverage
if: ${{ matrix.config.cov }}
run: |
cd build/tests/CMakeFiles/libtest.dir/src/
gcov -abcfu *.gcno
- name: Upload to Codecov
if: ${{ matrix.config.cov }}
uses: codecov/codecov-action@v4
with:
directory: build/tests/CMakeFiles/libtest.dir/src/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}