Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .github/workflows/scripts/windows/install-vsb.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,36 @@
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
##
##===----------------------------------------------------------------------===##

$VSB='https://download.visualstudio.microsoft.com/download/pr/5536698c-711c-4834-876f-2817d31a2ef2/c792bdb0fd46155de19955269cac85d52c4c63c23db2cf43d96b9390146f9390/vs_BuildTools.exe'
$VSB_SHA256='C792BDB0FD46155DE19955269CAC85D52C4C63C23DB2CF43D96B9390146F9390'
Set-Variable ErrorActionPreference Stop
Set-Variable ProgressPreference SilentlyContinue
Write-Host -NoNewLine ('Downloading {0} ... ' -f ${VSB})
Invoke-WebRequest -Uri $VSB -OutFile $env:TEMP\vs_buildtools.exe
Write-Host 'SUCCESS'
try {
# Use curl with retry logic (10 retries with exponential backoff starting at 1 second)
# --retry-all-errors ensures we retry on transfer failures (e.g., exit code 18)
# -C - enables resume for partial downloads
$exitCode = (Start-Process -FilePath "curl" -ArgumentList @(
"--retry", "10",
"--retry-delay", "1",
"--retry-all-errors",
"--retry-max-time", "300",
"--location",
"-C", "-",
"--output", "$env:TEMP\vs_buildtools.exe",
$VSB
) -Wait -PassThru -NoNewWindow).ExitCode

if ($exitCode -ne 0) {
throw "curl failed with exit code $exitCode"
}
Write-Host 'SUCCESS'
}
catch {
Write-Host "FAILED: $($_.Exception.Message)"
exit 1
}
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f $VSB_SHA256)
$Hash = Get-FileHash $env:TEMP\vs_buildtools.exe -Algorithm sha256
if ($Hash.Hash -eq $VSB_SHA256) {
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/scripts/windows/swift/install-swift.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
##
##===----------------------------------------------------------------------===##

function Install-Swift {
param (
[string]$Url,
Expand All @@ -17,8 +18,30 @@ function Install-Swift {
Set-Variable ErrorActionPreference Stop
Set-Variable ProgressPreference SilentlyContinue
Write-Host -NoNewLine ('Downloading {0} ... ' -f $url)
Invoke-WebRequest -Uri $url -OutFile installer.exe
Write-Host 'SUCCESS'
try {
# Use curl with retry logic (10 retries with exponential backoff starting at 1 second)
# --retry-all-errors ensures we retry on transfer failures (e.g., exit code 18)
# -C - enables resume for partial downloads
$exitCode = (Start-Process -FilePath "curl" -ArgumentList @(
"--retry", "10",
"--retry-delay", "1",
"--retry-all-errors",
"--retry-max-time", "300",
"--location",
"-C", "-",
"--output", "installer.exe",
$url
) -Wait -PassThru -NoNewWindow).ExitCode

if ($exitCode -ne 0) {
throw "curl failed with exit code $exitCode"
}
Write-Host 'SUCCESS'
}
catch {
Write-Host "FAILED: $($_.Exception.Message)"
exit 1
}
Write-Host -NoNewLine ('Verifying SHA256 ({0}) ... ' -f $Sha256)
$Hash = Get-FileHash installer.exe -Algorithm sha256
if ($Hash.Hash -eq $Sha256 -or $Sha256 -eq "") {
Expand Down