Skip to content

Commit 8185a3f

Browse files
committed
ci: 移除发布流程中的 smoke check
1 parent 6082c05 commit 8185a3f

3 files changed

Lines changed: 3 additions & 141 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -437,73 +437,6 @@ jobs:
437437
@{ Name='lite'; SC='false'; Suffix='-lite'; Edition='lite' }
438438
)
439439
440-
function Test-FrontendSmoke {
441-
param(
442-
[Parameter(Mandatory = $true)]
443-
[string]$ExePath,
444-
[Parameter(Mandatory = $true)]
445-
[string]$Label
446-
)
447-
448-
function Get-StatusCode {
449-
param([string]$Url)
450-
try {
451-
return [int](Invoke-WebRequest -Uri $Url -UseBasicParsing -TimeoutSec 2).StatusCode
452-
} catch {
453-
if ($_.Exception.Response) {
454-
return [int]$_.Exception.Response.StatusCode
455-
}
456-
return $null
457-
}
458-
}
459-
460-
$probeRoot = Join-Path $env:RUNNER_TEMP ("xunitytoolkit-smoke-" + [guid]::NewGuid().ToString('N'))
461-
$launcherDir = Join-Path $env:RUNNER_TEMP ("xunitytoolkit-launcher-" + [guid]::NewGuid().ToString('N'))
462-
$port = Get-Random -Minimum 42000 -Maximum 52000
463-
$proc = $null
464-
465-
try {
466-
New-Item -ItemType Directory -Path $probeRoot -Force | Out-Null
467-
New-Item -ItemType Directory -Path $launcherDir -Force | Out-Null
468-
469-
$settings = @{ aiTranslation = @{ port = $port } } | ConvertTo-Json -Depth 3
470-
Set-Content -Path (Join-Path $probeRoot 'settings.json') -Value $settings -Encoding UTF8
471-
472-
$env:AppData__Root = $probeRoot
473-
$proc = Start-Process -FilePath $ExePath -WorkingDirectory $launcherDir -PassThru
474-
475-
$rootStatus = $null
476-
$apiStatus = $null
477-
for ($i = 0; $i -lt 40; $i++) {
478-
Start-Sleep -Milliseconds 500
479-
$rootStatus = Get-StatusCode "http://127.0.0.1:$port/"
480-
$apiStatus = Get-StatusCode "http://127.0.0.1:$port/api/settings/version"
481-
if ($null -ne $rootStatus -and $null -ne $apiStatus) {
482-
break
483-
}
484-
}
485-
486-
if ($rootStatus -ne 200 -or $apiStatus -ne 200) {
487-
$rootText = if ($null -eq $rootStatus) { 'n/a' } else { [string]$rootStatus }
488-
$apiText = if ($null -eq $apiStatus) { 'n/a' } else { [string]$apiStatus }
489-
throw ("Smoke check failed for {0}: root={1} api={2}" -f $Label, $rootText, $apiText)
490-
}
491-
492-
Write-Host ("Smoke check passed for {0} (root={1}, api={2})" -f $Label, $rootStatus, $apiStatus)
493-
} finally {
494-
if ($proc -and -not $proc.HasExited) {
495-
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
496-
}
497-
Remove-Item Env:AppData__Root -ErrorAction SilentlyContinue
498-
if (Test-Path $probeRoot) {
499-
Remove-Item $probeRoot -Recurse -Force -ErrorAction SilentlyContinue
500-
}
501-
if (Test-Path $launcherDir) {
502-
Remove-Item $launcherDir -Recurse -Force -ErrorAction SilentlyContinue
503-
}
504-
}
505-
}
506-
507440
foreach ($ed in $editions) {
508441
$outDir = "Release\win-x64$($ed.Suffix)"
509442
Write-Host "`n--- Publishing edition: $($ed.Name) ---"
@@ -550,8 +483,6 @@ jobs:
550483
Copy-Item $updaterExe "$outDir/" -Force
551484
}
552485
553-
Test-FrontendSmoke -ExePath (Join-Path $outDir "XUnityToolkit-WebUI.exe") -Label $ed.Name
554-
555486
$exeFile = Get-Item (Join-Path $outDir "XUnityToolkit-WebUI.exe")
556487
$sizeMB = [math]::Round($exeFile.Length / 1MB, 1)
557488
Write-Host "$($ed.Name) done (exe: $sizeMB MB)"

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ dotnet build TranslatorEndpoint/TranslatorEndpoint.csproj -c Release
127127
- `XUnityToolkit-WebUI.csproj` 默认会在构建前自动执行前端 `npm install` + `npm run build`
128128
- 前端开发代理到 `http://127.0.0.1:51821`,不要改成 `localhost`
129129
- 完整 UI 预览优先看后端端口 `51821`,因为它同时承载静态前端和 API。
130-
- 发布产物首页可用性现在由 `build.ps1``.github/workflows/build.yml` 中的 `Test-FrontendSmoke` 双重守卫;它们会从错误工作目录启动 EXE,并要求 `/``/api/settings/version` 同时返回 `200`
130+
- 发布流程当前不会在构建脚本或 GitHub Actions 中自动启动 EXE 做首页 smoke check;若需要运行态验收,请单独执行
131131

