Skip to content

Commit fc78c59

Browse files
committed
[ci] Reconfigure build matrix
1 parent 476e06e commit fc78c59

2 files changed

Lines changed: 137 additions & 86 deletions

File tree

.github/workflows/test.yml

Lines changed: 124 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,113 @@ jobs:
2525
compiler: gcc-14
2626
preset: dev-gcc
2727

28+
# ── Linux / GCC 16 ──
29+
- os: ubuntu-24.04
30+
compiler: gcc-16
31+
preset: dev-gcc
32+
2833
# ── Linux / Clang 18 ──
34+
- os: ubuntu-24.04
35+
compiler: clang-18
36+
preset: dev-clang
37+
38+
# ── Linux / Clang 18 + libc++ ──
2939
- os: ubuntu-24.04
3040
compiler: clang-18+libc++
3141
preset: dev-clang-libcxx
3242

33-
# ── macOS 15 / AppleClang 16 ──
34-
- os: macos-15
35-
compiler: apple-clang-16
43+
# ── Linux / Clang 22 ──
44+
- os: ubuntu-24.04
45+
compiler: clang-22
3646
preset: dev-clang
3747

38-
# ── Windows 2022 / MSVC ──
48+
# ── Linux / Clang 22 + libc++ ──
49+
- os: ubuntu-24.04
50+
compiler: clang-22+libc++
51+
preset: dev-clang-libcxx
52+
53+
# ── Windows 2022 / MSVC 2022 ──
3954
- os: windows-2022
40-
compiler: msvc
55+
compiler: msvc-2022
4156
preset: dev-msvc
4257

58+
# ── Windows 2025 / MSVC 2026 ──
59+
- os: windows-2025-vs2026
60+
compiler: msvc-2026
61+
preset: dev-msvc
62+
63+
# ── Windows 2025 / Clang-CL 20 ──
64+
- os: windows-2025-vs2026
65+
compiler: clang-cl-20
66+
preset: dev-clang-cl
67+
4368
steps:
4469
- uses: actions/checkout@v5
4570

