|
| 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 | + run: | |
| 16 | + $rel = Invoke-RestMethod https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest |
| 17 | + $asset = $rel.assets | Where-Object name -match '^mpv-x86_64-v3-\d{8}-git-.*\.7z$' | Select-Object -First 1 |
| 18 | + if (-not $asset) { throw '没找到 mpv 构建' } |
| 19 | + Write-Host "mpv: $($asset.name)" |
| 20 | + Invoke-WebRequest $asset.browser_download_url -OutFile mpv.7z |
| 21 | + 7z e mpv.7z mpv.exe -osrc-tauri/mpv -y |
| 22 | +
|
| 23 | + - name: 直接跑 mpv:配置目录带 \\?\ 前缀 vs 去掉前缀 |
| 24 | + shell: pwsh |
| 25 | + timeout-minutes: 3 |
| 26 | + run: | |
| 27 | + $dir = (Resolve-Path src-tauri/mpv).Path |
| 28 | + $log = Join-Path $PWD 'mpv-check.log' |
| 29 | + foreach ($cd in @("\\?\$dir", $dir)) { |
| 30 | + Remove-Item $log -ErrorAction SilentlyContinue |
| 31 | + $p = Start-Process -FilePath "$dir\mpv.exe" -Wait -PassThru -ArgumentList @( |
| 32 | + "--config-dir=$cd", "--log-file=$log", '--vo=null', '--ao=null', '--force-window=no', '--idle=no', |
| 33 | + 'av://lavfi:testsrc=duration=1') |
| 34 | + $t = Get-Content $log -Raw |
| 35 | + 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')" |
| 36 | + } |
| 37 | +
|
| 38 | + - name: mpv 实际渲染截图(ModernZ、选集菜单;无显卡时走 WARP) |
| 39 | + shell: pwsh |
| 40 | + continue-on-error: true # 只为留证据,runner 没有桌面时不影响出包 |
| 41 | + timeout-minutes: 3 |
| 42 | + run: | |
| 43 | + $env:SHOT_DIR = Join-Path $PWD 'smoke'; New-Item -ItemType Directory -Force $env:SHOT_DIR | Out-Null |
| 44 | + $p = Start-Process -FilePath "$PWD\src-tauri\mpv\mpv.exe" -PassThru -ArgumentList @( |
| 45 | + "--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', |
| 46 | + "--log-file=$env:SHOT_DIR\mpv-render.log", '--force-media-title="浴血黑帮 S01E01 测试"', 'av://lavfi:testsrc2=duration=60:size=1920x1080') |
| 47 | + if (-not $p.WaitForExit(60000)) { Stop-Process $p.Id; Write-Host 'mpv 60 秒没退出(截图脚本没跑完),已结束' } |
| 48 | + else { Write-Host "mpv 退出码 $($p.ExitCode)" } |
| 49 | + Select-String -Path "$env:SHOT_DIR\mpv-render.log" -Pattern '\]\[e\]\[|d3d11|Using hardware|VO:' | ForEach-Object Line |
| 50 | + - uses: dtolnay/rust-toolchain@stable |
| 51 | + - uses: Swatinem/rust-cache@v2 |
| 52 | + with: |
| 53 | + workspaces: src-tauri |
| 54 | + save-if: false |
| 55 | + - name: Rust 测试(含 bundled_config_loads) |
| 56 | + run: cargo test --manifest-path src-tauri/Cargo.toml -- --nocapture |
| 57 | + |
| 58 | + - uses: actions/upload-artifact@v4 |
| 59 | + if: always() |
| 60 | + with: |
| 61 | + name: smoke |
| 62 | + path: smoke/ |
0 commit comments