Skip to content

Commit ec2a9ca

Browse files
committed
ci: 加 package-check.yml,每次 commit 模拟完整打包
push 改动打包相关文件(aao/custom/resource/spec/deps/logo/workflow)时触发, 也可手动 workflow_dispatch。完整模拟发版打包流程: lint → 关 Defender → pyinstaller → 冒烟验 PKG 能加载 → 下 AFA → 嵌图标 → 复制资源 → 7z 打包 → 上传 artifact(check-build)。 不发版不打 tag。尽早暴露 PKG 损坏/CI 环境差异等问题,不用打 tag 才知道。 代码 lint/format 检查仍由轻量的 check.yml 负责,本 workflow 只管打包重活。 concurrency:同分支新提交取消旧的在跑的。
1 parent facf609 commit ec2a9ca

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Package Check
2+
3+
# 每次 commit(push 改动打包相关文件)模拟完整打包:构建 + 冒烟验 PKG + 上传 artifact。
4+
# 不发版、不打 tag。尽早发现打包问题(PKG 损坏、CI 环境差异)。
5+
# 代码 lint/format 检查见 check.yml(轻量),本 workflow 只管打包。
6+
7+
on:
8+
push:
9+
branches: [main, master]
10+
paths:
11+
- 'aao/**'
12+
- 'custom/**'
13+
- 'resource/**'
14+
- 'examples/**'
15+
- 'aao.spec'
16+
- 'pyproject.toml'
17+
- 'uv.lock'
18+
- 'package.json'
19+
- 'pnpm-lock.yaml'
20+
- 'logo.png'
21+
- '.github/workflows/package-check.yml'
22+
workflow_dispatch:
23+
24+
concurrency:
25+
group: package-check-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
package-check:
30+
runs-on: windows-latest
31+
steps:
32+
- uses: actions/checkout@v6
33+
- uses: actions/setup-python@v6
34+
with:
35+
python-version: '3.13'
36+
- uses: astral-sh/setup-uv@v8.1.0
37+
- uses: pnpm/action-setup@v6
38+
- uses: actions/setup-node@v6
39+
with:
40+
node-version: 24
41+
cache: pnpm
42+
- run: pnpm install --frozen-lockfile
43+
- run: uv sync
44+
- run: pnpm check
45+
- run: pnpm check:py
46+
- name: Disable Windows Defender realtime monitoring
47+
shell: powershell
48+
run: |
49+
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
50+
Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE" -ErrorAction SilentlyContinue
51+
Write-Host "Defender realtime monitoring disabled for build"
52+
- name: Build (PyInstaller)
53+
run: uv run pyinstaller aao.spec --noconfirm
54+
- name: Smoke test packaged exe
55+
shell: bash
56+
run: |
57+
export QT_QPA_PLATFORM=offscreen
58+
timeout 20 ./dist/aao.app/aao.app.exe --no-api > smoke.log 2>&1 || true
59+
if grep -q "Could not load PyInstaller" smoke.log; then
60+
echo "[ERR] packaged exe failed to load PKG archive"
61+
cat smoke.log
62+
exit 1
63+
fi
64+
echo "[OK] packaged exe loads PKG archive"
65+
head -5 smoke.log
66+
- name: Download AFA (ArknightsFrameAssistant)
67+
shell: bash
68+
run: |
69+
mkdir -p dist/aao.app/afa
70+
repo="CloudTracey/arknights-frame-assistant"
71+
tag="$(curl -fsSL "https://api.github.com/repos/$repo/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')"
72+
echo "AFA latest tag: $tag"
73+
curl -fsSL "https://github.com/$repo/releases/download/$tag/AFA.exe" -o dist/aao.app/afa/AFA.exe
74+
curl -fsSL "https://raw.githubusercontent.com/$repo/$tag/LICENSE" -o dist/aao.app/afa/LICENSE || echo "[WARN] AFA LICENSE 未取到"
75+
- name: Convert logo.png to ico
76+
shell: bash
77+
run: uv run python -c "from PIL import Image; Image.open('logo.png').save('logo.ico', format='ICO', sizes=[(256,256),(128,128),(64,64),(48,48),(32,32),(16,16)])"
78+
- name: Apply app icon
79+
shell: bash
80+
run: |
81+
cp logo.ico dist/aao.app/logo.ico
82+
curl -fsSL https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -o rcedit.exe
83+
./rcedit.exe dist/aao.app/aao.app.exe --set-icon logo.ico
84+
echo "[OK] Applied Windows executable icon"
85+
- name: Stage external resources
86+
shell: bash
87+
run: |
88+
cp -r resource data examples dist/aao.app/
89+
- name: Package
90+
shell: bash
91+
run: |
92+
archive="ArknightsAutoOperator-check-${GITHUB_SHA::7}.zip"
93+
( cd dist/aao.app && 7z a "../../$archive" . )
94+
- uses: actions/upload-artifact@v7
95+
with:
96+
name: check-build
97+
path: |
98+
*.zip
99+
dist/aao.app

0 commit comments

Comments
 (0)