Repository navigation
ci: add SPM resolve step with retry, --triple flags, and cache - #5166
Merged
Merged
Conversation
- Add "Resolve SPM packages" step with 3-attempt retry loop before building, so binary artifact downloads (~673MB) complete reliably on fresh Codemagic machines before compilation starts - Switch --arch arm64/x86_64 to --triple arm64/x86_64-apple-macosx for explicit, predictable output directories (matches local release.sh) - Add ~/Library/Caches/org.swift.swiftpm to Codemagic cache so subsequent builds skip re-downloading binary xcframeworks Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Contributor
Greptile SummaryAdded three complementary improvements to prevent SPM download failures on fresh CI machines:
The retry logic correctly handles all failure cases, breaking on success and exiting with error after 3 failed attempts. Error handling includes diagnostic output showing artifact count after resolution. Confidence Score: 5/5
Important Files Changed
Last reviewed commit: e44fa03 |
Glucksberg
pushed a commit
to Glucksberg/omi-local
that referenced
this pull request
Apr 28, 2026
…Hardware#5166) ## Problem Build BasedHardware#12 failed at \"Build Swift app (arm64 + x86_64)\" on a fresh Codemagic Mac mini M2: ``` ERROR: arm64 binary not found at Desktop/.build/arm64-apple-macosx/release/Omi Computer artifacts checkouts repositories workspace-state.json ``` Root cause: SPM needs to download ~673MB of binary artifacts (Firebase, Sentry, Sparkle xcframeworks) on a fresh machine. When `xcrun swift build --arch arm64` runs, it tries to download everything **and compile** in a single step. The download failed/aborted mid-way (375MB of 673MB downloaded), leaving no `arm64-apple-macosx/` directory — so compilation never started. Without `set -e`, the script continued to the binary existence check and exited with 1. Build BasedHardware#11 succeeded only because that machine had a warm SPM cache from previous builds. ## Fix 1. **New \"Resolve SPM packages\" step** — runs `xcrun swift package resolve` before building, with a 3-attempt retry loop. This pre-downloads all binary artifacts. If the first attempt fails partway, the second attempt resumes from where it left off (SPM checkpoints downloads). 2. **`--triple` instead of `--arch`** — switches from `xcrun swift build --arch arm64` to `--triple arm64-apple-macosx`. This matches the local `release.sh` behavior and ensures the output binary **always** lands in `.build/arm64-apple-macosx/release/` regardless of the machine's native architecture (on native M2, `--arch arm64` may use the `release/` symlink path). 3. **SPM cache** — adds `~/Library/Caches/org.swift.swiftpm` to Codemagic's build cache so binary xcframeworks are not re-downloaded on every subsequent build. ## Result - Fresh machine: resolve step downloads packages with retry, then both builds compile using already-cached artifacts - Warm machine: resolve is instant (already cached), builds proceed normally 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Problem
Build #12 failed at "Build Swift app (arm64 + x86_64)" on a fresh Codemagic Mac mini M2:
Root cause: SPM needs to download ~673MB of binary artifacts (Firebase, Sentry, Sparkle xcframeworks) on a fresh machine. When
xcrun swift build --arch arm64runs, it tries to download everything and compile in a single step. The download failed/aborted mid-way (375MB of 673MB downloaded), leaving noarm64-apple-macosx/directory — so compilation never started. Withoutset -e, the script continued to the binary existence check and exited with 1.Build #11 succeeded only because that machine had a warm SPM cache from previous builds.
Fix
New "Resolve SPM packages" step — runs
xcrun swift package resolvebefore building, with a 3-attempt retry loop. This pre-downloads all binary artifacts. If the first attempt fails partway, the second attempt resumes from where it left off (SPM checkpoints downloads).--tripleinstead of--arch— switches fromxcrun swift build --arch arm64to--triple arm64-apple-macosx. This matches the localrelease.shbehavior and ensures the output binary always lands in.build/arm64-apple-macosx/release/regardless of the machine's native architecture (on native M2,--arch arm64may use therelease/symlink path).SPM cache — adds
~/Library/Caches/org.swift.swiftpmto Codemagic's build cache so binary xcframeworks are not re-downloaded on every subsequent build.Result
🤖 Generated with Claude Code