From 969791d03857952f4d477a47c0f850159b9df17e Mon Sep 17 00:00:00 2001 From: Tarun Kumar Date: Thu, 13 Feb 2025 21:50:00 +0530 Subject: [PATCH] here goes nothing --- .github/workflows/testdriver.yml | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/testdriver.yml b/.github/workflows/testdriver.yml index af6ac37..329cc18 100644 --- a/.github/workflows/testdriver.yml +++ b/.github/workflows/testdriver.yml @@ -19,23 +19,31 @@ jobs: prerun: | npm install npm install dashcam-chrome - node scripts/generate-env.mjs - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - npm run build -- --filter='!@mainframe-api/docs' --ui=stream --output-logs=errors-only - npm run db:migrate - $logPath = ".\logs.txt" Start-Job -ScriptBlock { - npx turbo run "@mainframe-api/node#serve" dev --env-mode=loose --filter='!@mainframe-api/node' --filter='!@mainframe-api/docs' --ui=tui - } >> $logPath + echo "starting npm server" + npm start + } echo "waiting for port to be live" - # Wait for the port to be live by monitoring the output logs $portLive = $false + $targetUrl = "${{ env.LOCALHOST }}" + Write-Output "Beginning port checks for $targetUrl" while (-not $portLive) { - Start-Sleep -Seconds 1 - if (Select-String -Path $logPath -Pattern "Local: http://localhost:8744/") { - $portLive = $true - echo "Port is live" + try { + $response = Invoke-WebRequest -Uri $targetUrl -Method Head -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop + if ($response.StatusCode -eq 200) { + $portLive = $true + Write-Output "Port is live (HTTP 200)" + } + } + catch [Microsoft.PowerShell.Commands.HttpResponseException] { + if ($_.Exception.Response.StatusCode -eq 404) { + $portLive = $true + Write-Output "Server responded with 404 - assuming valid response" + } + } + catch { + Start-Sleep -Seconds 1 } } echo "starting chrome"