|
96 | 96 | steps: |
97 | 97 | - uses: actions/checkout@v4 |
98 | 98 |
|
| 99 | + - uses: actions/setup-python@v5 |
| 100 | + with: |
| 101 | + python-version: '3.12' |
| 102 | + |
99 | 103 | - name: Build fixture release |
100 | 104 | shell: pwsh |
101 | 105 | run: | |
@@ -123,13 +127,33 @@ jobs: |
123 | 127 | $releaseDir = Join-Path $env:RUNNER_TEMP 'release' |
124 | 128 | $stdout = Join-Path $env:RUNNER_TEMP 'install-http.log' |
125 | 129 | $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) ` |
128 | 133 | -PassThru ` |
129 | 134 | -RedirectStandardOutput $stdout ` |
130 | 135 | -RedirectStandardError $stderr |
131 | 136 | $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 | + } |
133 | 157 |
|
134 | 158 | - name: Install with verified checksum |
135 | 159 | shell: pwsh |
|
0 commit comments