Skip to content

Commit 3962b93

Browse files
Stabilize Windows installer CI
1 parent 2056a98 commit 3962b93

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

.github/workflows/installers.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ jobs:
9696
steps:
9797
- uses: actions/checkout@v4
9898

99+
- uses: actions/setup-python@v5
100+
with:
101+
python-version: '3.12'
102+
99103
- name: Build fixture release
100104
shell: pwsh
101105
run: |
@@ -123,13 +127,33 @@ jobs:
123127
$releaseDir = Join-Path $env:RUNNER_TEMP 'release'
124128
$stdout = Join-Path $env:RUNNER_TEMP 'install-http.log'
125129
$stderr = Join-Path $env:RUNNER_TEMP 'install-http.err'
126-
$server = Start-Process -FilePath python `
127-
-ArgumentList @('-m', 'http.server', '18082', '--directory', $releaseDir) `
130+
$python = (Get-Command python).Source
131+
$server = Start-Process -FilePath $python `
132+
-ArgumentList @('-m', 'http.server', '18082', '--bind', '127.0.0.1', '--directory', $releaseDir) `
128133
-PassThru `
129134
-RedirectStandardOutput $stdout `
130135
-RedirectStandardError $stderr
131136
$server.Id | Set-Content -Path (Join-Path $env:RUNNER_TEMP 'install-http.pid') -Encoding ascii
132-
Start-Sleep -Seconds 2
137+
138+
$ready = $false
139+
for ($attempt = 1; $attempt -le 15; $attempt++) {
140+
try {
141+
Invoke-WebRequest -Uri 'http://127.0.0.1:18082/latest/download/SHA256SUMS' -UseBasicParsing | Out-Null
142+
$ready = $true
143+
break
144+
} catch {
145+
if ($server.HasExited) {
146+
Get-Content -Path $stdout, $stderr -ErrorAction SilentlyContinue
147+
throw 'fixture HTTP server exited before it became ready'
148+
}
149+
Start-Sleep -Seconds 1
150+
}
151+
}
152+
153+
if (-not $ready) {
154+
Get-Content -Path $stdout, $stderr -ErrorAction SilentlyContinue
155+
throw 'fixture HTTP server did not become ready'
156+
}
133157
134158
- name: Install with verified checksum
135159
shell: pwsh

0 commit comments

Comments
 (0)