Skip to content

Commit 9147b7b

Browse files
authored
CI Work-around for Docker on Windows error (#4)
1 parent 65393af commit 9147b7b

2 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,13 @@ jobs:
182182
output-dir: dist
183183
config-file: cibuildwheel.toml
184184

185-
# Running in a minimal Docker image makes sure that we bundled correctly
186-
# the shared libraries for MSVC C++ runtime and OpenMP in the Windows
187-
# wheel
188185
- name: Test Windows wheel in a minimal Docker image
189186
# Currently Windows ARM64 runners do not have Docker support and there
190187
# is no Docker image with free-threaded
191188
if: ${{ matrix.platform_id == 'win_amd64' && !contains(matrix.python, 't') }}
192-
run: bash tools/test_windows_wheels_in_docker.sh ${{ matrix.python }}
189+
run: |
190+
pwsh tools/wait-for-docker-windows.ps1
191+
bash tools/test_windows_wheels_in_docker.sh ${{ matrix.python }}
193192
194193
- name: Store artifacts
195194
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

tools/wait-for-docker-windows.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env pwsh
2+
3+
# Script to wait for Docker to be ready taken from https://github.com/spiffe/spire project
4+
5+
Write-Host "Waiting for Docker to be ready..."
6+
7+
for ($i = 1; $i -le 60; $i++) {
8+
# Check if Docker is ready
9+
$output = docker info 2>&1
10+
if ($LASTEXITCODE -eq 0) {
11+
Write-Host "Docker is ready!"
12+
exit 0
13+
}
14+
15+
# On first attempt, list and start Docker services
16+
if ($i -eq 1) {
17+
Write-Host "Docker not ready. Checking for Docker services..."
18+
$dockerServices = Get-Service | Where-Object { $_.Name -like '*docker*' -or $_.DisplayName -like '*docker*' }
19+
20+
if ($dockerServices) {
21+
Write-Host "Available Docker services:"
22+
$dockerServices | Format-Table Name, Status, DisplayName -AutoSize
23+
24+
# Start any stopped Docker services
25+
$dockerServices | Where-Object { $_.Status -ne 'Running' } | ForEach-Object {
26+
Write-Host "Starting service: $($_.Name)"
27+
Start-Service $_.Name -ErrorAction SilentlyContinue
28+
}
29+
} else {
30+
Write-Error "No Docker services found. Please ensure Docker is installed and configured correctly."
31+
exit 1
32+
}
33+
}
34+
35+
# Show progress (detailed every 10 attempts)
36+
if ($i % 10 -eq 0) {
37+
Write-Host "Attempt $i/60 - Still waiting... Error: $output"
38+
} else {
39+
Write-Host "Attempt $i/60"
40+
}
41+
Start-Sleep -Seconds 2
42+
}
43+
44+
Write-Error "Docker failed to start after 60 attempts"
45+
exit 1

0 commit comments

Comments
 (0)