Skip to content

Commit 7449db5

Browse files
committed
诊断:Windows 上跑出包前的全部检查(不出包)
1 parent ea42d6c commit 7449db5

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

‎.github/workflows/mpv-check.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# 一次性诊断(不出包,约 5 分钟):在真 Windows 上跑出包前的全部检查,确认后再出正式包。
2+
name: mpv-check
3+
on:
4+
push:
5+
branches: ['diag/**']
6+
7+
jobs:
8+
build: # 与 windows.yml 同名,复用它的 Rust 编译缓存
9+
runs-on: windows-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: 下载 mpv.exe(与 windows.yml 相同)
14+
shell: pwsh
15+
# 带本次运行的 token 查询:runner 出口 IP 共用,不带 token 时每小时 60 次的匿名额度常被耗尽(实测撞上过)
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
run: |
19+
$rel = Invoke-RestMethod https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest -Headers @{ Authorization = "Bearer $env:GH_TOKEN" }
20+
# x86_64-v3:AVX2 优化的构建(2013 年以后的 CPU 都支持),软解和缩放更快
21+
$asset = $rel.assets | Where-Object name -match '^mpv-x86_64-v3-\d{8}-git-.*\.7z$' | Select-Object -First 1
22+
if (-not $asset) { throw '没找到 mpv 构建' }
23+
Write-Host "mpv: $($asset.name)"
24+
Invoke-WebRequest $asset.browser_download_url -OutFile mpv.7z
25+
7z e mpv.7z mpv.exe -osrc-tauri/mpv -y
26+
27+
- name: 直接跑 mpv:配置目录带 \\?\ 前缀 vs 去掉前缀
28+
shell: pwsh
29+
timeout-minutes: 3
30+
run: |
31+
$dir = (Resolve-Path src-tauri/mpv).Path
32+
$log = Join-Path $PWD 'mpv-check.log'
33+
foreach ($cd in @("\\?\$dir", $dir)) {
34+
Remove-Item $log -ErrorAction SilentlyContinue
35+
$p = Start-Process -FilePath "$dir\mpv.exe" -Wait -PassThru -ArgumentList @(
36+
"--config-dir=$cd", "--log-file=$log", '--vo=null', '--ao=null', '--force-window=no', '--idle=no',
37+
'av://lavfi:testsrc=duration=1')
38+
$t = Get-Content $log -Raw
39+
Write-Host "config-dir=$cd 退出码=$($p.ExitCode) 读到mpv.conf=$($t -match 'Reading config file') ModernZ=$($t -match '\[modernz\] Loading lua script') 自带OSC=$($t -match '@osc\.lua')"
40+
}
41+
42+
- name: mpv 实际渲染截图(ModernZ、选集菜单;无显卡时走 WARP)
43+
shell: pwsh
44+
continue-on-error: true # 只为留证据,runner 没有桌面时不影响出包
45+
timeout-minutes: 3
46+
run: |
47+
$env:SHOT_DIR = Join-Path $PWD 'smoke'; New-Item -ItemType Directory -Force $env:SHOT_DIR | Out-Null
48+
$p = Start-Process -FilePath "$PWD\src-tauri\mpv\mpv.exe" -PassThru -ArgumentList @(
49+
"--config-dir=$PWD\src-tauri\mpv", "--script=$PWD\tools\mpv-shot.lua", '--force-window=yes', '--ao=null', '--msg-level=all=v,modernz=trace,input=debug',
50+
"--log-file=$env:SHOT_DIR\mpv-render.log", '--force-media-title="浴血黑帮 S01E01 测试"', 'av://lavfi:testsrc2=duration=60:size=1920x1080')
51+
if (-not $p.WaitForExit(60000)) { Stop-Process $p.Id; Write-Host 'mpv 60 秒没退出(截图脚本没跑完),已结束' }
52+
else { Write-Host "mpv 退出码 $($p.ExitCode)" }
53+
Select-String -Path "$env:SHOT_DIR\mpv-render.log" -Pattern '\]\[e\]\[|d3d11|Using hardware|VO:' | ForEach-Object Line
54+
- uses: dtolnay/rust-toolchain@stable
55+
- uses: Swatinem/rust-cache@v2
56+
with:
57+
workspaces: src-tauri
58+
save-if: false
59+
- name: Rust 测试(含 bundled_config_loads)
60+
run: cargo test --manifest-path src-tauri/Cargo.toml -- --nocapture
61+
62+
- uses: actions/upload-artifact@v4
63+
if: always()
64+
with:
65+
name: smoke
66+
path: smoke/

0 commit comments

Comments
 (0)