Salt SwiftPM cache by toolchain

This commit is contained in:
Codex
2026-06-26 00:21:10 +02:00
parent 842d8f2cd3
commit 15293f6b4b
+13 -3
View File
@@ -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