-
-
Notifications
You must be signed in to change notification settings - Fork 243
398 lines (340 loc) · 12.1 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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build_autotools:
name: Autotools / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Install Autotools on macOS
if: runner.os == 'macOS'
run: brew upgrade && brew install autoconf automake libtool
- name: Install Autotools on Ubuntu
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04'
run: sudo apt-get install -y autoconf automake libtool
- name: Set SIMD flags
run: |
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
- name: Generate Autotools
run: ./autogen.sh
- name: Configure Autotools
run: ./configure CFLAGS="$CFLAGS"
- name: Build
run: make
- name: Test
run: make check
build_cmake_ios:
name: CMake / iOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake \
-B build \
-GXcode \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO \
-DCGLM_STATIC=ON \
-DCGLM_USE_TEST=ON
- name: Build
run: cmake --build build
build_cmake_ubuntu:
name: CMake / ${{ matrix.target.os }} / ${{ matrix.target.cc }} / ${{ matrix.simd }}
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- { os: ubuntu-20.04, cc: gcc-11 }
- { os: ubuntu-22.04, cc: gcc-12 }
- { os: ubuntu-24.04, cc: gcc-13 }
- { os: ubuntu-20.04, cc: clang-12 }
- { os: ubuntu-22.04, cc: clang-15 }
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Add Ubuntu Toolchain PPA
if: matrix.target.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
- name: Install Compiler and Ninja
run: |
sudo apt-get install -y ${{ matrix.target.cc }} ninja-build
- name: Set SIMD flags
run: |
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
- name: Configure CMake
run: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.target.cc }} -DCMAKE_C_FLAGS="$CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON -DCGLM_USE_C99=OFF -DCGLM_SHARED=OFF
- name: Build
run: cmake --build build
- name: Test
working-directory: build
run: ./tests
build_cmake_macos:
name: CMake / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- name: Install Ninja
if: runner.os == 'macOS'
run: brew upgrade && brew install ninja
- name: Configure CMake
run: |
cmake \
-B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCGLM_STATIC=ON \
-DCGLM_USE_TEST=ON \
-DCGLM_USE_C99=OFF \
-DCGLM_SHARED=OFF
- name: Build
run: cmake --build build
- name: Test
working-directory: build
run: ./tests
build_cmake:
name: CMake / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, windows-2022]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Install Ninja on macOS
if: runner.os == 'macOS'
run: brew upgrade && brew install ninja
- name: Set SIMD flags
shell: ${{ (runner.os == 'Windows' && 'pwsh') || 'bash' }}
run: |
${{ (runner.os == 'Windows' && 'function Set-Flags {
$simd = $env:MATRIX_SIMD
switch ($simd) {
"none" { $env:CFLAGS = "" }
"sse" { $env:CFLAGS = "-arch:SSE" }
"sse2" { $env:CFLAGS = "-arch:SSE2" }
"sse3" { $env:CFLAGS = "-arch:SSE3" }
"sse4" { $env:CFLAGS = "-arch:SSE4" }
"avx" { $env:CFLAGS = "-arch:AVX" }
"avx2" { $env:CFLAGS = "-arch:AVX2" }
"neon" { $env:CFLAGS = "-arch:NEON" }
}
}
$env:MATRIX_SIMD = "' + matrix.simd + '"
Set-Flags') || '
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi' }}
- name: Configure CMake
shell: ${{ (runner.os == 'Windows' && 'pwsh') || 'bash' }}
run: |
${{ (runner.os == 'Windows' && 'cmake -B build -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON -DCGLM_USE_C99=OFF -DCGLM_SHARED=OFF -DCMAKE_C_FLAGS="$env:CFLAGS"') || 'cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON -DCGLM_USE_C99=OFF -DCGLM_SHARED=OFF -DCMAKE_C_FLAGS="$CFLAGS"' }}
- name: Build
run: cmake --build build --config Release
- name: Test
working-directory: build
shell: ${{ (runner.os == 'Windows' && 'pwsh') || 'bash' }}
run: ${{ (runner.os == 'Windows' && '.\Release\tests.exe') || './tests' }}
build_meson:
name: Meson / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-22.04, ubuntu-24.04, windows-2022]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install meson
run: python3 -m pip install meson ninja
- name: Set SIMD flags (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$simd = "${{ matrix.simd }}"
if ($simd -eq "none") {
$env:CFLAGS = ""
} elseif ($simd -eq "sse") {
$env:CFLAGS = "-arch:SSE"
} elseif ($simd -eq "sse2") {
$env:CFLAGS = "-arch:SSE2"
} elseif ($simd -eq "sse3") {
$env:CFLAGS = "-arch:SSE3"
} elseif ($simd -eq "sse4") {
$env:CFLAGS = "-arch:SSE4"
} elseif ($simd -eq "avx") {
$env:CFLAGS = "-arch:AVX"
} elseif ($simd -eq "avx2") {
$env:CFLAGS = "-arch:AVX2"
} elseif ($simd -eq "neon") {
$env:CFLAGS = "-arch:NEON"
}
- name: Set SIMD flags (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
- name: Build with meson (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$env:CFLAGS"
meson test -C build
- name: Build with meson (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$CFLAGS"
meson test -C build
build_msbuild:
name: MSBuild / Windows / ${{ matrix.simd }}
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Retarget solution
run: |
vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$vsInstallPath = vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
& "$vsInstallPath\Common7\IDE\devenv.com" cglm.sln /Upgrade
- name: Set SIMD flags
run: |
if ($Env:SIMD -eq 'none') {
$Env:CFLAGS=""
} elseif ($Env:SIMD -eq 'sse') {
$Env:CFLAGS="-arch:SSE"
} elseif ($Env:SIMD -eq 'sse2') {
$Env:CFLAGS="-arch:SSE2"
} elseif ($Env:SIMD -eq 'sse3') {
$Env:CFLAGS="-arch:SSE3"
} elseif ($Env:SIMD -eq 'sse4') {
$Env:CFLAGS="-arch:SSE4"
} elseif ($Env:SIMD -eq 'avx') {
$Env:CFLAGS="-arch:AVX"
} elseif ($Env:SIMD -eq 'avx2') {
$Env:CFLAGS="-arch:AVX2"
} elseif ($Env:SIMD -eq 'neon') {
$Env:CFLAGS="-arch:NEON"
}
- name: Build (x86)
working-directory: win
run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
- name: Build (x64)
working-directory: win
run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
build_documentation:
name: Documentation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Dependencies
working-directory: docs
run: python3 -m pip install -r requirements.txt
- name: Build
working-directory: docs
run: sphinx-build -W --keep-going source build
build_swift:
name: Swift ${{ matrix.swift }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, ubuntu-22.04]
# This has no test yet.
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build