Skip to content

Commit 7a8e0be

Browse files
committed
ci(windows): launch uvicorn directly for the /api/health smoke
Start-Process spawning a child pwsh to run run.ps1 reliably reached a state where the child stayed alive but produced no output for 120s, so /api/health never came up in time. The wrapper itself is already covered by: - the install.ps1 -NoLaunch step (preflight + venv) - the run.ps1 -NoLaunch step (preflight only) Launching the venv's uvicorn.exe directly here keeps the smoke focused on "the venv install.ps1 built actually serves" and avoids the nested pwsh stdio quirk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 77b588b commit 7a8e0be

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,25 @@ jobs:
217217
TUTOR_SKIP_OLLAMA: "1"
218218
run: |
219219
$ErrorActionPreference = 'Stop'
220-
$outLog = Join-Path $env:RUNNER_TEMP 'run-ps1-smoke.out.log'
221-
$errLog = Join-Path $env:RUNNER_TEMP 'run-ps1-smoke.err.log'
220+
# Launch uvicorn directly from the just-built venv. This is what
221+
# run.ps1 ends up doing; bypassing the wrapper here keeps the smoke
222+
# focused on the server actually serving, and avoids Start-Process
223+
# quirks around -File / argument forwarding in nested pwsh.
224+
$uv = Join-Path (Get-Location) 'backend\.venv\Scripts\uvicorn.exe'
225+
if (-not (Test-Path $uv)) { throw "missing $uv" }
226+
$env:TUTOR_SERVE_FRONTEND = '1'
227+
$outLog = Join-Path $env:RUNNER_TEMP 'uvicorn-smoke.out.log'
228+
$errLog = Join-Path $env:RUNNER_TEMP 'uvicorn-smoke.err.log'
222229
New-Item -ItemType File -Force -Path $outLog | Out-Null
223230
New-Item -ItemType File -Force -Path $errLog | Out-Null
224-
# Launch run.ps1 in a detached pwsh so the parent job can poll
225-
# /api/health without waiting on Start-Job module init.
226-
$procArgs = @(
227-
'-NoProfile','-NoLogo','-File','run.ps1',
228-
'-SkipOllama','-Port','8802'
229-
)
230-
$proc = Start-Process -FilePath 'pwsh' -ArgumentList $procArgs `
231+
$proc = Start-Process -FilePath $uv `
232+
-ArgumentList @('app.main:app','--host','127.0.0.1','--port','8802') `
233+
-WorkingDirectory (Join-Path (Get-Location) 'backend') `
231234
-RedirectStandardOutput $outLog -RedirectStandardError $errLog `
232-
-PassThru -WorkingDirectory (Get-Location).Path
235+
-PassThru
233236
try {
234237
$ok = $false
235-
for ($i = 0; $i -lt 120; $i++) {
238+
for ($i = 0; $i -lt 60; $i++) {
236239
Start-Sleep -Seconds 1
237240
try {
238241
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8802/api/health' `
@@ -242,11 +245,11 @@ jobs:
242245
if ($proc.HasExited) { break }
243246
}
244247
if (-not $ok) {
245-
Write-Host '--- run.ps1 stdout ---'
248+
Write-Host '--- uvicorn stdout ---'
246249
if (Test-Path $outLog) { Get-Content -LiteralPath $outLog }
247-
Write-Host '--- run.ps1 stderr ---'
250+
Write-Host '--- uvicorn stderr ---'
248251
if (Test-Path $errLog) { Get-Content -LiteralPath $errLog }
249-
throw "/api/health did not return 200 within 120s (proc exited=$($proc.HasExited))"
252+
throw "/api/health did not return 200 within 60s (proc exited=$($proc.HasExited))"
250253
}
251254
Write-Host 'ok /api/health -> 200'
252255
} finally {

0 commit comments

Comments
 (0)