mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 21:34:21 +08:00
面向零基础老年用户,easy-tdx 可打包成单一 Windows EXE,双击即用。 新增: - 后端同源托管前端 dist(app.py 三级探测:env → _MEIPASS → web-ui/dist) - easy-tdx serve 默认 --open-browser,启动后自动开浏览器 - PyInstaller 打包入口(__main__.py)+ spec 配置(easy_tdx.spec) - 系统托盘(tray.py):右下角图标,右键"打开浏览器/退出" 解决老人不会用任务管理器关闭的问题 - GitHub Actions release.yml:打 v* tag 自动构建并发布 EXE 到 Releases - docs/packaging.md 打包使用文档 修复: - K 线残缺尾记录导致 500(security_bars.py):通达信服务器偶发 ret_count 与 body 长度不匹配,改为 try/except 优雅降级丢弃残缺尾, 返回已解析的完整记录。GetIndexBarsCmd 同改。加 4 个回归测试。 - PyInstaller frozen 模式三个坑: 1. console=False 下 stdout/stderr 为 None → 重定向到日志文件 2. multiprocessing spawn 子进程重新 import __main__ → freeze_support + 子进程检测 3. 系统托盘需主线程消息泵 → uvicorn 挪到后台线程 文档: - README/手册改为三档分流:EXE(零基础)/ Python(一条命令)/ 源码(打包) - 删除 npm run dev / 5173 / 两个终端的过时说明 - 手册补虚拟环境配置 + EXE 打包附录 + EXE 排错 FAQ
94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
name: Release EXE
|
||
|
||
# 打 tag 时构建 Windows 单 EXE 并发布到 GitHub Release。
|
||
# 与 publish.yml(PyPI)并行独立:即使 PyPI 发布失败,EXE 仍可发布,
|
||
# 提高发布韧性。Phase 1 产物未签名,老人首次运行会被 SmartScreen 拦截,
|
||
# 需手动"更多信息 → 仍要运行"——Phase 2 引入代码签名后解决。
|
||
on:
|
||
push:
|
||
tags:
|
||
- "v*"
|
||
|
||
permissions:
|
||
contents: write # softprops/action-gh-release 创建 Release 需要
|
||
|
||
jobs:
|
||
build-windows:
|
||
name: Build Windows EXE
|
||
runs-on: windows-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- name: Set up Python
|
||
uses: actions/setup-python@v5
|
||
with:
|
||
python-version: "3.12"
|
||
|
||
- name: Set up Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "20"
|
||
cache: "npm"
|
||
cache-dependency-path: web-ui/package-lock.json
|
||
|
||
# 安装后端(含 [web,packaging] extras:fastapi/uvicorn + pystray/Pillow)
|
||
- name: Install Python deps
|
||
run: |
|
||
pip install -e ".[web,packaging]"
|
||
pip install pyinstaller
|
||
|
||
# 构建前端 → web-ui/dist/,spec 把它打到 EXE 内的 web_dist/
|
||
- name: Build frontend
|
||
run: |
|
||
npm ci
|
||
npm run build
|
||
working-directory: web-ui
|
||
|
||
- name: Build EXE
|
||
run: pyinstaller easy_tdx.spec --noconfirm
|
||
|
||
# 重命名为带版本号的文件名,方便老人下载时识别
|
||
- name: Rename EXE with version
|
||
shell: bash
|
||
run: |
|
||
VERSION="${GITHUB_REF_NAME#v}"
|
||
mv dist/easy-tdx.exe "dist/easy-tdx-${VERSION}-windows.exe"
|
||
ls -lh dist/
|
||
|
||
- uses: actions/upload-artifact@v4
|
||
with:
|
||
name: easy-tdx-windows-exe
|
||
path: dist/easy-tdx-*-windows.exe
|
||
if-no-files-found: error
|
||
|
||
release:
|
||
name: Publish GitHub Release
|
||
needs: build-windows
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/download-artifact@v4
|
||
with:
|
||
name: easy-tdx-windows-exe
|
||
path: dist
|
||
|
||
- name: Create release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
files: dist/easy-tdx-*-windows.exe
|
||
generate_release_notes: true
|
||
body: |
|
||
## 下载使用
|
||
|
||
1. 下载下方 `easy-tdx-*-windows.exe`(约 80-150MB)
|
||
2. 双击运行
|
||
3. 浏览器会自动打开回测界面(地址 `http://localhost:8000`)
|
||
|
||
## ⚠️ SmartScreen 提示
|
||
|
||
本版本未做代码签名,首次运行 Windows 会弹出"已保护你的电脑":
|
||
|
||
1. 点击 **更多信息**
|
||
2. 点击 **仍要运行**
|
||
|
||
Phase 2 将引入代码签名消除此提示。
|