ci: faster SDK download, supersede stale runs
Some checks failed
CI / Windows build (push) Has been cancelled
Some checks failed
CI / Windows build (push) Has been cancelled
Run 9's Invoke-WebRequest download of the ~1GB SDK was very slow. Use curl.exe (bundled on Windows 10+) which streams to disk, with an IWR fallback. Add a concurrency group so a new push cancels an in-progress run instead of queuing behind it.
This commit is contained in:
@@ -8,6 +8,12 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Supersede an in-progress run when a new commit is pushed (so a slow run does
|
||||||
|
# not block the next iteration). Ignored by older Gitea, harmless if so.
|
||||||
|
concurrency:
|
||||||
|
group: windows-ci
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
# Targets a self-hosted Windows runner inside mainland China. See README
|
# Targets a self-hosted Windows runner inside mainland China. See README
|
||||||
# "Continuous integration" for runner prerequisites. Key points:
|
# "Continuous integration" for runner prerequisites. Key points:
|
||||||
# * github.com is unreachable here, so the checkout action is pulled from the
|
# * github.com is unreachable here, so the checkout action is pulled from the
|
||||||
@@ -66,9 +72,19 @@ jobs:
|
|||||||
New-Item -ItemType Directory -Force -Path $root | Out-Null
|
New-Item -ItemType Directory -Force -Path $root | Out-Null
|
||||||
Write-Host "Downloading Flutter SDK from $url"
|
Write-Host "Downloading Flutter SDK from $url"
|
||||||
$ok = $false
|
$ok = $false
|
||||||
for ($i = 1; $i -le 3 -and -not $ok; $i++) {
|
# curl.exe (bundled on Windows 10+) streams to disk and is far
|
||||||
try { Invoke-WebRequest -Uri $url -OutFile $zip -UseBasicParsing; $ok = $true }
|
# faster than Invoke-WebRequest for a ~1GB file. Fall back to IWR.
|
||||||
catch { Write-Host "download attempt $i failed: $_"; Start-Sleep 5 }
|
$curl = "$env:SystemRoot\System32\curl.exe"
|
||||||
|
if (Test-Path $curl) {
|
||||||
|
& $curl -L --fail --retry 3 --retry-delay 5 -o $zip $url
|
||||||
|
if ($LASTEXITCODE -eq 0 -and (Test-Path $zip)) { $ok = $true }
|
||||||
|
else { Write-Host "curl download failed (exit $LASTEXITCODE), falling back" }
|
||||||
|
}
|
||||||
|
if (-not $ok) {
|
||||||
|
for ($i = 1; $i -le 3 -and -not $ok; $i++) {
|
||||||
|
try { Invoke-WebRequest -Uri $url -OutFile $zip -UseBasicParsing; $ok = $true }
|
||||||
|
catch { Write-Host "IWR attempt $i failed: $_"; Start-Sleep 5 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (-not $ok) { Write-Error "Failed to download Flutter SDK"; exit 1 }
|
if (-not $ok) { Write-Error "Failed to download Flutter SDK"; exit 1 }
|
||||||
Write-Host "Extracting to $root (this is slow on first run)"
|
Write-Host "Extracting to $root (this is slow on first run)"
|
||||||
|
|||||||
Reference in New Issue
Block a user