132132
## 6. 运行时架构
133133

@@ -456,7 +456,7 @@ CI:
456456
- CI 逻辑与 `build.ps1` 是两份并行维护的实现,改构建流程时必须双改
457457
- CI 不直接调用 `build.ps1`
458458
- 更新器是增量更新的关键组件,含备份、替换、删除、回滚逻辑
459-
- 首页静态资源可用性 smoke check 现在也是双维护实现;若调整启动端口解析、静态资源目录、启动方式或首页健康检查,必须同时更新 `build.ps1``.github/workflows/build.yml` 中的 `Test-FrontendSmoke`
459+
- 若调整启动端口解析、静态资源目录或启动方式,注意分别评估本地构建脚本与 GitHub Actions 的发布行为,但当前没有内置 smoke check 守卫
460460
- MSI 由 WiX 生成,且不同 edition 构建时必须注意清理 `Installer/obj/...`
461461

462462
## 14. 关键约束与不变量
@@ -656,7 +656,7 @@ CI:
656656
- `RecordError``NormalizeForCache``ApplicationStopping` 回调、日志级别过滤、SignalR 事件名与阶段名,都属于“改一处必须全链路核对”的同步点
657657
- 翻译解析契约、运行时占位符保护与 `Persistable` 过滤属于新的高频同步点;凡是新增翻译调用方或缓存写入点,都要核对是否错误接收了非结构化回退结果
658658
- `build.ps1``.github/workflows/build.yml` 不是同一实现的不同入口,而是两份并行维护脚本;流程、版本号、资源来源、构建 edition 发生变化时必须双改
659-
- 若变更首页可用性、静态资源目录、启动端口或启动方式,还要同步更新两处 `Test-FrontendSmoke`,确保“错误工作目录启动时 `/` `/api/settings/version` 都返回 `200`”这个回归守卫不失效
659+
- 若变更首页可用性、静态资源目录、启动端口或启动方式,需要分别核对 `build.ps1` `.github/workflows/build.yml` 的发布流程,但当前不再维护 `Test-FrontendSmoke` 回归守卫
660660
- Git 提交标题规范、`.github/workflows/build.yml``### Changelog` 的生成逻辑,以及 `XUnityToolkit-Vue/src/views/SettingsView.vue``typeLabels` / 正则解析属于联动点;若调整提交格式、更新内容展示样式或 changelog 生成方式,必须同时核对这三处,且注意 `--no-merges` 会让 merge commit 不进入工具箱更新列表
661661
- `llama.cpp` 版本更新需要同时同步 `build.ps1``build.yml``LocalLlmService.LlamaVersion`、下载资源命名模式、README/本手册说明
662662

build.ps1

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -47,73 +47,6 @@ function Invoke-WithRetry {
4747
}
4848
}
4949

