-
Notifications
You must be signed in to change notification settings - Fork 1
278 lines (229 loc) · 10.9 KB
/
test.yml
File metadata and controls
278 lines (229 loc) · 10.9 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# Copyright Agustin K-ballo Berge, Fusion Fenix 2026
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
name: test
on:
push:
branches: [ main, feature/** ]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
timeout-minutes: 6
strategy:
fail-fast: false
matrix:
include:
# ── Linux / GCC 14 ──
- os: ubuntu-24.04
compiler: gcc-14
preset: dev-gcc
# ── Linux / GCC 16 ──
- os: ubuntu-24.04
compiler: gcc-16
preset: dev-gcc
# ── Linux / Clang 18 ──
- os: ubuntu-24.04
compiler: clang-18
preset: dev-clang
# ── Linux / Clang 18 + libc++ ──
- os: ubuntu-24.04
compiler: clang-18+libc++
preset: dev-clang-libcxx
# ── Linux / Clang 22 ──
- os: ubuntu-24.04
compiler: clang-22
preset: dev-clang
# ── Linux / Clang 22 + libc++ ──
- os: ubuntu-24.04
compiler: clang-22+libc++
preset: dev-clang-libcxx
# ── Windows 2022 / MSVC 2022 ──
- os: windows-2022
compiler: msvc-2022
preset: dev-msvc
# ── Windows 2025 / MSVC 2026 ──
- os: windows-2025-vs2026
compiler: msvc-2026
preset: dev-msvc
# ── Windows 2025 / Clang-CL 20 ──
- os: windows-2025-vs2026
compiler: clang-cl-20
preset: dev-clang-cl
steps:
- uses: actions/checkout@v5
- name: Set up MSVC environment
if: startsWith(matrix.compiler, 'msvc') || startsWith(matrix.compiler, 'clang-cl')
shell: pwsh
run: |
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -property installationPath
$vcvars = "$vsPath\VC\Auxiliary\Build\vcvars64.bat"
cmd /c "`"$vcvars`" && set" | ForEach-Object {
if ($_ -match '^([^=]+)=(.*)$') {
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
}
- name: Set up APT package cache
if: runner.os == 'Linux'
run: |
mkdir -p ~/.cache/apt/archives/partial
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
| sudo tee /etc/apt/apt.conf.d/99user-cache
- name: Cache APT packages
if: runner.os == 'Linux'
uses: actions/cache@v5
with:
path: ~/.cache/apt/archives
key: apt-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('.github/workflows/test.yml') }}
restore-keys: apt-${{ matrix.os }}-${{ matrix.compiler }}-
- name: Install GCC 16
if: matrix.compiler == 'gcc-16'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -q
sudo apt-get install -y gcc-16 g++-16
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-16
- name: Install Clang 18
if: startsWith(matrix.compiler, 'clang-18')
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 200
- name: Install libc++-18
if: matrix.compiler == 'clang-18+libc++'
run: |
sudo apt-get install -y libc++-18-dev libc++abi-18-dev
- name: Install Clang 22 + libc++
if: startsWith(matrix.compiler, 'clang-22')
run: |
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 22 all
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
- name: Install Ninja
if: runner.os == 'Linux'
run: sudo apt-get install -y ninja-build
- name: Fix APT cache permissions
if: always() && runner.os == 'Linux'
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
- name: Check CMake Version
run: cmake --version
# -----------------------------------------------------------------------
# Static library build
# -----------------------------------------------------------------------
- name: Configure (static)
run: cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}-static
- name: Build (static, Debug)
run: cmake --build build/${{ matrix.preset }}-static --config Debug
- name: Run example (static, Debug)
continue-on-error: true
shell: bash
run: build/${{ matrix.preset }}-static/example/Debug/eggs_assert_example
- name: Build (static, Release)
run: cmake --build build/${{ matrix.preset }}-static --config Release
# -----------------------------------------------------------------------
# Shared library build
# -----------------------------------------------------------------------
- name: Configure (shared)
run: cmake --preset ${{ matrix.preset }} -B build/${{ matrix.preset }}-shared
-DBUILD_SHARED_LIBS=ON
- name: Build (shared, Debug)
run: cmake --build build/${{ matrix.preset }}-shared --config Debug
- name: Run example (shared, Debug)
continue-on-error: true
shell: bash
run: |
[ "$RUNNER_OS" = "Windows" ] && cp build/${{ matrix.preset }}-shared/Debug/*.dll build/${{ matrix.preset }}-shared/example/Debug/
build/${{ matrix.preset }}-shared/example/Debug/eggs_assert_example
- name: Build (shared, Release)
run: cmake --build build/${{ matrix.preset }}-shared --config Release
# -----------------------------------------------------------------------
# FetchContent variant — simulates embedding via FetchContent_MakeAvailable
# (main only)
# -----------------------------------------------------------------------
- name: Copy Preset (FetchContent)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-fetch_content
cp ./example/main.cpp test/cmake-fetch_content
- name: Test Consumer (FetchContent, static) — Configure
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content
-DEGGS_ASSERT_SOURCE_DIR=${{ github.workspace }}
- name: Test Consumer (FetchContent, static) — Build
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content --config Debug
- name: Test Consumer (FetchContent, static) — Test
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: ctest --test-dir build-consumer-fetch_content --build-config Debug -V
- name: Test Consumer (FetchContent, shared) — Configure
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content-shared
-DEGGS_ASSERT_SOURCE_DIR=${{ github.workspace }}
-DEGGS_ASSERT_BUILD_SHARED_LIBS=ON
- name: Test Consumer (FetchContent, shared) — Build
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content-shared --config Debug
- name: Test Consumer (FetchContent, shared) — Test
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-fetch_content
run: ctest --test-dir build-consumer-fetch_content-shared --build-config Debug -V
# -----------------------------------------------------------------------
# Install variant — simulates a real end-user find_package workflow
# (main only)
# -----------------------------------------------------------------------
- name: Test Install (static)
if: github.ref == 'refs/heads/main'
run: cmake --install build/${{ matrix.preset }}-static
--prefix ${{ runner.temp }}/eggs-assert-install-static
--config Debug
- name: Test Install (shared)
if: github.ref == 'refs/heads/main'
run: cmake --install build/${{ matrix.preset }}-shared
--prefix ${{ runner.temp }}/eggs-assert-install-shared
--config Debug
- name: Clean Source and Build Tree
if: github.ref == 'refs/heads/main'
run: cmake -E rm -rf ./include ./src ./build
- name: Copy Preset (find_package)
if: github.ref == 'refs/heads/main'
run: |
cp ./CMakePresets.json test/cmake-find_package
cp ./example/main.cpp test/cmake-find_package
- name: Test Consumer (find_package, static) — Configure
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, static) — Build
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-static --config Debug
- name: Test Consumer (find_package, static) — Test
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-static --build-config Debug -V
- name: Test Consumer (find_package, shared) — Configure
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, shared) — Build
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-shared --config Debug
- name: Test Consumer (find_package, shared) — Test
if: github.ref == 'refs/heads/main'
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-shared --build-config Debug -V