Skip to content

Commit 6378be2

Browse files
committed
ci: use official Swift installer with explicit dir in Windows spike
1 parent b620410 commit 6378be2

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

.github/workflows/windows-spike.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,16 @@ jobs:
2121
- name: Install Swift toolchain
2222
shell: pwsh
2323
run: |
24-
winget install --id Swift.Toolchain -e --source winget `
25-
--accept-source-agreements --accept-package-agreements
26-
$candidates = @(
27-
(Join-Path $env:LOCALAPPDATA 'Programs\Swift\bin'),
28-
'C:\Swift\bin',
29-
(Join-Path $env:LOCALAPPDATA 'Microsoft\WinGet\Packages')
30-
)
31-
$swiftBin = $null
32-
foreach ($c in $candidates) {
33-
if (Test-Path (Join-Path $c 'swift.exe')) { $swiftBin = $c; break }
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
27+
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'
3431
}
35-
if (-not $swiftBin) {
36-
$found = Get-ChildItem $env:LOCALAPPDATA,'C:\' -Recurse -Filter 'swift.exe' `
37-
-ErrorAction SilentlyContinue -Depth 5 | Select-Object -First 1
38-
if ($found) { $swiftBin = $found.DirectoryName }
39-
}
40-
if (-not $swiftBin) { throw 'swift.exe not found after winget install' }
41-
Write-Host "Found swift at: $swiftBin"
42-
Add-Content $env:GITHUB_PATH $swiftBin
32+
Add-Content $env:GITHUB_PATH 'C:\Swift\bin'
33+
Add-Content $env:GITHUB_PATH 'C:\Swift\usr\bin'
4334
4435
- name: Set up MSVC environment
4536
uses: ilammy/msvc-dev-cmd@v1

0 commit comments

Comments
 (0)