50-
function Test-FrontendSmoke {
51-
param(
52-
[Parameter(Mandatory = $true)]
53-
[string]$ExePath,
54-
[Parameter(Mandatory = $true)]
55-
[string]$Label
56-
)
57-
58-
function Get-StatusCode {
59-
param([string]$Url)
60-
try {
61-
return [int](Invoke-WebRequest -Uri $Url -UseBasicParsing -TimeoutSec 2).StatusCode
62-
} catch {
63-
if ($_.Exception.Response) {
64-
return [int]$_.Exception.Response.StatusCode
65-
}
66-
return $null
67-
}
68-
}
69-
70-
$probeRoot = Join-Path $env:TEMP ("xunitytoolkit-smoke-" + [guid]::NewGuid().ToString('N'))
71-
$launcherDir = Join-Path $env:TEMP ("xunitytoolkit-launcher-" + [guid]::NewGuid().ToString('N'))
72-
$port = Get-Random -Minimum 42000 -Maximum 52000
73-
$proc = $null
74-
75-
try {
76-
New-Item -ItemType Directory -Path $probeRoot -Force | Out-Null
77-
New-Item -ItemType Directory -Path $launcherDir -Force | Out-Null
78-
79-
$settings = @{ aiTranslation = @{ port = $port } } | ConvertTo-Json -Depth 3
80-
Set-Content -Path (Join-Path $probeRoot 'settings.json') -Value $settings -Encoding UTF8
81-
82-
$env:AppData__Root = $probeRoot
83-
$proc = Start-Process -FilePath $ExePath -WorkingDirectory $launcherDir -PassThru
84-
85-
$rootStatus = $null
86-
$apiStatus = $null
87-
for ($i = 0; $i -lt 40; $i++) {
88-
Start-Sleep -Milliseconds 500
89-
$rootStatus = Get-StatusCode "http://127.0.0.1:$port/"
90-
$apiStatus = Get-StatusCode "http://127.0.0.1:$port/api/settings/version"
91-
if ($null -ne $rootStatus -and $null -ne $apiStatus) {
92-
break
93-
}
94-
}
95-
96-
if ($rootStatus -ne 200 -or $apiStatus -ne 200) {
97-
$rootText = if ($null -eq $rootStatus) { 'n/a' } else { [string]$rootStatus }
98-
$apiText = if ($null -eq $apiStatus) { 'n/a' } else { [string]$apiStatus }
99-
throw ("Smoke check failed for {0}: root={1} api={2}" -f $Label, $rootText, $apiText)
100-
}
101-
102-
Write-Host (" [smoke] {0} passed (root={1}, api={2})" -f $Label, $rootStatus, $apiStatus) -ForegroundColor Green
103-
} finally {
104-
if ($proc -and -not $proc.HasExited) {
105-
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
106-
}
107-
Remove-Item Env:AppData__Root -ErrorAction SilentlyContinue
108-
if (Test-Path $probeRoot) {
109-
Remove-Item $probeRoot -Recurse -Force -ErrorAction SilentlyContinue
110-
}
111-
if (Test-Path $launcherDir) {
112-
Remove-Item $launcherDir -Recurse -Force -ErrorAction SilentlyContinue
113-
}
114-
}
115-
}
116-
11750
try {
11851

11952
# Ensure TLS 1.2+ for all HTTPS requests (PowerShell 5.1 defaults to TLS 1.0)
@@ -542,8 +475,6 @@ if (Test-Path $bundledSrc) {
542475
Write-Host " Copied bundled assets." -ForegroundColor DarkGray
543476
}
544477

545-
Test-FrontendSmoke -ExePath (Join-Path $OutputDir 'XUnityToolkit-WebUI.exe') -Label "$rid ($Edition)"
546-
547478
$exeFile = Get-Item (Join-Path $OutputDir 'XUnityToolkit-WebUI.exe')
548479
$exeSize = [math]::Round($exeFile.Length / 1MB, 1)
549480
Write-Host " $rid done (exe: $exeSize MB)" -ForegroundColor Green

0 commit comments

Comments
 (0)