Skip to content

fix(okww): 在okww启动前启动游戏 #412

fix(okww): 在okww启动前启动游戏

fix(okww): 在okww启动前启动游戏 #412

Workflow file for this run

name: Build EXE & Run Exe Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build-rust:
runs-on: windows-latest
env:
PYTHONUTF8: 1
RUSTUP_TOOLCHAIN: 1.97.1
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: astral-sh/setup-uv@v7
- name: Install locked dependencies and Rust
run: |
uv sync --frozen
rustup toolchain install 1.97.1 --profile minimal --component clippy --component rustfmt
- name: Check and test Windows Rust implementation
shell: pwsh
run: |
cargo fmt --manifest-path rust-gui/Cargo.toml --check
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cargo clippy --manifest-path rust-gui/Cargo.toml --locked --all-features --all-targets -- -D warnings
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$env:ODH_TEST_PYTHON = (Resolve-Path .venv/Scripts/python.exe).Path
cargo test --manifest-path rust-gui/Cargo.toml --locked --all-features
- name: Build complete Rust package and test EXEs
run: uv run --frozen python tools/build_rust.py --test
- name: Check clean release directory
id: rust-package-check
if: always() && hashFiles('deploy/dist/rust/OneDragon-Helper/version.json') != ''
run: uv run python tools/release_package.py check --package deploy/dist/rust/OneDragon-Helper
- uses: actions/upload-artifact@v6
if: success() && steps.rust-package-check.outcome == 'success'
with:
name: OneDragon-Helper-Rust-windows
path: |
deploy/dist/rust/OneDragon-Helper-Rust.zip
deploy/dist/rust/OneDragon-Helper-Rust.zip.sha256
if-no-files-found: error
retention-days: 7
build-headless:
runs-on: windows-latest
env:
PYTHONUTF8: 1
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: astral-sh/setup-uv@v7
- name: Install locked dependencies
run: uv sync --frozen
- name: Build CLI without Qt
run: uv run python -m PyInstaller --noconfirm --workpath deploy/build/rust-cli --distpath deploy/dist/rust-cli deploy/OneDragon-Helper-CLI.spec
- name: Test real CLI executable in temporary copies
shell: pwsh
run: |
$binary = 'deploy/dist/rust-cli/OneDragon-Helper/OneDragon-Helper-CLI.exe'
if (!(Test-Path -LiteralPath $binary)) { throw 'CLI executable missing' }
$env:ODH_CLI_EXE = (Resolve-Path -LiteralPath $binary).Path
uv run python -m unittest discover -s python-backend/tests -t python-backend -p test_headless_exe.py -v
build-exe:
runs-on: windows-latest
env:
# 强制 UTF-8 模式:Runner exe 在英文 locale(cp1252) 下经 colorama 输出中文会崩,
# 此变量让冻结解释器以 UTF-8 写 stdout(与 deploy/runtime_hook_utf8.py 同源修复)。
PYTHONUTF8: 1
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync
# build.bat 会:① PyInstaller 打包 GUI(onedir) + Runner/Updater(onefile)
# ② 拷贝受控资源和版本信息 ③ 在临时副本跑 tests/exe/test_*_exe.py
# (真实启动打包产物做集成测试,需 Windows 管理员态,GitHub Windows runner 默认满足)。
# CI 环境变量使 build.bat 跳过交互式 pause;exe 测试失败则 build.bat 以非 0 退出,
# call 把退出码透传给本步骤,使构建失败。
- name: Build EXE and run exe integration tests
shell: cmd
run: call deploy\build.bat
# 测试失败时仍可上传干净的程序包排查;未通过文件清单检查的目录不上传。
- name: Check package before upload
id: package-check
if: always() && hashFiles('deploy/dist/OneDragon-Helper/version.json') != ''
run: uv run python tools/release_package.py check --package deploy/dist/OneDragon-Helper
- name: Upload packaged EXE
if: always() && steps.package-check.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: OneDragon-Helper-windows
path: deploy/dist/OneDragon-Helper
if-no-files-found: warn
retention-days: 7