fix(packaging): verify bundled startup dependencies

This commit is contained in:
chengma
2026-07-27 17:44:15 +08:00
parent 38d7285a0e
commit a18391dae7
7 changed files with 106 additions and 14 deletions
+25
View File
@@ -61,6 +61,29 @@ function Assert-NoExcludedData {
}
}
function Assert-PackagedStartup {
param(
[string]$ExePath,
[int]$TimeoutSeconds = 30
)
$process = Start-Process `
-FilePath $ExePath `
-ArgumentList @("--startup-smoke-test") `
-PassThru `
-WindowStyle Hidden
if (-not $process.WaitForExit($TimeoutSeconds * 1000)) {
if (-not $process.HasExited) {
Stop-Process -Id $process.Id -Force
}
throw "打包程序启动自检超时(${TimeoutSeconds}秒): $ExePath"
}
$process.Refresh()
if ($process.ExitCode -ne 0) {
throw "打包程序启动自检失败,退出码: $($process.ExitCode)"
}
}
function Compress-ArchiveWithRetry {
param(
[string]$SourcePath,
@@ -160,6 +183,8 @@ if (-not (Test-Path -LiteralPath $internalDir)) {
throw "Build output missing _internal directory. Expected PyInstaller 6.x onedir layout (cmshopee.exe + _internal). Ensure PyInstaller >= 6.0 is installed: py -3.10 -m pip install -r requirements-build.txt"
}
Write-Host "Verified onedir layout: _internal present"
Assert-PackagedStartup -ExePath $exePath -TimeoutSeconds 30
Write-Host "Verified packaged startup smoke test"
$releaseRoot = Join-Path $repoRoot "release"
$releaseName = "$appName$appVersion"