-
Notifications
You must be signed in to change notification settings - Fork 1
253 lines (204 loc) · 10.4 KB
/
Copy pathtest.yml
File metadata and controls
253 lines (204 loc) · 10.4 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
# 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 }}
strategy:
fail-fast: false
matrix:
include:
# ── Linux / GCC 14 ──
- os: ubuntu-24.04
compiler: gcc-14
preset: dev-gcc
# ── Linux / Clang 18 ──
- os: ubuntu-24.04
compiler: clang-18+libc++
preset: dev-clang-libcxx
# ── macOS 15 / AppleClang 16 ──
- os: macos-15
compiler: apple-clang-16
preset: dev-clang
# ── Windows 2022 / MSVC ──
- os: windows-2022
compiler: msvc
preset: dev-msvc
steps:
- uses: actions/checkout@v5
- name: Set up MSVC environment
if: matrix.compiler == 'msvc'
shell: pwsh
run: |
$vcvars = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\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: Install libc++
if: matrix.compiler == 'clang-18+libc++'
run: sudo apt-get install -y libc++-18-dev libc++abi-18-dev
- name: Install Ninja
if: runner.os == 'Linux'
run: sudo apt-get install -y ninja-build
- 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
- name: Package (static)
working-directory: build/${{ matrix.preset }}-static
run: cpack -C Release
- name: Upload package (static)
uses: actions/upload-artifact@v6
with:
name: package-${{ matrix.compiler }}-static
path: |
build/${{ matrix.preset }}-static/Eggs.Assert-*.tar.gz
build/${{ matrix.preset }}-static/Eggs.Assert-*.zip
if-no-files-found: error
retention-days: 7
# -----------------------------------------------------------------------
# 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
- name: Package (shared)
working-directory: build/${{ matrix.preset }}-shared
run: cpack -C Release
- name: Upload package (shared)
uses: actions/upload-artifact@v6
with:
name: package-${{ matrix.compiler }}-shared
path: |
build/${{ matrix.preset }}-shared/Eggs.Assert-*.tar.gz
build/${{ matrix.preset }}-shared/Eggs.Assert-*.zip
if-no-files-found: error
retention-days: 7
# -----------------------------------------------------------------------
# FetchContent variant — simulates embedding via FetchContent_MakeAvailable
# -----------------------------------------------------------------------
- name: Copy Preset (FetchContent)
run: |
cp ./CMakePresets.json test/cmake-fetch_content
cp ./example/main.cpp test/cmake-fetch_content
- name: Test Consumer (FetchContent, static) — Configure
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
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content --config Debug
- name: Test Consumer (FetchContent, static) — Test
working-directory: test/cmake-fetch_content
run: ctest --test-dir build-consumer-fetch_content --build-config Debug -V
- name: Test Consumer (FetchContent, shared) — Configure
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
working-directory: test/cmake-fetch_content
run: cmake --build build-consumer-fetch_content-shared --config Debug
- name: Test Consumer (FetchContent, shared) — Test
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
# -----------------------------------------------------------------------
- name: Test Install (static, Debug)
run: cmake --install build/${{ matrix.preset }}-static
--prefix ${{ runner.temp }}/eggs-assert-install-static-debug
--config Debug
- name: Test Install (static, Release)
run: cmake --install build/${{ matrix.preset }}-static
--prefix ${{ runner.temp }}/eggs-assert-install-static-release
--config Release
- name: Test Install (shared, Debug)
run: cmake --install build/${{ matrix.preset }}-shared
--prefix ${{ runner.temp }}/eggs-assert-install-shared-debug
--config Debug
- name: Test Install (shared, Release)
run: cmake --install build/${{ matrix.preset }}-shared
--prefix ${{ runner.temp }}/eggs-assert-install-shared-release
--config Release
- name: Clean Source and Build Tree
run: cmake -E rm -rf ./include ./src ./build
- name: Copy Preset (find_package)
run: |
cp ./CMakePresets.json test/cmake-find_package
cp ./example/main.cpp test/cmake-find_package
- name: Test Consumer (find_package, static, Debug) — Configure
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static-debug
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static-debug
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, static, Debug) — Build
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-static-debug --config Debug
- name: Test Consumer (find_package, static, Debug) — Test
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-static-debug --build-config Debug -V
- name: Test Consumer (find_package, static, Release) — Configure
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-static-release
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-static-release
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, static, Release) — Build
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-static-release --config Release
- name: Test Consumer (find_package, static, Release) — Test
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-static-release --build-config Release -V
- name: Test Consumer (find_package, shared, Debug) — Configure
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared-debug
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared-debug
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, shared, Debug) — Build
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-shared-debug --config Debug
- name: Test Consumer (find_package, shared, Debug) — Test
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-shared-debug --build-config Debug -V
- name: Test Consumer (find_package, shared, Release) — Configure
working-directory: test/cmake-find_package
run: cmake --preset ${{ matrix.preset }} -B build-consumer-find_package-shared-release
-DCMAKE_PREFIX_PATH=${{ runner.temp }}/eggs-assert-install-shared-release
--debug-find-pkg=Eggs.Assert
- name: Test Consumer (find_package, shared, Release) — Build
working-directory: test/cmake-find_package
run: cmake --build build-consumer-find_package-shared-release --config Release
- name: Test Consumer (find_package, shared, Release) — Test
working-directory: test/cmake-find_package
run: ctest --test-dir build-consumer-find_package-shared-release --build-config Release -V