4671
- name: Set up MSVC environment
47-
if: matrix.compiler == 'msvc'
72+
if: startsWith(matrix.compiler, 'msvc') || startsWith(matrix.compiler, 'clang-cl')
4873
shell: pwsh
4974
run: |
50-
$vcvars = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
75+
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
76+
-latest -property installationPath
77+
$vcvars = "$vsPath\VC\Auxiliary\Build\vcvars64.bat"
5178
cmd /c "`"$vcvars`" && set" | ForEach-Object {
5279
if ($_ -match '^([^=]+)=(.*)$') {
5380
"$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
5481
}
5582
}
5683
57-
- name: Install libc++
84+
- name: Set up APT package cache
85+
if: runner.os == 'Linux'
86+
run: |
87+
mkdir -p ~/.cache/apt/archives/partial
88+
echo "Dir::Cache::archives \"$HOME/.cache/apt/archives\";" \
89+
| sudo tee /etc/apt/apt.conf.d/99user-cache
90+
91+
- name: Cache APT packages
92+
if: runner.os == 'Linux'
93+
uses: actions/cache@v5
94+
with:
95+
path: ~/.cache/apt/archives
96+
key: apt-${{ matrix.os }}-${{ matrix.compiler }}-${{ hashFiles('.github/workflows/test.yml') }}
97+
restore-keys: apt-${{ matrix.os }}-${{ matrix.compiler }}-
98+
99+
- name: Install GCC 16
100+
if: matrix.compiler == 'gcc-16'
101+
run: |
102+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
103+
sudo apt-get update -q
104+
sudo apt-get install -y gcc-16 g++-16
105+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-16 100 \
106+
--slave /usr/bin/g++ g++ /usr/bin/g++-16
107+
108+
- name: Install Clang 18
109+
if: startsWith(matrix.compiler, 'clang-18')
110+
run: |
111+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 200
112+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 200
113+
114+
- name: Install libc++-18
58115
if: matrix.compiler == 'clang-18+libc++'
59-
run: sudo apt-get install -y libc++-18-dev libc++abi-18-dev
116+
run: |
117+
sudo apt-get install -y libc++-18-dev libc++abi-18-dev
118+
119+
- name: Install Clang 22 + libc++
120+
if: startsWith(matrix.compiler, 'clang-22')
121+
run: |
122+
wget -q https://apt.llvm.org/llvm.sh
123+
sudo bash llvm.sh 22 all
124+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-22 200
125+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-22 200
60126
61127
- name: Install Ninja
62128
if: runner.os == 'Linux'
63129
run: sudo apt-get install -y ninja-build
64130

131+
- name: Fix APT cache permissions
132+
if: always() && runner.os == 'Linux'
133+
run: sudo rm -rf ~/.cache/apt/archives/lock ~/.cache/apt/archives/partial
134+
65135
- name: Check CMake Version
66136
run: cmake --version
67137

@@ -104,154 +174,122 @@ jobs:
104174

105175
# -----------------------------------------------------------------------
106176
# FetchContent variant — simulates embedding via FetchContent_MakeAvailable
177+
# (main only)
107178
# -----------------------------------------------------------------------
108179
- name: Copy Preset (FetchContent)
180+
if: github.ref == 'refs/heads/main'
109181
run: |
110182
cp ./CMakePresets.json test/cmake-fetch_content
111183
cp ./example/main.cpp test/cmake-fetch_content
112184
113185
- name: Test Consumer (FetchContent, static) — Configure
186+
if: github.ref == 'refs/heads/main'
114187
working-directory: test/cmake-fetch_content
115188
run: cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content
116189
-DEGGS_ASSERT_SOURCE_DIR=${{ github.workspace }}
117190

118191
- name: Test Consumer (FetchContent, static) — Build
192+
if: github.ref == 'refs/heads/main'
119193
working-directory: test/cmake-fetch_content
120194
run: cmake --build build-consumer-fetch_content --config Debug
121195

122196
- name: Test Consumer (FetchContent, static) — Test
197+
if: github.ref == 'refs/heads/main'
123198
working-directory: test/cmake-fetch_content
124199
run: ctest --test-dir build-consumer-fetch_content --build-config Debug -V
125200

126201
- name: Test Consumer (FetchContent, shared) — Configure
202+
if: github.ref == 'refs/heads/main'
127203
working-directory: test/cmake-fetch_content
128204
run: cmake --preset ${{ matrix.preset }} -B build-consumer-fetch_content-shared
129205
-DEGGS_ASSERT_SOURCE_DIR=${{ github.workspace }}
130206
-DEGGS_ASSERT_BUILD_SHARED_LIBS=ON
131207

132208
- name: Test Consumer (FetchContent, shared) — Build
209+
if: github.ref == 'refs/heads/main'
133210
working-directory: test/cmake-fetch_content
134211
run: cmake --build build-consumer-fetch_content-shared --config Debug
135212

136213
- name: Test Consumer (FetchContent, shared) — Test
214+
if: github.ref == 'refs/heads/main'
137215
working-directory: test/cmake-fetch_content
138216
run: ctest --test-dir build-consumer-fetch_content-shared --build-config Debug -V
139217

140218
# -----------------------------------------------------------------------
141219
# Install variant — simulates a real end-user find_package workflow
220+
# (main only)
142221
# -----------------------------------------------------------------------
143-
- name: Test Install (static, Debug)
222+
- name: Test Install (static)
223+
if: github.ref == 'refs/heads/main'
144224
run: cmake --install build/${{ matrix.preset }}-static
145-
--prefix ${{ runner.temp }}/eggs-assert-install-static-debug
225+
--prefix ${{ runner.temp }}/eggs-assert-install-static
146226
--config Debug
147227

148-
- name: Upload installed package (static, Debug)
228+
- name: Upload installed package (static)
229+
if: github.ref == 'refs/heads/main'
149230
uses: actions/upload-artifact@v6
150231
with:
151-
name: installed-package-${{ matrix.compiler }}-static-debug
152-
path: ${{ runner.temp }}/eggs-assert-install-static-debug
232+
name: installed-package-${{ matrix.compiler }}-static
233+
path: ${{ runner.temp }}/eggs-assert-install-static
153234
if-no-files-found: error
154235
retention-days: 7
155236

156-
- name: Test Install (static, Release)
157-
run: cmake --install build/${{ matrix.preset }}-static
158-
--prefix ${{ runner.temp }}/eggs-assert-install-static-release
159-
--config Release
160-
161-
- name: Upload installed package (static, Release)
162-
uses: actions/upload-artifact@v6
163-
with:
164-
name: installed-package-${{ matrix.compiler }}-static-release
165-
path: ${{ runner.temp }}/eggs-assert-install-static-release
166-
if-no-files-found: error
167-
retention-days: 7
168-
169-
- name: Test Install (shared, Debug)
237+
- name: Test Install (shared)
238+
if: github.ref == 'refs/heads/main'
170239
run: cmake --install build/${{ matrix.preset }}-shared
171-
--prefix ${{ runner.temp }}/eggs-assert-install-shared-debug
240+
--prefix ${{ runner.temp }}/eggs-assert-install-shared
172241
--config Debug
173242

174-
- name: Upload installed package (shared, Debug)
175-
uses: actions/upload-artifact@v6
176-
with:
177-
name: installed-package-${{ matrix.compiler }}-shared-debug
178-
path: ${{ runner.temp }}/eggs-assert-install-shared-debug
179-
if-no-files-found: error
180-
retention-days: 7
181-
182-
- name: Test Install (shared, Release)
183-
run: cmake --install build/${{ matrix.preset }}-shared
184-
--prefix ${{ runner.temp }}/eggs-assert-install-shared-release
185-
--config Release
186-
187-
- name: Upload installed package (shared, Release)
243+
- name: Upload installed package (shared)
244+
if: github.ref == 'refs/heads/main'
188245
uses: actions/upload-artifact@v6
189246
with:
190-
name: installed-package-${{ matrix.compiler }}-shared-release
191-
path: ${{ runner.temp }}/eggs-assert-install-shared-release
247+
name: installed-package-${{ matrix.compiler }}-shared
248+
path: ${{ runner.temp }}/eggs-assert-install-shared
192249
if-no-files-found: error
193250
retention-days: 7
194251

195252
- name: Clean Source and Build Tree
253+
if: github.ref == 'refs/heads/main'
196254
run: cmake -E rm -rf ./include ./src ./build
197255

198256
- name: Copy Preset (find_package)
257+
if: github.ref == 'refs/heads/main'
199258
run: |
200259
cp ./CMakePresets.json test/cmake-find_package
201260
cp ./example/main.cpp test/cmake-find_package
202261
203-
- name: Test Consumer (find_package, static, Debug) — Configure
262+
- name: Test Consumer (find_package, static) — Configure
263+
if: github.ref == 'refs/heads/main'
204264
working-directory: test/cmake-find_package
205-
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static-debug
206-
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static-debug
265+
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static
266+
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static
207267
--debug-find-pkg=Eggs.Assert
208268

209-
- name: Test Consumer (find_package, static, Debug) — Build
269+
- name: Test Consumer (find_package, static) — Build
270+
if: github.ref == 'refs/heads/main'
210271
working-directory: test/cmake-find_package
211-
run: cmake --build build-consumer-find_package-static-debug --config Debug
272+
run: cmake --build build-consumer-find_package-static --config Debug
212273

213-
- name: Test Consumer (find_package, static, Debug) — Test
274+
- name: Test Consumer (find_package, static) — Test
275+
if: github.ref == 'refs/heads/main'
214276
working-directory: test/cmake-find_package
215-
run: ctest --test-dir build-consumer-find_package-static-debug --build-config Debug -V
277+
run: ctest --test-dir build-consumer-find_package-static --build-config Debug -V
216278

217-
- name: Test Consumer (find_package, static, Release) — Configure
279+
- name: Test Consumer (find_package, shared) — Configure
280+
if: github.ref == 'refs/heads/main'
218281
working-directory: test/cmake-find_package
219-
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static-release
220-
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static-release
282+
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared
283+
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared
221284
--debug-find-pkg=Eggs.Assert
222285

223-
- name: Test Consumer (find_package, static, Release) — Build
286+
- name: Test Consumer (find_package, shared) — Build
287+
if: github.ref == 'refs/heads/main'
224288
working-directory: test/cmake-find_package
225-
run: cmake --build build-consumer-find_package-static-release --config Release
289+
run: cmake --build build-consumer-find_package-shared --config Debug
226290

227-
- name: Test Consumer (find_package, static, Release) — Test
291+
- name: Test Consumer (find_package, shared) — Test
292+
if: github.ref == 'refs/heads/main'
228293
working-directory: test/cmake-find_package
229-
run: ctest --test-dir build-consumer-find_package-static-release --build-config Release -V
294+
run: ctest --test-dir build-consumer-find_package-shared --build-config Debug -V
230295

231-
- name: Test Consumer (find_package, shared, Debug) — Configure
232-
working-directory: test/cmake-find_package
233-
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared-debug
234-
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared-debug
235-
--debug-find-pkg=Eggs.Assert
236-
237-
- name: Test Consumer (find_package, shared, Debug) — Build
238-
working-directory: test/cmake-find_package
239-
run: cmake --build build-consumer-find_package-shared-debug --config Debug
240-
241-
- name: Test Consumer (find_package, shared, Debug) — Test
242-
working-directory: test/cmake-find_package
243-
run: ctest --test-dir build-consumer-find_package-shared-debug --build-config Debug -V
244-
245-
- name: Test Consumer (find_package, shared, Release) — Configure
246-
working-directory: test/cmake-find_package
247-
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared-release
248-
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared-release
249-
--debug-find-pkg=Eggs.Assert
250-
251-
- name: Test Consumer (find_package, shared, Release) — Build
252-
working-directory: test/cmake-find_package
253-
run: cmake --build build-consumer-find_package-shared-release --config Release
254-
255-
- name: Test Consumer (find_package, shared, Release) — Test
256-
working-directory: test/cmake-find_package
257-
run: ctest --test-dir build-consumer-find_package-shared-release --build-config Release -V

CMakePresets.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@
7474
"CXXFLAGS": "/d1trimfile:\"${sourceDir}\""
7575
}
7676
},
77+
{
78+
"name": "dev-clang-cl",
79+
"displayName": "Clang-CL x64",
80+
"inherits": "base",
81+
"cacheVariables": {
82+
"CMAKE_C_COMPILER": "clang-cl",
83+
"CMAKE_CXX_COMPILER": "clang-cl"
84+
},
85+
"environment": {
86+
"CFLAGS": "/clang:-ffile-prefix-map=${sourceDir}=.",
87+
"CXXFLAGS": "/clang:-ffile-prefix-map=${sourceDir}=."
88+
}
89+
},
7790
{
7891
"name": "asan",
7992
"displayName": "ASan + UBSan / Clang",

0 commit comments

Comments
 (0)