-
Notifications
You must be signed in to change notification settings - Fork 1
317 lines (282 loc) · 10.4 KB
/
Copy pathci.yml
File metadata and controls
317 lines (282 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
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
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 Igal Alkon
# SPDX-FileCopyrightText: Copyright (c) 2026 ALKONTEK <git@alkontek.com>
# SPDX-License-Identifier: BSD-3-Clause
name: Vecmat CI Workflow
on:
push:
branches:
- master
- 'v*.x'
tags: ['v*']
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') }}
permissions:
contents: read
jobs:
build:
name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.precision }}${{ matrix.toolchain == 'msvc' && '-msvc' || '' }}
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: linux
arch: x86_64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: true
runner: ubuntu-24.04
shell: bash
msystem: ''
msys_packages: ''
- os: linux
arch: x86_64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: true
runner: ubuntu-24.04
shell: bash
msystem: ''
msys_packages: ''
# Linux aarch64 (native hosted ARM runner)
- os: linux
arch: aarch64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: false
runner: ubuntu-24.04-arm
shell: bash
msystem: ''
msys_packages: ''
- os: linux
arch: aarch64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: false
runner: ubuntu-24.04-arm
shell: bash
msystem: ''
msys_packages: ''
# Windows x86_64 (MinGW: current CMake uses GCC flags and -lm)
- os: windows
arch: x86_64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: false
runner: windows-latest
shell: 'msys2 {0}'
msystem: MINGW64
msys_packages: mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja zip
- os: windows
arch: x86_64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: false
runner: windows-latest
shell: 'msys2 {0}'
msystem: MINGW64
msys_packages: mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja zip
# Windows aarch64
- os: windows
arch: aarch64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: false
runner: windows-11-arm
shell: 'msys2 {0}'
msystem: CLANGARM64
msys_packages: mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-ninja zip
- os: windows
arch: aarch64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: false
runner: windows-11-arm
shell: 'msys2 {0}'
msystem: CLANGARM64
msys_packages: mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-ninja zip
# Windows x86_64 MSVC (cl from the image; windows-latest is VS 2026).
- os: windows
arch: x86_64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: false
runner: windows-latest
shell: pwsh
toolchain: msvc
msystem: ''
msys_packages: ''
- os: windows
arch: x86_64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: false
runner: windows-latest
shell: pwsh
toolchain: msvc
msystem: ''
msys_packages: ''
# Windows aarch64 MSVC (cl on windows-11-arm). Distinct from ClangARM64.
- os: windows
arch: aarch64
precision: f32
f64: 'OFF'
run_tests: true
run_benchmarks: false
runner: windows-11-arm
shell: pwsh
toolchain: msvc
msystem: ''
msys_packages: ''
- os: windows
arch: aarch64
precision: f64
f64: 'ON'
run_tests: true
run_benchmarks: false
runner: windows-11-arm
shell: pwsh
toolchain: msvc
msystem: ''
msys_packages: ''
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSYS2
if: matrix.os == 'windows' && matrix.toolchain != 'msvc'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: ${{ matrix.msys_packages }}
- name: Install Linux packages
if: matrix.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build cmake build-essential
# One line so the same step is valid in bash and pwsh (no bash "\").
- name: Configure
if: matrix.toolchain != 'msvc'
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DVECMAT_USE_F64=${{ matrix.f64 }} -DVECMAT_BUILD_TESTS=${{ matrix.run_tests }} -DVECMAT_INSTALL=ON -DVECMAT_RUNTIME_DISPATCH=ON
# Self-contained: vswhere (shipped with VS) picks the CMake generator for
# whatever Visual Studio the image has (2022 or 2026). No extra actions.
- name: Configure (MSVC)
if: matrix.toolchain == 'msvc'
run: |
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
if (-not (Test-Path $vswhere)) { throw "vswhere.exe not found" }
$year = (& $vswhere -latest -products * -property catalog_productLineVersion | Select-Object -First 1).Trim()
$gen = switch ($year) {
{ $_ -in @('17', '2022') } { 'Visual Studio 17 2022' }
{ $_ -in @('18', '2026') } { 'Visual Studio 18 2026' }
default { throw "No CMake generator mapped for Visual Studio '$year'" }
}
$arch = if ('${{ matrix.arch }}' -eq 'aarch64') { 'ARM64' } else { 'x64' }
Write-Host "CMake generator: $gen -A $arch"
cmake -S . -B build -G $gen -A $arch -DVECMAT_USE_F64=${{ matrix.f64 }} -DVECMAT_BUILD_TESTS=${{ matrix.run_tests }} -DVECMAT_INSTALL=ON -DVECMAT_RUNTIME_DISPATCH=ON
- name: Build shared and static
if: matrix.toolchain != 'msvc'
run: cmake --build build --parallel --target vecmat_shared vecmat_static
- name: Build shared and static (MSVC)
if: matrix.toolchain == 'msvc'
run: cmake --build build --config Release --parallel --target vecmat_shared vecmat_static
- name: Build tests and benchmarks
if: matrix.run_tests && matrix.toolchain != 'msvc'
run: cmake --build build --parallel --target vecmat_tests vecmat_benchmarks
- name: Build tests and benchmarks (MSVC)
if: matrix.run_tests && matrix.toolchain == 'msvc'
run: cmake --build build --config Release --parallel --target vecmat_tests vecmat_benchmarks
- name: Run tests
if: matrix.run_tests && matrix.toolchain != 'msvc'
run: ./build/test/vecmat_tests
- name: Run tests (MSVC)
if: matrix.run_tests && matrix.toolchain == 'msvc'
run: ./build/test/Release/vecmat_tests.exe
- name: Run benchmarks
if: matrix.run_benchmarks && matrix.toolchain != 'msvc'
run: ./build/test/vecmat_benchmarks
- name: Run benchmarks (MSVC)
if: matrix.run_benchmarks && matrix.toolchain == 'msvc'
run: ./build/test/Release/vecmat_benchmarks.exe
# Version-line branches (v0.2.x, v0.3.x, …) build and test only.
# Install trees and GitHub Releases are produced from v* tags.
- name: Package install tree
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
set -euo pipefail
PRECISION_SUFFIX=""
if [ "${{ matrix.precision }}" != "f32" ]; then
PRECISION_SUFFIX="-${{ matrix.precision }}"
fi
TOOLCHAIN_SUFFIX=""
if [ "${{ matrix.toolchain }}" = "msvc" ]; then
TOOLCHAIN_SUFFIX="-msvc"
fi
NAME="vecmat-${GITHUB_REF_NAME}-${{ matrix.os }}-${{ matrix.arch }}${PRECISION_SUFFIX}${TOOLCHAIN_SUFFIX}"
cmake --install build --prefix "${NAME}" --config Release
cp LICENSE README.md SPECIAL "${NAME}/"
mkdir -p dist
if [ "${{ matrix.os }}" = "windows" ]; then
if command -v zip >/dev/null 2>&1; then
zip -r "dist/${NAME}.zip" "${NAME}"
else
tar.exe -a -cf "dist/${NAME}.zip" "${NAME}"
fi
else
tar -czf "dist/${NAME}.tar.gz" "${NAME}"
fi
ls -la dist
- name: Upload release artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v6
with:
name: vecmat-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.precision == 'f32' && '' || format('-{0}', matrix.precision) }}${{ matrix.toolchain == 'msvc' && '-msvc' || '' }}
path: |
dist/*.tar.gz
dist/*.zip
if-no-files-found: error
release:
name: Release ${{ github.ref_name }}
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Download packed libraries
uses: actions/download-artifact@v7
with:
path: release-files
merge-multiple: true
- name: List files
run: find release-files -type f -print
- name: Publish GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
release-files/*.tar.gz
release-files/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}