Skip to content

Commit facf609

Browse files
committed
ci(release): 关 Defender 实时扫描 + 打包后冒烟验 PKG
v0.2/v0.3/v0.3.1 发版 exe(raw artifact 同样)报 "Could not load PyInstaller's embedded PKG archive",但本地同 spec 打包能跑。 排除 UPX/7z 后,高度怀疑 CI windows-latest 的 Defender 实时扫描在 PyInstaller 写入 exe 时改动 PKG archive。 - Build 前禁用 Defender 实时扫描 + 工作区加排除路径 - Build 后立即 offscreen 跑 exe 冒烟,grep "Could not load PyInstaller" → CI 当场验证 PKG 能加载,产出损坏的 exe 不再发版
1 parent bf5ea27 commit facf609

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,29 @@ jobs:
2525
- run: pnpm install --frozen-lockfile
2626
- run: pnpm check
2727
- run: pnpm check:py
28+
- name: Disable Windows Defender realtime monitoring
29+
shell: powershell
30+
run: |
31+
# PyInstaller 写入 exe 时 Defender 实时扫描会改动 PKG archive,
32+
# 导致产出的 exe "Could not load embedded PKG archive"。打包前关掉。
33+
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
34+
Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE" -ErrorAction SilentlyContinue
35+
Write-Host "Defender realtime monitoring disabled for build"
2836
- name: Build (PyInstaller)
2937
run: uv run pyinstaller aao.spec --noconfirm
38+
- name: Smoke test packaged exe
39+
shell: bash
40+
run: |
41+
# 打包后立即 offscreen 跑,验证 PKG archive 能加载(CI 自检,避免产出损坏的 exe 还发版)
42+
export QT_QPA_PLATFORM=offscreen
43+
timeout 20 ./dist/aao.app/aao.app.exe --no-api > smoke.log 2>&1 || true
44+
if grep -q "Could not load PyInstaller" smoke.log; then
45+
echo "[ERR] packaged exe failed to load PKG archive"
46+
cat smoke.log
47+
exit 1
48+
fi
49+
echo "[OK] packaged exe loads PKG archive"
50+
head -5 smoke.log
3051
- name: Download AFA (ArknightsFrameAssistant)
3152
shell: bash
3253
run: |

0 commit comments

Comments
 (0)