From 15293f6b4b07fa684700e69cc1d61320fe9cd10f Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 26 Jun 2026 00:21:10 +0200 Subject: [PATCH] Salt SwiftPM cache by toolchain --- .github/workflows/swift-tests.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/swift-tests.yml b/.github/workflows/swift-tests.yml index 479ec616..7c55c2cc 100644 --- a/.github/workflows/swift-tests.yml +++ b/.github/workflows/swift-tests.yml @@ -32,14 +32,24 @@ jobs: - name: Set up Swift uses: swift-actions/setup-swift@v2 + - name: Compute Swift cache salt + id: swift_cache_salt + run: | + { + swift --version + xcrun --show-sdk-platform-path + xcrun --show-sdk-version + xcodebuild -version + } | shasum -a 256 | awk '{ print "value=" $1 }' >> "$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 }}-${{ runner.arch }}-${{ matrix.name }}-${{ steps.swift_cache_salt.outputs.value }}-${{ 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 }}-${{ runner.arch }}-${{ matrix.name }}-${{ steps.swift_cache_salt.outputs.value }}-${{ hashFiles(format('{0}/**/Package.resolved', matrix.path)) }} + ${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ steps.swift_cache_salt.outputs.value }}- - name: Build tests # Built separately so the hang watchdog below times only test