-
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (87 loc) · 2.87 KB
/
ci.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
102
103
104
105
106
107
108
109
110
111
name: ci
on:
pull_request:
release:
types: [published]
push:
tags: '*'
branches:
- main
- develop
env:
VERBOSE: 1
jobs:
build-and-test:
name: ${{matrix.name}} (${{matrix.cmake_build_type}})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name:
- Linux GCC
- Linux Clang
- Linux Emscripten
- MacOS Clang
- MacOS GCC
- Windows MSVC
cmake_build_type:
- Debug
- Release
include:
- compiler: clang++
- cmake-launcher: ''
- name: 'Linux GCC'
compiler: g++
os: ubuntu-latest
- name: 'Linux Clang'
os: ubuntu-latest
- name: 'MacOS Clang'
os: macOS-latest
- name: 'MacOS GCC'
os: macOS-latest
compiler: g++-14
- name: 'Windows MSVC'
compiler: cl
os: windows-latest
- name: 'Linux Emscripten'
compiler: ''
os: ubuntu-latest
cmake-launcher: emcmake
env:
compiler: ${{ matrix.compiler && format('-DCMAKE_CXX_COMPILER={0}', matrix.compiler) || '' }}
steps:
- name: Install cppcheck
run: ${{ runner.os == 'Windows' && 'choco install cppcheck -y' || runner.os == 'macOS' && 'brew install cppcheck' || runner.os == 'Linux' && 'sudo apt-get install cppcheck' }}
- name: Check for clang/clang-tidy version mismatches
if: ${{ matrix.compiler == 'clang++' }}
run: |
# Don't bother unless clang-tidy is available.
if ! clang-tidy --version > /dev/null 2>&1; then
exit 0
fi
clang_version=$(clang --version | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
clang_tidy_version=$(clang-tidy --version | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
if [ "$clang_version" != "$clang_tidy_version" ]; then
echo "clang version $clang_version doesn't match clang-tidy version $clang_tidy_version"
exit 1
fi
- name: Set up Emscripten
uses: mymindstorm/setup-emsdk@v14
if: ${{ contains(matrix.name, 'Emscripten') }}
- name: Set up MSVC (Windows)
uses: compnerd/gha-setup-vsdevenv@main
- name: Set up latest CMake and Ninja
uses: lukka/get-cmake@latest
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Configure
run: |
${{ matrix.cmake-launcher }} cmake -Wno-dev -S . -B ./build -GNinja ${{env.compiler}} -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=ON
- name: Build
run: |
cmake --build ./build
- name: Test
run: |
ctest --output-on-failure --timeout 20 --test-dir ./build