Skip to content

Commit 2a82af4

Browse files
jrrayclaude
andcommitted
Verify and retry Windows CI choco installs
The Chocolatey CDN can return transient errors (e.g. 504 Gateway Timeout) for individual packages, causing the install step to partially succeed without failing the CI job. This leads to confusing build failures later (e.g. winfsp-sys panic: "WinFsp installation directory not found"). Add a step that verifies all required packages are present and retries installing any missing ones. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: J Robert Ray <jrray@jrray.org>
1 parent e352f40 commit 2a82af4

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/rust.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,56 @@ jobs:
2323
uses: crazy-max/ghaction-chocolatey@v3
2424
with:
2525
args: install protoc llvm winfsp make
26+
- name: Verify Chocolatey packages and retry if needed
27+
# The chocolatey install step can partially succeed: if the
28+
# Chocolatey CDN returns a transient error (e.g. 504 Gateway
29+
# Timeout) for one package, other packages may still install
30+
# fine and the step exits successfully. This leaves the build
31+
# missing critical dependencies, causing confusing failures
32+
# later (e.g. winfsp-sys build.rs panic). This step verifies
33+
# that all required packages are actually present and retries
34+
# any that are missing.
35+
shell: pwsh
36+
run: |
37+
function Test-Packages {
38+
$missing = @()
39+
if (-not (Test-Path "C:\Program Files (x86)\WinFsp")) {
40+
$missing += "winfsp"
41+
}
42+
if (-not (Get-Command protoc -ErrorAction SilentlyContinue)) {
43+
$missing += "protoc"
44+
}
45+
if (-not (Get-Command make -ErrorAction SilentlyContinue)) {
46+
$missing += "make"
47+
}
48+
if (-not (Get-Command clang -ErrorAction SilentlyContinue)) {
49+
$missing += "llvm"
50+
}
51+
return $missing
52+
}
53+
54+
$missing = Test-Packages
55+
if ($missing.Count -eq 0) {
56+
Write-Host "All required packages verified successfully."
57+
exit 0
58+
}
59+
60+
$maxRetries = 2
61+
for ($attempt = 1; $attempt -le $maxRetries; $attempt++) {
62+
Write-Host "::warning::Missing packages: $($missing -join ', '). Retry attempt $attempt of $maxRetries..."
63+
Start-Sleep -Seconds 15
64+
choco install $missing -y --allow-unofficial
65+
$missing = Test-Packages
66+
if ($missing.Count -eq 0) {
67+
Write-Host "All required packages verified successfully after retry."
68+
exit 0
69+
}
70+
}
71+
72+
foreach ($pkg in $missing) {
73+
Write-Host "::error::Required package not installed after retries: $pkg"
74+
}
75+
exit 1
2676
- name: Install FlatBuffers Compiler
2777
run: |
2878
$url = "https://github.com/google/flatbuffers/releases/download/v23.5.26/Windows.flatc.binary.zip"

0 commit comments

Comments
 (0)