ci: cache CI dependencies to reduce PR workflow runtime - #753
Closed
nickolas-dimitrakas wants to merge 7 commits into
Closed
ci: cache CI dependencies to reduce PR workflow runtime#753nickolas-dimitrakas wants to merge 7 commits into
nickolas-dimitrakas wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📦 SDK Size Impact ReportMeasures how much the SDK adds to an app's size (with-SDK minus without-SDK).
➡️ SDK size impact change is minimal. Raw measurementsTarget branch (main): {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1900,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1816,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6616}This PR: {"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1900,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":1816,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6616} |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rmat() limitation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Superseded by #981 — this PR predates the SPM-resolve watchdog/retry logic added in #867, and merging it as-is would have silently reverted that fix. #981 covers the same caching goal without touching that step, and deliberately avoids caching compiled DerivedData (the riskier part of this PR) in favor of caching only raw dependency sources. |
nickolas-dimitrakas
added a commit
that referenced
this pull request
Sep 9, 2026
build-kits Build jobs still routinely take 10-18 min per kit (largely re-fetching multi-GB transitive SPM deps like stripe-ios from scratch on every run); pod-lint, build-and-lint, cross-platform-tests, and integration-tests all re-download CocoaPods/gem/WireMock sources the same way. None of this is cached today. Cache only immutable, pre-compile inputs, never compiled build products: - build-kits: weekly-keyed CocoaPods source cache (pod-lint-kits) and a per-kit SwiftPM source cache at ~/Library/Caches/org.swift.swiftpm (build-kits) — shared across the kit's main/example/test builds, restored before dependency resolution - build-and-lint, cross-platform-tests: Ruby gem caches for xcodeproj/cocoapods (switched to --user-install so the cache path is writable without sudo) - integration-tests: WireMock JAR cache keyed by version Deliberately does not cache DerivedData/compiled build products: the existing hash-based cache key can't capture Xcode/toolchain drift, and 20 kits x 1-3GB of DerivedData would blow past the 10GB per-repo cache limit and evict constantly. Caching only sources means every build still recompiles from scratch and can't go stale — the "Resolve SPM dependencies" watchdog step (added since to bound hung fetches) is untouched. Supersedes #753, which predates that watchdog step and would have silently dropped it on merge.
nickolas-dimitrakas
added a commit
that referenced
this pull request
Sep 10, 2026
* ci: cache raw dependency sources to cut PR/build-kits runtime build-kits Build jobs still routinely take 10-18 min per kit (largely re-fetching multi-GB transitive SPM deps like stripe-ios from scratch on every run); pod-lint, build-and-lint, cross-platform-tests, and integration-tests all re-download CocoaPods/gem/WireMock sources the same way. None of this is cached today. Cache only immutable, pre-compile inputs, never compiled build products: - build-kits: weekly-keyed CocoaPods source cache (pod-lint-kits) and a per-kit SwiftPM source cache at ~/Library/Caches/org.swift.swiftpm (build-kits) — shared across the kit's main/example/test builds, restored before dependency resolution - build-and-lint, cross-platform-tests: Ruby gem caches for xcodeproj/cocoapods (switched to --user-install so the cache path is writable without sudo) - integration-tests: WireMock JAR cache keyed by version Deliberately does not cache DerivedData/compiled build products: the existing hash-based cache key can't capture Xcode/toolchain drift, and 20 kits x 1-3GB of DerivedData would blow past the 10GB per-repo cache limit and evict constantly. Caching only sources means every build still recompiles from scratch and can't go stale — the "Resolve SPM dependencies" watchdog step (added since to bound hung fetches) is untouched. Supersedes #753, which predates that watchdog step and would have silently dropped it on merge. * ci: fix gem cache path and quote GITHUB_ENV/PATH redirects Cursor Bugbot: --user-install only lands in ~/.gem when that directory already exists; a fresh runner has neither, so RubyGems' XDG fallback (~/.local/share/gem) is used instead, and the ~/.gem cache silently never populates. Cache both candidate paths. CodeRabbit/actionlint: quote the $GITHUB_ENV/$GITHUB_PATH redirect targets (SC2086). * ci: use ISO week-based year for cache week key %Y is the calendar year, %V is the ISO week number — they disagree near year boundaries (e.g. Dec 31 2026 falls in ISO week 2027-W01), splitting one ISO week across two cache keys. %G is the matching ISO week-based year. * ci: disambiguate cache restore-key kit-name boundaries restore-keys is a plain string-prefix match. Kit names share hyphens (rokt is a literal prefix of rokt-sdk-plus-ios), so a "kit-name-" boundary let a small kit's cache miss restore a much bigger kit's multi-GB cache instead. "::" can't appear in a kit name, so it can't collide with any current or future kit.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
PR workflow jobs in `build-kits` were taking 15-19 minutes each because third-party SDKs (Firebase, Airship, Rokt) were being downloaded and compiled from scratch on every run with no caching.
Profiled from CI run #24418060388:
What Has Changed
build-kits.yml
actions/cache@v5.0.5for~/.cocoapodsand~/Library/Caches/CocoaPodsinpod-lint-kits, keyed per-kit by podspec hash + weekly window — avoids re-downloading Airship/Firebase on every lint run; weekly window ensures new upstream releases are picked upDerivedDatacache inbuild-kits, key computed via shellfind | shasumacross kit source files + core SDK source files (mParticle-Apple-SDK/**,mParticle-Apple-SDK-Swift/**) — enables incremental xcodebuild instead of full recompilation on warm runs; busts on any kit or core SDK changetimeout-minutes: 30to bothpod-lint-kitsandbuild-kitsjobs to enforce the target CI runtimefetch-depthfrom0→1(full git history not needed for builds)build-and-lint.yml
~/.gem) forxcodeproj; switched to user-level gem installcross-platform-tests.yml
~/.gem) forcocoapods+cocoapods-generate, keyed byPodfile.lockintegration-tests.yml
actions/cache@v5.0.5for WireMock JAR, keyed by version — skips Maven Central download on cache hitAll
actions/cachereferences pinned to SHA (v5.0.5).Screenshots/Video
N/A
Checklist
Additional Notes
Cold runs (first PR after a cache miss) remain as today. On warm runs (no source changes), kit builds should drop from 15-18 min to ~2-5 min via incremental xcodebuild. Monitor GitHub Actions cache storage in Settings → Actions → Caches — Firebase DerivedData is large (1-3 GB per kit) and may approach the 10 GB repo limit.