fix(mqdh): bound every Windows installer smoke step with a timeout (#33)

The NSIS silent install can wait forever on a CI runner if it falls back to an
interactive UI. Use Start-Process + WaitForExit with explicit timeouts for
install, version, backend smoke and uninstall so the job fails fast with a real
diagnostic instead of hanging.
This commit is contained in:
cflmy committed 2026-12-03 17:49:26 +08:00
1 parent 08d7b173e5
commit 4e4e08b375
1 file changed
+14 -4
+14 -4
View File
@@ -23,12 +23,22 @@ New-Item -ItemType Directory -Force .ci | Out-Null
$final = ".ci/mqdh-$version-windows-x86_64-setup.exe"
Copy-Item $setup.FullName $final
node scripts/tauri/collect-installer.mjs --installer $final nsis x86_64-pc-windows-msvc
& $final /S
Write-Output "build-windows: silent install"
$install = Start-Process -FilePath $final -ArgumentList '/S' -PassThru
if (-not $install.WaitForExit(180000)) { $install.Kill(); throw 'NSIS silent install timed out' }
$installed = Join-Path $env:LOCALAPPDATA 'MQDH\MQDH.exe'
if (-not (Test-Path $installed)) { throw "per-user NSIS install not found: $installed" }
& $installed --version
$version = Start-Process -FilePath $installed -ArgumentList '--version' -PassThru -NoNewWindow
if (-not $version.WaitForExit(60000)) { $version.Kill(); throw 'installed --version timed out' }
Write-Output "build-windows: installed version command passed"
$home = Join-Path $env:TEMP ("mqdh-smoke-" + [guid]::NewGuid())
$env:MQDH_HOME = $home
& $installed --smoke
if (Test-Path $installed) { & (Join-Path $env:LOCALAPPDATA 'MQDH\uninstall.exe') /S }
$smoke = Start-Process -FilePath $installed -ArgumentList '--smoke' -PassThru -NoNewWindow
if (-not $smoke.WaitForExit(300000)) { $smoke.Kill(); throw 'installed backend --smoke timed out' }
if ($smoke.ExitCode -ne 0) { throw "installed backend --smoke failed: $($smoke.ExitCode)" }
$uninstall = Join-Path (Split-Path $installed) 'uninstall.exe'
if (Test-Path $uninstall) {
$remove = Start-Process -FilePath $uninstall -ArgumentList '/S' -PassThru
if (-not $remove.WaitForExit(120000)) { $remove.Kill(); throw 'NSIS uninstall timed out' }
}
Write-Output "build-windows: OK $final"