-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (175 loc) · 6 KB
/
Copy pathci.yml
File metadata and controls
198 lines (175 loc) · 6 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
on:
push:
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: clang-format
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends clang-format-18
- name: Check formatting
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
if [[ "$BASE_SHA" =~ ^0+$ ]] || ! git cat-file -e "$BASE_SHA^{commit}"; then
BASE_SHA=$(git rev-parse HEAD^)
fi
git clang-format-18 --binary clang-format-18 --diff \
"$BASE_SHA" HEAD --extensions hpp,cpp -- include tests examples bench
ci:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
VCPKG_DISABLE_METRICS: 1
strategy:
fail-fast: false
matrix:
include:
- name: GCC 13
version: 13
preset: gcc_debug_tests
cc: gcc-13
cxx: g++-13
standard: c++23
stdlib: ""
triplet: x64-linux
debug_flags: -g
libcxx: false
libcxx_version: 0
- name: GCC 14
version: 14
preset: gcc_debug_tests
cc: gcc-14
cxx: g++-14
standard: c++23
stdlib: ""
triplet: x64-linux
debug_flags: -g
libcxx: false
libcxx_version: 0
- name: Clang 16
version: 16
preset: clang_debug_tests
cc: clang-16
cxx: clang++-16
standard: c++2b
stdlib: -stdlib=libc++
triplet: x64-linux-libcxx
debug_flags: -g -stdlib=libc++
libcxx: true
libcxx_version: 18
- name: Clang 18
version: 18
preset: clang_debug_tests
cc: clang-18
cxx: clang++-18
standard: c++23
stdlib: -stdlib=libc++
triplet: x64-linux-libcxx
debug_flags: -g -stdlib=libc++
libcxx: true
libcxx_version: 18
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install libc++
if: matrix.libcxx
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends \
"libc++-${{ matrix.libcxx_version }}-dev" \
"libc++abi-${{ matrix.libcxx_version }}-dev"
- name: Configure and build
run: |
export VCPKG_ROOT="$VCPKG_INSTALLATION_ROOT"
cmake --preset ${{ matrix.preset }} \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_CXX_FLAGS_DEBUG="${{ matrix.debug_flags }}" \
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}
cmake --build build/${{ matrix.preset }} --parallel 2
- name: Check installed public headers
run: |
install_prefix="$PWD/build/header-install"
cmake --install build/${{ matrix.preset }} --prefix "$install_prefix"
dependency_includes="$PWD/build/${{ matrix.preset }}/vcpkg_installed/${{ matrix.triplet }}/include"
while IFS= read -r header; do
include_name=${header#"$install_prefix/include/"}
printf '#include <%s>\n' "$include_name" |
"$CXX" -std=${{ matrix.standard }} ${{ matrix.stdlib }} \
-I"$install_prefix/include" -I"$dependency_includes" \
-Wall -Wextra -Wpedantic -Werror \
-x c++ -fsyntax-only -
done < <(find "$install_prefix/include" -type f -name '*.hpp' | sort)
- name: Run unit tests
run: >-
ctest --test-dir build/${{ matrix.preset }}
--output-on-failure --parallel 2
- name: Test installed CMake package
if: matrix.name == 'GCC 14'
run: |
cmake --install build/${{ matrix.preset }} --prefix "$PWD/build/install"
cmake -S tests/consumer -B build/consumer \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_PREFIX_PATH="$PWD/build/install"
cmake --build build/consumer --parallel 2
./build/consumer/websocketclient_consumer
sanitizers:
name: GCC 14 ASan + UBSan
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
CC: gcc-14
CXX: g++-14
VCPKG_DISABLE_METRICS: 1
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure and build
run: |
export VCPKG_ROOT="$VCPKG_INSTALLATION_ROOT"
cmake --preset gcc_debug_tests_san \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_CXX_FLAGS_DEBUG=-g \
-DVCPKG_TARGET_TRIPLET=x64-linux
cmake --build build/gcc_debug_tests_san --parallel 2
- name: Run unit tests
run: >-
ctest --test-dir build/gcc_debug_tests_san
--output-on-failure --parallel 2
no-exceptions:
name: GCC 14 -fno-exceptions
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Compile public API without exceptions
run: >-
g++-14 -std=c++23 -fno-exceptions -Iinclude
-Wall -Wextra -Wpedantic -Werror
-fsyntax-only tests/compile/no_exceptions.cpp