Repository navigation
521 lines (472 loc) · 24.8 KB
/
Copy pathc.cpp.yml
File metadata and controls
521 lines (472 loc) · 24.8 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
name: VoidOne CI
on:
push:
branches: [main, 'release/*']
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
env:
QT_VERSION: '6.11.2'
QT_ARCH: win64_msvc2022_64
CMAKE_VERSION: '4.4.3'
APP_NAME: VoidOne
BUILD_TYPE: Release
jobs:
build:
name: Windows Build / Test / Package
runs-on: windows-2025
timeout-minutes: 60
permissions:
contents: read
actions: write
steps:
- name: Checkout source
uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 1
persist-credentials: false
# ---------------------------------------------------------------------
# Stage 1: deterministic toolchain
# ---------------------------------------------------------------------
- name: Install Visual Studio 2026 Build Tools
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$installer = Join-Path $env:RUNNER_TEMP 'vs_buildtools.exe'
Invoke-WebRequest -UseBasicParsing -Uri 'https://aka.ms/vs/stable/vs_buildtools.exe' -OutFile $installer
$args = @('--quiet','--wait','--norestart','--nocache','--add','Microsoft.VisualStudio.Workload.VCTools','--includeRecommended')
$p = Start-Process -FilePath $installer -ArgumentList $args -Wait -PassThru
if ($p.ExitCode -notin @(0,3010)) { throw "Visual Studio installation failed: $($p.ExitCode)" }
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
$vsPath = (& $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath).Trim()
if ([string]::IsNullOrWhiteSpace($vsPath)) { throw 'MSVC Build Tools installation was not found.' }
"VOIDONE_VS_PATH=$vsPath" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
- name: Initialize MSVC x64 environment
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$vsDevCmd = Join-Path $env:VOIDONE_VS_PATH 'Common7\Tools\VsDevCmd.bat'
$output = & cmd.exe /d /s /c "`"$vsDevCmd`" -arch=amd64 && set" 2>&1
if ($LASTEXITCODE -ne 0) { throw "VsDevCmd failed: $LASTEXITCODE" }
$persist = @('PATH','INCLUDE','LIB','LIBPATH','VCINSTALLDIR','VCToolsInstallDir','VCToolsVersion','VCToolsRedistDir','WindowsSdkDir','WindowsSDKVersion','UniversalCRTSdkDir','UCRTVersion','VSCMD_ARG_TGT_ARCH')
foreach ($line in $output) {
$text = [string]$line
$i = $text.IndexOf('=')
if ($i -le 0) { continue }
$name = $text.Substring(0,$i)
if ($persist -contains $name) {
"$name=$($text.Substring($i + 1))" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
}
}
$pathLine = $output | Where-Object { $_ -like 'PATH=*' } | Select-Object -First 1
if ($pathLine) { ($pathLine -replace '^PATH=','') | Out-File $env:GITHUB_PATH -Encoding utf8 -Append }
- name: Verify MSVC toolchain
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$cl = (& cl 2>&1) -join "`n"
$cl | Write-Host
if ($cl -notmatch 'Version 19\.51\.') { throw "Expected MSVC 14.51 / compiler 19.51.x, found: $cl" }
if ($env:VSCMD_ARG_TGT_ARCH -ne 'x64') { throw "Expected x64 MSVC environment, found '$env:VSCMD_ARG_TGT_ARCH'." }
if ([string]::IsNullOrWhiteSpace($env:VCToolsInstallDir)) { throw 'VCToolsInstallDir is unavailable.' }
if (-not (Get-Command cl -ErrorAction SilentlyContinue)) { throw 'cl.exe is unavailable; MSVC environment is incomplete.' }
if ([string]::IsNullOrWhiteSpace($env:VCToolsRedistDir)) { throw 'VCToolsRedistDir is unavailable.' }
if (-not (Get-Command dumpbin -ErrorAction SilentlyContinue)) { throw 'dumpbin is unavailable; MSVC environment is incomplete.' }
- name: Install Qt
uses: jurplel/install-qt-action@v4.3.1
with:
version: ${{ env.QT_VERSION }}
target: desktop
arch: ${{ env.QT_ARCH }}
cache: true
setup-python: false
aqtsource: 'git+https://github.com/miurahr/aqtinstall.git'
- name: Install exact CMake
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$version = $env:CMAKE_VERSION
$archive = "cmake-$version-windows-x86_64.zip"
$zip = Join-Path $env:RUNNER_TEMP $archive
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v$version/$archive"
$downloaded = $false
for ($attempt = 1; $attempt -le 5; $attempt++) {
try {
Invoke-WebRequest -UseBasicParsing -Uri $cmakeUrl -OutFile $zip -MaximumRetryCount 2 -RetryIntervalSec 5
if ((Test-Path $zip -PathType Leaf) -and (Get-Item $zip).Length -gt 1000000) {
$downloaded = $true
break
}
throw "Downloaded CMake archive is missing or unexpectedly small."
} catch {
if ($attempt -eq 5) { throw "Failed to download CMake $version after $attempt attempts: $($_.Exception.Message)" }
Write-Warning "CMake download attempt $attempt failed: $($_.Exception.Message). Retrying in 10 seconds."
Remove-Item $zip -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 10
}
}
if (-not $downloaded) { throw "CMake $version download did not complete." }
Expand-Archive -Path $zip -DestinationPath $env:RUNNER_TEMP -Force
$bin = Join-Path $env:RUNNER_TEMP "cmake-$version-windows-x86_64\bin"
if (-not (Test-Path (Join-Path $bin 'cmake.exe'))) { throw 'Pinned CMake installation failed.' }
$bin | Out-File $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Ninja and NSIS
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if (-not (Get-Command ninja -ErrorAction SilentlyContinue)) {
choco install ninja -y --no-progress
if ($LASTEXITCODE -ne 0) { throw "Ninja installation failed: $LASTEXITCODE" }
}
# GitHub-hosted Windows images may already contain NSIS. Prefer the
# runner copy so a temporary Chocolatey outage cannot break CI.
$makensisCandidates = @(
(Get-Command makensis.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source -ErrorAction SilentlyContinue),
(Join-Path ${env:ProgramFiles(x86)} 'NSIS\makensis.exe'),
(Join-Path ${env:ProgramFiles} 'NSIS\makensis.exe')
) | Where-Object { $_ -and (Test-Path $_ -PathType Leaf) }
$makensis = $makensisCandidates | Select-Object -First 1
if (-not $makensis) {
# Chocolatey is only a fallback. Retry transient 5xx/feed failures
# before falling back to a pinned official NSIS ZIP.
for ($attempt = 1; $attempt -le 3 -and -not $makensis; $attempt++) {
try {
choco install nsis --version=3.10 -y --no-progress --limit-output
if ($LASTEXITCODE -eq 0) {
$makensis = @(
(Join-Path ${env:ProgramFiles(x86)} 'NSIS\makensis.exe'),
(Join-Path ${env:ProgramFiles} 'NSIS\makensis.exe')
) | Where-Object { Test-Path $_ -PathType Leaf } | Select-Object -First 1
}
} catch {
Write-Warning "Chocolatey NSIS attempt $attempt failed: $($_.Exception.Message)"
}
if (-not $makensis -and $attempt -lt 3) { Start-Sleep -Seconds 5 }
}
}
if (-not $makensis) {
$nsisZip = Join-Path $env:RUNNER_TEMP 'nsis-3.10.zip'
$nsisRoot = Join-Path $env:RUNNER_TEMP 'nsis-3.10'
$url = 'https://prdownloads.sourceforge.net/nsis/nsis-3.10.zip?download'
try {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $nsisZip -MaximumRetryCount 3 -RetryIntervalSec 5
} catch {
throw "NSIS installation failed after runner, Chocolatey, and direct-download fallbacks: $($_.Exception.Message)"
}
if (-not (Test-Path $nsisZip -PathType Leaf) -or (Get-Item $nsisZip).Length -lt 1000000) {
throw 'NSIS installation failed: downloaded archive is missing or unexpectedly small.'
}
Remove-Item $nsisRoot -Recurse -Force -ErrorAction SilentlyContinue
Expand-Archive -Path $nsisZip -DestinationPath $nsisRoot -Force
$makensis = Get-ChildItem $nsisRoot -Recurse -Filter makensis.exe -File |
Select-Object -First 1 -ExpandProperty FullName
if (-not $makensis) { throw 'NSIS installation failed: makensis.exe was not found.' }
}
$nsisDir = Split-Path $makensis -Parent
$nsisDir | Out-File $env:GITHUB_PATH -Encoding utf8 -Append
Write-Host "Using NSIS: $makensis"
- name: Verify deterministic toolchain
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$cmake = (& cmake --version 2>&1) -join "`n"
$cmake | Write-Host
if ($cmake -notmatch 'cmake version 4\.4\.3') { throw "Expected CMake 4.4.3, found: $cmake" }
Write-Host "Ninja: $(& ninja --version)"
Write-Host "NSIS: $(& makensis /VERSION)"
# ---------------------------------------------------------------------
# Stage 2: metadata
# ---------------------------------------------------------------------
- name: Resolve version
id: version
shell: pwsh
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
run: |
$ErrorActionPreference = 'Stop'
if ($env:REF_TYPE -eq 'tag') { $version = $env:REF_NAME -replace '^v','' }
else { $version = "0.0.0-dev.$($env:GITHUB_SHA.Substring(0,7))" }
if ($version -notmatch '^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$') { throw "Invalid version: $version" }
$base = $version -replace '-.*$',''
$parts = $base.Split('.')
"value=$version" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
"windows_value=$($parts[0]).$($parts[1]).$($parts[2]).0" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
"VOIDONE_VERSION=$version" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
"VOIDONE_VERSION_WINDOWS=$($parts[0]).$($parts[1]).$($parts[2]).0" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
# ---------------------------------------------------------------------
# Stage 3: configure -> build -> test in one canonical build tree
# ---------------------------------------------------------------------
- name: Configure CMake
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DVOIDONE_BUILD_TESTS=ON -DVOIDONE_GENERATE_INSTALLER=OFF
if ($LASTEXITCODE -ne 0) { throw "CMake configure failed: $LASTEXITCODE" }
- name: Build application and tests
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
cmake --build build --config Release --parallel
if ($LASTEXITCODE -ne 0) { throw "Build failed: $LASTEXITCODE" }
- name: Deploy Qt runtime for test executables
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$tests = Get-ChildItem build -Recurse -Filter 'voidone_*_tests.exe' -File | Where-Object { $_.FullName -notmatch '\\CMakeFiles\\' }
if (-not $tests) { throw 'No VoidOne test executables were produced.' }
foreach ($test in $tests) {
windeployqt --release --no-translations --no-compiler-runtime $test.FullName
if ($LASTEXITCODE -ne 0) { throw "windeployqt failed for $($test.Name)." }
}
if (-not (Get-ChildItem build -Recurse -Filter qsqlite.dll -File | Select-Object -First 1)) { throw 'Qt SQLite plugin was not deployed for tests.' }
- name: Run CTest and database tests
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$env:QT_PLUGIN_PATH = "$env:GITHUB_WORKSPACE\build;$env:QT_ROOT_DIR\plugins"
ctest --test-dir build -C Release --output-on-failure --timeout 300 --verbose
if ($LASTEXITCODE -ne 0) { throw "CTest failed: $LASTEXITCODE" }
# ---------------------------------------------------------------------
# Stage 4: one canonical runtime payload for every distribution format
# ---------------------------------------------------------------------
- name: Stage canonical Windows payload
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Remove-Item package, dist -Recurse -Force -ErrorAction SilentlyContinue
New-Item package, dist -ItemType Directory -Force | Out-Null
$exe = Get-ChildItem build -Recurse -Filter VoidOne.exe -File | Where-Object { $_.FullName -notmatch '\\CMakeFiles\\' } | Select-Object -First 1
if (-not $exe) { throw 'VoidOne.exe was not produced.' }
Copy-Item $exe.FullName package\VoidOne.exe
$qml = Join-Path $env:GITHUB_WORKSPACE 'src\ui\qml'
if (Test-Path $qml) { windeployqt --release --compiler-runtime --no-translations --qmldir $qml package\VoidOne.exe }
else { windeployqt --release --compiler-runtime --no-translations package\VoidOne.exe }
if ($LASTEXITCODE -ne 0) { throw "windeployqt failed: $LASTEXITCODE" }
if (-not (Test-Path package\platforms\qwindows.dll)) { throw 'Qt Windows platform plugin is missing.' }
- name: Force bundle x64 MSVC runtime
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$redistRoots = @()
if ($env:VCToolsRedistDir) { $redistRoots += $env:VCToolsRedistDir }
if ($env:VCINSTALLDIR) { $redistRoots += (Join-Path $env:VCINSTALLDIR 'VC\Redist\MSVC') }
$runtime = $null
foreach ($root in ($redistRoots | Select-Object -Unique)) {
if (-not (Test-Path $root)) { continue }
$runtime = Get-ChildItem $root -Recurse -Filter msvcp140.dll -File |
Where-Object { $_.FullName -match '\\x64\\Microsoft\.VC[^\\]*\.CRT\\msvcp140\.dll$' } |
Sort-Object FullName -Descending |
Select-Object -First 1
if ($runtime) { break }
}
if (-not $runtime) { throw "Could not locate x64 MSVC runtime below the installed Visual Studio redist roots." }
$runtimeDir = $runtime.Directory.FullName
Get-ChildItem $runtimeDir -Filter '*.dll' -File | ForEach-Object { Copy-Item $_.FullName package\ -Force }
foreach ($dll in @('msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll')) {
if (-not (Test-Path "package\$dll")) { throw "Required VC++ runtime DLL missing: $dll" }
}
$header = (& dumpbin /headers package\VoidOne.exe 2>&1) -join "`n"
if ($LASTEXITCODE -ne 0 -or $header -notmatch 'machine \(x64\)') { throw 'VoidOne.exe is not an x64 MSVC binary.' }
- name: Prepare launcher startup diagnostics
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Remove-Item startup-diagnostics -Recurse -Force -ErrorAction SilentlyContinue
New-Item startup-diagnostics -ItemType Directory -Force | Out-Null
$packageExe = Join-Path $env:GITHUB_WORKSPACE 'package\VoidOne.exe'
$dependents = (& dumpbin /dependents $packageExe 2>&1) -join ([Environment]::NewLine)
$dependents | Tee-Object -FilePath startup-diagnostics\VoidOne-dependents.txt | Write-Host
Get-ChildItem package -Recurse -File |
Sort-Object FullName |
Select-Object -ExpandProperty FullName |
Out-File startup-diagnostics\package-files.txt -Encoding utf8
- name: Smoke test packaged launcher startup
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$packageDir = Join-Path $env:GITHUB_WORKSPACE 'package'
$logDir = Join-Path $env:LOCALAPPDATA 'VoidOne_app\VoidOne\logs'
$roamingLogDir = Join-Path $env:APPDATA 'VoidOne_app\VoidOne\logs'
Remove-Item $logDir, $roamingLogDir -Recurse -Force -ErrorAction SilentlyContinue
New-Item $logDir -ItemType Directory -Force | Out-Null
$env:QT_LOGGING_RULES = '*.debug=true'
$process = Start-Process -FilePath (Join-Path $packageDir 'VoidOne.exe') -WorkingDirectory $packageDir -PassThru
try {
$deadline = (Get-Date).AddSeconds(20)
do {
Start-Sleep -Milliseconds 250
$process.Refresh()
if ((Get-ChildItem $logDir, $roamingLogDir -Filter 'voidone_enterprise.log' -File -ErrorAction SilentlyContinue)) { break }
} while ((Get-Date) -lt $deadline)
if ($process.HasExited) {
$code = $process.ExitCode
foreach ($dir in @($logDir, $roamingLogDir)) {
$logs = Get-ChildItem $dir -File -ErrorAction SilentlyContinue | Sort-Object LastWriteTime
foreach ($log in $logs) {
Write-Host "===== $($log.FullName) ====="
Get-Content $log.FullName
Copy-Item $log.FullName startup-diagnostics -Force
}
}
Get-ChildItem $logDir, $roamingLogDir -Filter '*.dmp' -File -ErrorAction SilentlyContinue |
Copy-Item -Destination startup-diagnostics -Force -ErrorAction SilentlyContinue
throw "VoidOne exited during startup with code $code."
}
$logFile = Join-Path $logDir 'voidone_enterprise.log'
if (-not (Test-Path $logFile)) {
throw 'VoidOne remained running but did not create its startup log.'
}
$bootstrapMarker = Join-Path $logDir 'voidone_bootstrap.ok'
if (-not (Test-Path $bootstrapMarker -PathType Leaf)) {
throw 'VoidOne startup did not create the bootstrap marker file.'
}
$logText = Get-Content $logFile -Raw
if ($logText -notmatch '\[Bootstrap\] VoidOne process starting\.') {
Write-Warning 'Bootstrap marker file exists but the log marker text was not found; continuing because the atomic bootstrap marker is authoritative.'
}
if ($logText -match '\[UI-FATAL\]|\[Database\].*failed|\[Memory-FATAL\]|\[Exception-FATAL\]') {
Write-Host $logText
throw 'VoidOne reported a fatal startup error.'
}
Write-Host 'VoidOne packaged launcher stayed alive and reached the event loop.'
Write-Host $logText
}
finally {
if (-not $process.HasExited) {
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
$process.WaitForExit(5000)
}
}
- name: Collect launcher startup diagnostics
if: always()
shell: pwsh
run: |
$ErrorActionPreference = 'Continue'
foreach ($dir in @(
(Join-Path $env:LOCALAPPDATA 'VoidOne_app\VoidOne\logs'),
(Join-Path $env:APPDATA 'VoidOne_app\VoidOne\logs')
)) {
if (Test-Path $dir) {
Get-ChildItem $dir -File | Copy-Item -Destination startup-diagnostics -Force
}
}
Write-Host '=== Startup diagnostics ==='
Get-ChildItem startup-diagnostics -File -ErrorAction SilentlyContinue |
Sort-Object Name |
Select-Object Name,Length,LastWriteTime |
Format-Table -AutoSize
- name: Upload launcher startup diagnostics
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: VoidOne-${{ steps.version.outputs.value }}-StartupDiagnostics
path: startup-diagnostics
if-no-files-found: warn
retention-days: 14
- name: Validate canonical payload
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$required = @('VoidOne.exe','Qt6Core.dll','Qt6Gui.dll','Qt6Qml.dll','Qt6Quick.dll','platforms\qwindows.dll','msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll')
foreach ($file in $required) {
if (-not (Test-Path "package\$file" -PathType Leaf)) { throw "Canonical payload is missing: $file" }
}
Get-ChildItem package -Recurse -File | Where-Object { $_.FullName -ne (Join-Path $env:GITHUB_WORKSPACE 'package\SHA256SUMS.csv') } | Sort-Object FullName | Get-FileHash -Algorithm SHA256 | Export-Csv package\SHA256SUMS.csv -NoTypeInformation
# ---------------------------------------------------------------------
# Stage 5: package from the same canonical payload
# ---------------------------------------------------------------------
- name: Download Microsoft VC++ Redistributable payload
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$source = Join-Path $env:RUNNER_TEMP 'vc_redist.x64.exe'
Invoke-WebRequest -UseBasicParsing -Uri 'https://aka.ms/vc14/vc_redist.x64.exe' -OutFile $source
if (-not (Test-Path $source -PathType Leaf)) { throw 'VC++ Redistributable download failed.' }
if ((Get-Item $source).Length -lt 1000000) { throw 'VC++ Redistributable payload is unexpectedly small.' }
"VOIDONE_VC_REDIST_SOURCE=$source" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build NSIS installer
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
foreach ($path in @('packaging\windows\installer.nsi','assets\app-icon.ico','LICENSE')) {
if (-not (Test-Path $path -PathType Leaf)) { throw "Installer input is missing: $path" }
}
$installerScript = Join-Path $env:GITHUB_WORKSPACE 'packaging\windows\installer.nsi'
makensis /V2 /DVERSION='${{ steps.version.outputs.value }}' /DWINDOWS_VERSION='${{ steps.version.outputs.windows_value }}' "/DVC_REDIST_SOURCE=$env:VOIDONE_VC_REDIST_SOURCE" $installerScript
if ($LASTEXITCODE -ne 0) { throw "NSIS failed: $LASTEXITCODE" }
if (-not (Test-Path dist\VoidOne-Setup-x64.exe -PathType Leaf)) { throw 'NSIS installer was not produced.' }
- name: Build portable ZIP from canonical payload
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Compress-Archive -Path package\* -DestinationPath dist\VoidOne-Portable-x64.zip -CompressionLevel Optimal -Force
if (-not (Test-Path dist\VoidOne-Portable-x64.zip -PathType Leaf)) { throw 'Portable ZIP was not produced.' }
- name: Upload tagged build artifact
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v7.0.1
with:
name: VoidOne-${{ steps.version.outputs.value }}
path: |
package
dist\VoidOne-Setup-x64.exe
dist\VoidOne-Portable-x64.zip
if-no-files-found: error
retention-days: 14
- name: Upload non-tag installer artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v7.0.1
with:
name: VoidOne-${{ steps.version.outputs.value }}-Setup-x64
path: dist\VoidOne-Setup-x64.exe
if-no-files-found: error
retention-days: 14
- name: Upload non-tag portable artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v7.0.1
with:
name: VoidOne-${{ steps.version.outputs.value }}-Portable-x64
path: dist\VoidOne-Portable-x64.zip
if-no-files-found: error
retention-days: 14
- name: Upload non-tag checksums artifact
if: github.ref_type != 'tag'
uses: actions/upload-artifact@v7.0.1
with:
name: VoidOne-${{ steps.version.outputs.value }}-SHA256
path: package\SHA256SUMS.csv
if-no-files-found: error
retention-days: 14
release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
actions: read
steps:
- name: Download release artifacts
uses: actions/download-artifact@v5
with:
pattern: VoidOne-*
path: release
merge-multiple: true
- name: Validate release payload
shell: bash
run: |
set -euo pipefail
test -f release/dist/VoidOne-Setup-x64.exe
test -f release/dist/VoidOne-Portable-x64.zip
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
release/dist/VoidOne-Setup-x64.exe
release/dist/VoidOne-Portable-x64.zip