From 9b4f091a537214b0d1c12e944243df7408aecf60 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Fri, 5 Jun 2026 21:24:24 +0200 Subject: [PATCH] fix(ci): install Swift on Windows with winget --- .github/workflows/ci.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50e56e7..4a54edc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,10 +52,27 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@v4 - - name: Setup Swift - uses: SwiftyLab/setup-swift@v1.12.0 - with: - swift-version: "6.3.1" + - name: Install Swift + shell: pwsh + run: | + $swift = Get-Command swift -ErrorAction SilentlyContinue + if (-not $swift) { + winget install --id Swift.Toolchain --exact --source winget --accept-source-agreements --accept-package-agreements --disable-interactivity + $roots = @( + "$env:ProgramFiles\Swift", + "${env:ProgramFiles(x86)}\Swift" + ) | Where-Object { $_ -and (Test-Path $_) } + $swift = $roots | + ForEach-Object { Get-ChildItem -Path $_ -Recurse -Filter swift.exe -ErrorAction SilentlyContinue } | + Select-Object -First 1 + if (-not $swift) { + throw "Swift executable not found after WinGet installation" + } + $bin = $swift.Directory.FullName + Add-Content -Path $env:GITHUB_PATH -Value $bin + $env:Path = "$bin;$env:Path" + } + swift --version - name: Build and test shell: pwsh run: ./scripts/check-windows.ps1