Skip to content

Commit 22a0fa2

Browse files
committed
fix(ci): isolate native Swift test build caches
1 parent 0560a99 commit 22a0fa2

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,9 +3838,10 @@ jobs:
38383838
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
38393839
with:
38403840
path: apps/macos/.build
3841-
key: ${{ runner.os }}-swift-build-v3-${{ steps.swift-toolchain.outputs.key }}-${{ hashFiles('apps/macos/Package.swift', 'apps/macos/Package.resolved', 'apps/macos/Sources/**', 'apps/macos/Tests/**', 'apps/shared/OpenClawKit/Package.swift', 'apps/shared/OpenClawKit/Sources/**', 'apps/swabble/Package.swift', 'apps/swabble/Sources/**') }}
3841+
# Exact hits are immutable; exclude pre-native products from both restore paths.
3842+
key: ${{ runner.os }}-swift-build-v4-native-tests-${{ steps.swift-toolchain.outputs.key }}-${{ hashFiles('apps/macos/Package.swift', 'apps/macos/Package.resolved', 'apps/macos/Sources/**', 'apps/macos/Tests/**', 'apps/shared/OpenClawKit/Package.swift', 'apps/shared/OpenClawKit/Sources/**', 'apps/swabble/Package.swift', 'apps/swabble/Sources/**') }}
38423843
restore-keys: |
3843-
${{ runner.os }}-swift-build-v3-${{ steps.swift-toolchain.outputs.key }}-
3844+
${{ runner.os }}-swift-build-v4-native-tests-${{ steps.swift-toolchain.outputs.key }}-
38443845
38453846
- name: Validate Swift build cache
38463847
id: validate-swift-build-cache

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6654,7 +6654,16 @@ exit 1
66546654
const renderStep = macosSwift.steps.find(
66556655
(step: WorkflowStep) => step.name === "Render isolated macOS health fixtures",
66566656
);
6657+
const buildCache = macosSwift.steps.find(
6658+
(step: WorkflowStep) => step.id === "swift-build-cache",
6659+
);
6660+
const nativeCachePrefix =
6661+
"${{ runner.os }}-swift-build-v4-native-tests-${{ steps.swift-toolchain.outputs.key }}-";
66576662

6663+
expect(buildCache.with).toMatchObject({
6664+
key: expect.stringContaining(nativeCachePrefix),
6665+
"restore-keys": `${nativeCachePrefix}\n`,
6666+
});
66586667
expect(macosSwift.env.SWIFT_TEST_EXECUTION).toBe(
66596668
"${{ (github.event_name == 'workflow_dispatch' || github.run_attempt > 1) && 'serial' || 'parallel' }}",
66606669
);

0 commit comments

Comments
 (0)