Skip to content

Commit 8f3cd8b

Browse files
authored
chore: retry wasi-sdk download in CI (#3151)
1 parent fc557e4 commit 8f3cd8b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,27 @@ jobs:
129129
shell: pwsh
130130
if: runner.os == 'Windows'
131131
run: |
132-
Start-BitsTransfer -Source https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${env:WASI_VERSION}/wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz
132+
$MaxRetries = 3
133+
$RetryDelay = 10
134+
$Attempt = 0
135+
while ($Attempt -lt $MaxRetries) {
136+
try {
137+
Start-BitsTransfer -Source https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${env:WASI_VERSION}/wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz
138+
break
139+
}
140+
catch {
141+
Write-Host "Error: $($_.Exception.Message)"
142+
$Attempt++
143+
if ($Attempt -lt $MaxRetries) {
144+
Write-Host "Retrying in $RetryDelay seconds"
145+
Start-Sleep -Seconds $RetryDelay
146+
}
147+
else {
148+
Write-Host "Max retries reached. Download failed."
149+
exit 1
150+
}
151+
}
152+
}
133153
New-Item -ItemType Directory -Path ${env:WASI_SDK_PATH}
134154
tar -zxvf wasi-sdk-${env:WASI_VERSION_FULL}-x86_64-windows.tar.gz -C ${env:WASI_SDK_PATH} --strip 1
135155
- name: Install Dependencies

0 commit comments

Comments
 (0)