Test #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| run: | |
| runs-on: windows-latest | |
| timeout-minutes: 80 | |
| steps: | |
| # ------------------------------------------------- | |
| - name: 1. 拉取仓库 | |
| uses: actions/checkout@v4 | |
| # ------------------------------------------------- | |
| - name: 2. 运行 CLI(强检路径 + 验证输出) | |
| id: run_exe | |
| shell: pwsh | |
| timeout-minutes: 70 | |
| run: | | |
| # --- 明确 EXE 完整路径(基于 workspace) --- | |
| $exeDir = Join-Path $env:GITHUB_WORKSPACE "HiddifyConfigsCLI/bin/Debug/net9.0" | |
| $exe = Join-Path $exeDir "HiddifyConfigsCLI.exe" | |
| Write-Host "预期 EXE Dir = $exeDir" | |
| Write-Host "预期 EXE Path = $exe" | |
| if (!(Test-Path $exe)) { | |
| Write-Error "EXE 不存在: $exe" | |
| exit 1 | |
| } | |
| # 输入 URL(可按需替换) | |
| $input = "https://raw.githubusercontent.com/shinexus/LearnToProgram/refs/heads/master/HiddifyConfigsCLI/config/test_url.txt" | |
| # 输出 绝对路径 | |
| $outputFile = Join-Path $exeDir "_test.txt" | |
| # 参数数组 | |
| $params = @( | |
| "--input", $input, | |
| "--output", $outputFile, | |
| "--max-lines", "100", | |
| "--max-parts", "2", | |
| "--timeout", "6", | |
| "--parallel", "128", | |
| "--http-timeout", "5" | |
| "--verbose" | |
| ) | |
| # --- 用 Start-Process 确保 WorkingDirectory 不被重置,拿到进程对象以读取 ExitCode --- | |
| Write-Host "使用 Start-Process 启动 EXE..." | |
| $proc = Start-Process -FilePath $exe -WorkingDirectory $exeDir -ArgumentList $params -Wait -NoNewWindow -PassThru | |
| Write-Host "Start-Process 返回 ExitCode: $($proc.ExitCode)" | |
| if ($proc.ExitCode -ne 0) { | |
| Write-Error "CLI 退出码非0: $($proc.ExitCode)" | |
| exit $proc.ExitCode | |
| } | |
| Write-Host "Step 2 完成" |