Repository navigation
ci: seed the Debug compilation cache from main for compile admission #13060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
austinywang
merged 9 commits into
manaflow-ai:main
from
teamleaderleo:task-ci-seed-build-caches-from-main
Sep 20, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bb74e77
ci: seed the Debug compilation cache from main for compile admission
teamleaderleo 89185e9
chore: shorten the cache seeding comments
teamleaderleo 42eb8ca
test: cache seeder must retry package resolution until the binary art…
teamleaderleo 909916a
ci: resolve packages for the cache seeder the way admission does
teamleaderleo b264887
ci: retry package resolution without a fixed delay
teamleaderleo f152f83
Merge remote-tracking branch 'origin/main' into task-ci-seed-build-ca…
teamleaderleo b635341
Merge remote-tracking branch 'origin/main' into task-ci-seed-build-ca…
teamleaderleo e01aafe
test: a failed package resolve must not leave a partial clone for the…
teamleaderleo bb51604
ci: clear the package directory before every resolve retry
teamleaderleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| #!/usr/bin/env bash | ||
| # compile-app-host-test-product.sh fingerprint <derived-data> | ||
| # compile-app-host-test-product.sh resolve <derived-data> <source-packages> | ||
| # compile-app-host-test-product.sh build <derived-data> <source-packages> <cas-path> [log] | ||
| # | ||
| # Compiles the app-host test product with Xcode's compilation cache on. ci.yml | ||
| # `macos-compile-admission` restores that cache read-only and nightly.yml | ||
| # `refresh-test-compilation-cache` writes it. A cache entry is keyed on the | ||
| # whole compiler invocation and on absolute paths, so both jobs must build | ||
| # through this script or they stop sharing hits without anything failing. | ||
| # | ||
| # `fingerprint` hashes the toolchain and the build paths into the cache key. | ||
| # Runner pools lay the workspace out differently, and a seed built under | ||
| # another layout cannot hit, so it should be a cache miss and not a download. | ||
| set -euo pipefail | ||
|
|
||
| usage() { | ||
| echo "usage: $0 fingerprint <derived-data>" >&2 | ||
| echo " $0 resolve <derived-data> <source-packages>" >&2 | ||
| echo " $0 build <derived-data> <source-packages> <cas-path> [log]" >&2 | ||
| exit 64 | ||
| } | ||
|
|
||
| # Same limit as the Release seed in nightly.yml. | ||
| cache_limit_bytes=3221225472 | ||
|
|
||
| fingerprint() { | ||
| local derived_data="$1" | ||
| { | ||
| xcodebuild -version | ||
| printf 'workspace=%s\n' "$PWD" | ||
| printf 'derived-data=%s\n' "$derived_data" | ||
| } | shasum -a 256 | cut -c1-32 | ||
| } | ||
|
|
||
| # `build` disables package resolution, so a resolve that reports success | ||
| # without the Sparkle and Sentry binary artifacts would fail it. A restored | ||
| # source-packages cache can do that, and a failed resolve can leave a partial | ||
| # clone behind, so every retry starts from an empty package directory. | ||
| resolve() { | ||
| local derived_data="$1" source_packages="$2" attempt | ||
| for attempt in 1 2 3; do | ||
| mkdir -p "$source_packages" "$derived_data" | ||
| if xcodebuild -project cmux.xcodeproj -scheme cmux-unit -configuration Debug \ | ||
| -derivedDataPath "$derived_data" \ | ||
| -clonedSourcePackagesDirPath "$source_packages" \ | ||
| -resolvePackageDependencies; then | ||
| if [ -d "$source_packages/artifacts/sparkle/Sparkle/Sparkle.xcframework" ] \ | ||
| && [ -d "$source_packages/artifacts/sentry-cocoa/Sentry/Sentry.xcframework" ]; then | ||
| return 0 | ||
| fi | ||
| echo "Resolve succeeded but binary artifacts are missing" >&2 | ||
| fi | ||
|
teamleaderleo marked this conversation as resolved.
|
||
| [ "$attempt" -lt 3 ] || break | ||
| echo "Package resolution failed on attempt $attempt; clearing packages and retrying" >&2 | ||
| rm -rf "$source_packages" | ||
| done | ||
| echo "Failed to resolve Swift packages after 3 attempts" >&2 | ||
| return 1 | ||
| } | ||
|
teamleaderleo marked this conversation as resolved.
|
||
|
|
||
| build() { | ||
| local derived_data="$1" source_packages="$2" cas_path="$3" log="${4:-/dev/null}" | ||
| mkdir -p "$cas_path" | ||
|
|
||
| # shellcheck disable=SC2016 # Xcode expands $(inherited), not the shell | ||
| for scheme in cmux-unit cmux-numeric-locale; do | ||
| xcodebuild -project cmux.xcodeproj -scheme "$scheme" -configuration Debug \ | ||
| -derivedDataPath "$derived_data" \ | ||
| -clonedSourcePackagesDirPath "$source_packages" \ | ||
| -disableAutomaticPackageResolution \ | ||
| -destination "platform=macOS" \ | ||
| 'SWIFT_ACTIVE_COMPILATION_CONDITIONS=$(inherited) CMUX_CI_APP_HOST_ISOLATION_REQUIRED' \ | ||
| 'LD_RUNPATH_SEARCH_PATHS=$(inherited) @executable_path/../Frameworks /private/tmp/cmux-app-host-package-frameworks' \ | ||
| COMPILATION_CACHE_ENABLE_CACHING=YES \ | ||
| "COMPILATION_CACHE_CAS_PATH=$cas_path" \ | ||
| "COMPILATION_CACHE_LIMIT_SIZE=$cache_limit_bytes" \ | ||
| build-for-testing 2>&1 | tee -a "$log" | ||
| done | ||
| } | ||
|
|
||
| case "${1:-}" in | ||
| fingerprint) | ||
| [ "$#" -eq 2 ] || usage | ||
| fingerprint "$2" | ||
| ;; | ||
| resolve) | ||
| [ "$#" -eq 3 ] || usage | ||
| resolve "$2" "$3" | ||
| ;; | ||
| build) | ||
| [ "$#" -ge 4 ] && [ "$#" -le 5 ] || usage | ||
| shift | ||
| build "$@" | ||
| ;; | ||
| *) | ||
| usage | ||
| ;; | ||
| esac | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.