From 424c47be8207cf971804b8f94a8340075bb85162 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 1 Jul 2026 22:54:03 +0200 Subject: [PATCH] Use Xcode-bundled Swift in CI instead of a standalone toolchain The unpinned setup-swift action installs Swift 6.1, which refuses the SDK on runner images that have rolled to Xcode 26.5 ("this SDK is not supported by the compiler"). Jobs passed or failed depending on which image they landed on. The Xcode-bundled toolchain always matches the image's SDK, and matches local development. Cache keys now include the toolchain version so artifacts from one compiler are never restored into builds with another. Co-Authored-By: Claude Fable 5 --- .github/workflows/swift-tests.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/swift-tests.yml b/.github/workflows/swift-tests.yml index 479ec616..7e8c5b06 100644 --- a/.github/workflows/swift-tests.yml +++ b/.github/workflows/swift-tests.yml @@ -29,17 +29,22 @@ jobs: - name: Checkout code uses: actions/checkout@v5 - - name: Set up Swift - uses: swift-actions/setup-swift@v2 + # Use the Xcode-bundled Swift toolchain: it always matches the SDK on + # the runner image. A standalone swift.org toolchain (setup-swift) broke + # whenever the image's Xcode moved ahead of it ("this SDK is not + # supported by the compiler"). + - name: Note toolchain version (cache key) + id: swift-version + run: echo "version=$(swift --version 2>/dev/null | head -1 | shasum | cut -c1-12)" >> "$GITHUB_OUTPUT" - name: Cache build artifacts uses: actions/cache@v4 with: path: ${{ matrix.path }}/.build - key: ${{ runner.os }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/*.swift', matrix.path), format('{0}/**/Package.resolved', matrix.path)) }} + key: ${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/*.swift', matrix.path), format('{0}/**/Package.resolved', matrix.path)) }} restore-keys: | - ${{ runner.os }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/Package.resolved', matrix.path)) }} - ${{ runner.os }}-${{ matrix.name }}- + ${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/Package.resolved', matrix.path)) }} + ${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}- - name: Build tests # Built separately so the hang watchdog below times only test