Skip to content

Commit bfb64e4

Browse files
committed
ci: winget with explicit location for Windows spike
1 parent 6378be2 commit bfb64e4

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎.github/workflows/windows-spike.yml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ jobs:
2121
- name: Install Swift toolchain
2222
shell: pwsh
2323
run: |
24-
$url = 'https://download.swift.org/swift-6.3.3-release/windows10/swift-6.3.3-RELEASE/swift-6.3.3-RELEASE-windows10.exe'
25-
Invoke-WebRequest $url -OutFile swift-installer.exe
26-
Start-Process .\swift-installer.exe -ArgumentList '/VERYSILENT','/SUPPRESSMSGBOXES','/DIR=C:\Swift' -Wait
24+
winget install --id Swift.Toolchain -e --source winget --location 'C:\Swift' `
25+
--accept-source-agreements --accept-package-agreements --disable-interactivity
2726
if (-not (Test-Path 'C:\Swift\bin\swift.exe')) {
28-
Get-ChildItem 'C:\Swift' -Recurse -Filter '*.exe' -ErrorAction SilentlyContinue |
29-
Select-Object -First 20 -ExpandProperty FullName
30-
throw 'swift.exe not at C:\Swift\bin after silent install'
27+
Write-Host '--- searching for swift.exe ---'
28+
foreach ($root in @('C:\Swift', (Join-Path $env:LOCALAPPDATA 'Programs'), 'C:\Program Files')) {
29+
Get-ChildItem $root -Recurse -Filter 'swift.exe' -ErrorAction SilentlyContinue -Depth 4 |
30+
Select-Object -First 5 -ExpandProperty FullName
31+
}
32+
throw 'swift.exe not found after winget install'
3133
}
3234
Add-Content $env:GITHUB_PATH 'C:\Swift\bin'
3335
Add-Content $env:GITHUB_PATH 'C:\Swift\usr\bin'

0 commit comments

Comments
 (0)