-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (87 loc) · 3.23 KB
/
Build-and-test.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
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
91
92
93
94
95
96
97
98
99
100
101
name: Build & Test
on: [push, pull_request]
jobs:
job:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Windows latest (MSVC)"
os: windows-latest
cxx: 'cl'
cmake_flags: ''
- name: "Windows latest (MinGW)"
os: windows-latest
cxx: 'g++'
cmake_flags: ''
- name: "Ubuntu latest (gcc)"
os: ubuntu-latest
cxx: 'g++'
cmake_flags: '-- -k -j4'
- name: "Ubuntu latest (clang)"
os: ubuntu-latest
cxx: 'clang++14'
cmake_flags: '-- -k -j4'
- name: "macOS latest (clang)"
os: macos-latest
cxx: 'clang++'
cmake_flags: '-- -k -j4'
steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v1
with:
submodules: true
- name: Install lcov (brew)
if: "contains(matrix.config.os, 'macos')"
run: brew install lcov
shell: bash
- name: Install lcov (apt)
if: "contains(matrix.config.os, 'ubuntu')"
run: sudo apt-get install lcov
shell: bash
- name: Configure & Build
uses: lukka/run-cmake@v3
with:
cmakeBuildType: 'Release'
cmakeGenerator: 'UnixMakefiles'
cmakeListsOrSettingsJson: 'CMakeListsTxtAdvanced'
cmakeAppendedArgs: >-
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
-DCODE_COVERAGE=ON
-DCACHE_BUILD_TESTS=ON
-DCACHE_BUILD_EXAMPLES=ON
buildWithCMakeArgs: '--config Release ${{ matrix.config.cmake_flags }}'
buildDirectory: '${{ runner.workspace }}/build/'
- name: Run tests
working-directory: ${{ runner.workspace }}/build
run: ctest -V -C Release
shell: bash
- name: Create coverage report (LLVM)
if: "!contains(matrix.config.os, 'windows') && contains(matrix.config.cxx, 'clang++-14')"
working-directory: ${{ runner.workspace }}/build
run: |
echo "#!/bin/bash" > llvm-gcov.sh
echo "exec llvm-cov-14 gcov \"\$@\"" >> llvm-gcov.sh
chmod +x llvm-gcov.sh
lcov --directory . --capture --gcov-tool "${{ runner.workspace }}/build/llvm-gcov.sh" --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/deps/*' --output-file coverage.info
shell: bash
- name: Create coverage report (GCC)
if: "!contains(matrix.config.os, 'windows') && !contains(matrix.config.cxx, 'clang++-14')"
working-directory: ${{ runner.workspace }}/build
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/deps/*' --output-file coverage.info
shell: bash
- name: Upload coverage to Codecov
if: "!contains(matrix.config.os, 'windows')"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ runner.workspace }}/build/coverage.info
flags: unittests
name: ${{ matrix.config.name }}
fail_ci_if_error: false
verbose: false