-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 2.09 KB
/
Copy pathrun_cpp_tests.yml
File metadata and controls
90 lines (77 loc) · 2.09 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: C++ tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v7
- name: Cache Catch2 build
id: catch2-cache
uses: actions/cache@v6
with:
path: |
~/.local/catch2
key: ${{ runner.os }}-catch2
- name: Build Catch2
if: steps.catch2-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/catchorg/Catch2.git
cd Catch2
git checkout "v3.13.0"
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/.local/catch2 \
-DBUILD_TESTING=Off
cmake --build . \
--config Release --
cmake --install .
- name: Configure CMake Prefix
run: echo "$HOME/.local/catch2/lib/cmake/Catch2" >> $GITHUB_PATH
- name: Configure for release tests
if: runner.os == 'macOS'
run: |
cmake -S. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_MEX=False \
-DBUILD_TESTS=True
- name: Configure for coverage tests
if: runner.os == 'Linux'
run: |
cmake -S. -Bbuild \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_MEX=False \
-DBUILD_TESTS=True
- name: Build
run: |
cmake --build build -j$(nproc)
- name: Run tests
working-directory: ./build
run: |
ctest --output-on-failure --verbose
- name: Install lcov
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y lcov
- name: Generate coverage report
if: runner.os == 'Linux'
run: |
lcov --capture \
--directory . \
--output-file coverage.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v7
if: runner.os == 'Linux'
with:
files: coverage.info
disable_search: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}