Cache CI test run compilations

This commit is contained in:
Stefan Ceriu
2026-08-18 12:50:32 +03:00
parent 5f49c25952
commit 771d10ac6b
3 changed files with 36 additions and 0 deletions
@@ -34,12 +34,27 @@ jobs:
- name: Setup environment
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
- name: Restore compilation cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/Library/Developer/Xcode/CompilationCache.noindex
key: compilation-cache-unit-tests-enterprise-${{ github.sha }}
restore-keys: compilation-cache-unit-tests-enterprise-
- name: Configure Enterprise
run: swift run -q pipeline configure-element-pro
- name: Run tests
run: swift run -q tools ci unit-tests --skip-previews
- name: Save compilation cache
# Only develop populates the cache, all of the other runs simply read from it.
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/Library/Developer/Xcode/CompilationCache.noindex
key: compilation-cache-unit-tests-enterprise-${{ github.sha }}
- name: Archive artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# We only care about artefacts if the tests fail
+15
View File
@@ -29,9 +29,24 @@ jobs:
- name: Setup environment
run: source ci_scripts/ci_common.sh && setup_github_actions_environment
- name: Restore compilation cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/Library/Developer/Xcode/CompilationCache.noindex
key: compilation-cache-unit-tests-${{ github.sha }}
restore-keys: compilation-cache-unit-tests-
- name: Run tests
run: swift run -q tools ci unit-tests
- name: Save compilation cache
# Only develop populates the cache, all of the other runs simply read from it.
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/Library/Developer/Xcode/CompilationCache.noindex
key: compilation-cache-unit-tests-${{ github.sha }}
- name: Archive artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# We only care about artefacts if the tests fail
+6
View File
@@ -139,6 +139,12 @@ struct RunTests: AsyncParsableCommand {
command += " -destination 'platform=iOS Simulator,name=\(device),OS=\(osVersion),arch=arm64'"
command += " -resultBundlePath \(resultBundlePath)"
// Use a dedicated compilation cache for incremental builds on CI (as Xcode's DerivedData
// is invalidated by a fresh checkout).
command += " COMPILATION_CACHE_ENABLE_CACHING=YES"
// Store it outside DerivedData so CI can cache just what it needs.
command += " COMPILATION_CACHE_CAS_PATH=$HOME/Library/Developer/Xcode/CompilationCache.noindex"
// Use xcodebuild's native retry support to re-run only failing tests
// instead of re-running the entire suite. retries=0 means no retries (single run).
if retries > 0 {