-
Notifications
You must be signed in to change notification settings - Fork 2
522 lines (458 loc) · 17 KB
/
cli-release-check.yml
File metadata and controls
522 lines (458 loc) · 17 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
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
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
name: CLI Release Check
on:
push:
branches:
- main
- master
- dev
- release/**
paths:
- ".github/workflows/cli-release-check.yml"
- ".github/workflows/cli-ci.yml"
- "CMakeLists.txt"
- "include/**"
- "src/**"
- "cmake/**"
- "scripts/**"
- "vix.json"
- "README.md"
- "CHANGELOG.md"
pull_request:
branches:
- main
- master
- dev
- release/**
paths:
- ".github/workflows/cli-release-check.yml"
- ".github/workflows/cli-ci.yml"
- "CMakeLists.txt"
- "include/**"
- "src/**"
- "cmake/**"
- "scripts/**"
- "vix.json"
- "README.md"
- "CHANGELOG.md"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: cli-release-check-${{ github.ref }}
cancel-in-progress: true
env:
BUILD_JOBS: 2
VIX_GIT_BRANCH: dev
jobs:
cross-platform:
name: ${{ matrix.vixos }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
vixos: linux
arch: x86_64
- os: ubuntu-24.04-arm
vixos: linux
arch: aarch64
- os: macos-15-intel
vixos: macos
arch: x86_64
- os: macos-14
vixos: macos
arch: aarch64
- os: windows-2022
vixos: windows
arch: x86_64
steps:
- name: Checkout CLI repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup CMake
uses: lukka/get-cmake@latest
- name: Install deps (Linux x86_64)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libssl-dev \
zlib1g-dev \
libsqlite3-dev \
libspdlog-dev \
libfmt-dev
- name: Install deps (Linux aarch64)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
g++ \
pkg-config \
git \
curl \
ca-certificates \
libasio-dev \
nlohmann-json3-dev \
libssl-dev \
zlib1g-dev \
libsqlite3-dev \
libspdlog-dev \
libfmt-dev
- name: Install deps (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -euxo pipefail
brew update
brew install cmake ninja pkg-config openssl@3 spdlog fmt nlohmann-json
- name: Setup vcpkg (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg $env:GITHUB_WORKSPACE\vcpkg
"VCPKG_ROOT=$env:GITHUB_WORKSPACE\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Append
cd $env:GITHUB_WORKSPACE\vcpkg
.\bootstrap-vcpkg.bat
- name: Install deps (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd $env:GITHUB_WORKSPACE
& "$env:VCPKG_ROOT\vcpkg.exe" install `
asio `
nlohmann-json `
openssl `
sqlite3 `
spdlog `
fmt `
--triplet x64-windows
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Fetch sibling modules (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
rm -rf \
../error \
../path \
../fs \
../io \
../env \
../os \
../process \
../utils \
../json \
../async \
../core \
../reply \
../template \
../net \
../crypto \
../sync \
../cache \
../p2p \
../agent \
../websocket \
../db
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/error.git ../error
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/path.git ../path
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/fs.git ../fs
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/io.git ../io
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/env.git ../env
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/os.git ../os
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/process.git ../process
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/utils.git ../utils
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/json.git ../json
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" --recurse-submodules https://github.com/vixcpp/async.git ../async
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/core.git ../core
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/reply.git ../reply || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/template.git ../template || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/net.git ../net
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/crypto.git ../crypto
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/sync.git ../sync || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/cache.git ../cache || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/p2p.git ../p2p || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/agent.git ../agent || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/websocket.git ../websocket || true
git clone --depth 1 --branch "${VIX_GIT_BRANCH}" https://github.com/vixcpp/db.git ../db || true
- name: Fetch sibling modules (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$modules = @(
"error",
"path",
"fs",
"io",
"env",
"os",
"process",
"utils",
"json",
"async",
"core",
"reply",
"template",
"net",
"crypto",
"sync",
"cache",
"p2p",
"agent",
"websocket",
"db"
)
foreach ($m in $modules) {
$target = Join-Path ".." $m
if (Test-Path $target) {
Remove-Item -Recurse -Force $target
}
}
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/error.git ..\error
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/path.git ..\path
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/fs.git ..\fs
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/io.git ..\io
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/env.git ..\env
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/os.git ..\os
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/process.git ..\process
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/utils.git ..\utils
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/json.git ..\json
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" --recurse-submodules https://github.com/vixcpp/async.git ..\async
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/core.git ..\core
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/reply.git ..\reply
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/template.git ..\template
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/net.git ..\net
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/crypto.git ..\crypto
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/sync.git ..\sync
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/cache.git ..\cache
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/p2p.git ..\p2p
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/agent.git ..\agent
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/websocket.git ..\websocket
git clone --depth 1 --branch "$env:VIX_GIT_BRANCH" https://github.com/vixcpp/db.git ..\db
- name: Prepare Asio for modules (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$asioSource = ""
$vcpkgAsio = Join-Path $env:VCPKG_ROOT "installed\x64-windows\include\asio.hpp"
if (Test-Path $vcpkgAsio) {
$asioSource = Join-Path $env:VCPKG_ROOT "installed\x64-windows\include"
} else {
git clone --depth 1 --branch asio-1-30-2 https://github.com/chriskohlhoff/asio.git "$env:TEMP\asio"
$asioSource = "$env:TEMP\asio\asio\include"
}
if (!(Test-Path (Join-Path $asioSource "asio.hpp"))) {
Write-Host "asio.hpp not found in $asioSource"
exit 1
}
$modules = @(
"..\async",
"..\p2p",
"..\websocket"
)
foreach ($module in $modules) {
if (Test-Path $module) {
$target = Join-Path $module "third_party\asio\include"
if (Test-Path $target) {
Remove-Item -Recurse -Force $target
}
New-Item -ItemType Directory -Force -Path $target | Out-Null
Copy-Item -Recurse -Force "$asioSource\*" $target
if (!(Test-Path (Join-Path $target "asio.hpp"))) {
Write-Host "asio.hpp was not copied into $target"
exit 1
}
}
}
- name: Prepare Asio for modules (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
ASIO_SOURCE=""
if [ -f /usr/include/asio.hpp ]; then
ASIO_SOURCE="/usr/include"
elif [ -f /opt/homebrew/include/asio.hpp ]; then
ASIO_SOURCE="/opt/homebrew/include"
elif [ -f /usr/local/include/asio.hpp ]; then
ASIO_SOURCE="/usr/local/include"
else
git clone --depth 1 --branch asio-1-30-2 https://github.com/chriskohlhoff/asio.git /tmp/asio
ASIO_SOURCE="/tmp/asio/asio/include"
fi
test -f "$ASIO_SOURCE/asio.hpp"
for module in ../async ../p2p ../websocket; do
if [ -d "$module" ]; then
mkdir -p "$module/third_party/asio"
rm -rf "$module/third_party/asio/include"
mkdir -p "$module/third_party/asio/include"
cp -R "$ASIO_SOURCE/"* "$module/third_party/asio/include/"
test -f "$module/third_party/asio/include/asio.hpp"
fi
done
- name: Verify sibling layout (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
test -f ../error/CMakeLists.txt
test -f ../path/CMakeLists.txt
test -f ../fs/CMakeLists.txt
test -f ../io/CMakeLists.txt
test -f ../env/CMakeLists.txt
test -f ../os/CMakeLists.txt
test -f ../process/CMakeLists.txt
test -f ../utils/CMakeLists.txt
test -f ../json/CMakeLists.txt
test -f ../async/CMakeLists.txt
test -f ../core/CMakeLists.txt
test -f ../net/CMakeLists.txt
test -f ../crypto/CMakeLists.txt
- name: Verify sibling layout (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$required = @(
"..\error\CMakeLists.txt",
"..\path\CMakeLists.txt",
"..\fs\CMakeLists.txt",
"..\io\CMakeLists.txt",
"..\env\CMakeLists.txt",
"..\os\CMakeLists.txt",
"..\process\CMakeLists.txt",
"..\utils\CMakeLists.txt",
"..\json\CMakeLists.txt",
"..\async\CMakeLists.txt",
"..\core\CMakeLists.txt",
"..\net\CMakeLists.txt",
"..\crypto\CMakeLists.txt"
)
foreach ($file in $required) {
if (!(Test-Path $file)) {
Write-Host "Missing required file: $file"
exit 1
}
}
- name: Configure CLI (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
CMAKE_ARGS=(
-S . -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DVIX_ENABLE_LTO=OFF
-DVIX_DB_USE_MYSQL=OFF
-DVIX_CORE_WITH_MYSQL=OFF
-DVIX_ENABLE_HTTP_COMPRESSION=OFF
)
if [ "${{ runner.os }}" = "macOS" ]; then
BREW_PREFIX="$(brew --prefix)"
BREW_SSL="$(brew --prefix openssl@3 2>/dev/null || true)"
CMAKE_ARGS+=(-DCMAKE_PREFIX_PATH="$BREW_PREFIX")
if [ -n "$BREW_SSL" ] && [ -d "$BREW_SSL" ]; then
CMAKE_ARGS+=(-DOPENSSL_ROOT_DIR="$BREW_SSL")
fi
fi
cmake "${CMAKE_ARGS[@]}"
- name: Configure CLI (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cmake -S . -B build -A x64 `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
-DVIX_ENABLE_LTO=OFF `
-DVIX_DB_USE_MYSQL=OFF `
-DVIX_CORE_WITH_MYSQL=OFF `
-DVIX_ENABLE_HTTP_COMPRESSION=OFF `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake"
- name: Build CLI
shell: bash
if: runner.os != 'Windows'
run: |
set -euxo pipefail
cmake --build build -j"${BUILD_JOBS}"
- name: Build CLI (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cmake --build build --config Release --parallel 2
- name: Smoke test CLI (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euxo pipefail
BIN=""
for p in "build/vix" "build/bin/vix" "build/Release/vix"; do
if [ -f "$p" ]; then
BIN="$p"
break
fi
done
if [ -z "$BIN" ]; then
echo "vix binary not found"
find build -maxdepth 6 -type f -name vix -print || true
exit 1
fi
"$BIN" --version || "$BIN" version || true
"$BIN" --help >/tmp/vix-help.txt
head -n 40 /tmp/vix-help.txt
- name: Smoke test CLI (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$candidates = @(
"build\vix.exe",
"build\Release\vix.exe",
"build\bin\vix.exe",
"build\Release\bin\vix.exe"
)
$bin = $null
foreach ($p in $candidates) {
if (Test-Path $p) {
$bin = $p
break
}
}
if (!$bin) {
Write-Host "vix.exe not found"
Get-ChildItem -Recurse build | Select-Object FullName
exit 1
}
& $bin --version
& $bin --help | Select-Object -First 40
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: cli-release-check-${{ matrix.vixos }}-${{ matrix.arch }}
path: |
build/CMakeCache.txt
build/CMakeFiles/CMakeError.log
build/CMakeFiles/CMakeOutput.log
build/CMakeFiles/CMakeConfigureLog.yaml
if-no-files-found: warn