Skip to content

Commit 0a335e1

Browse files
joelmossclaude
andcommitted
ci: cache + retry SPM package resolution in the app job
The app CI job resolved ~15 Swift packages (Sparkle, Sentry, libghostty, the tree-sitter grammars, swift-syntax pulled transitively) by cloning them from GitHub on every run, with no cache and no retry. A transient github.com:443 timeout mid-clone failed the whole build: fatal: unable to access 'https://github.com/swiftlang/swift-syntax/': Failed to connect to github.com port 443 ... Couldn't connect to server xcodebuild: error: Could not resolve package dependencies Cache DerivedData/SourcePackages keyed on project.yml (the sole source of the dependency set — the .xcodeproj is xcodegen-generated and gitignored) so an unchanged set skips the network, and resolve up front with 3 retries so a transient blip retries instead of failing. The app-test build reuses the checkouts via the same -clonedSourcePackagesDirPath and won't re-clone. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KVeVCUyQymuhEkk4kWJ8Pb
1 parent fa8547c commit 0a335e1

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,35 @@ jobs:
5353
- name: Lint (swift-format --strict)
5454
run: make app-lint
5555

56+
# SPM resolves ~15 packages (Sparkle, Sentry, libghostty, the tree-sitter grammars, and
57+
# swift-syntax pulled transitively) by cloning them from GitHub on every run. Cache the
58+
# resolved checkouts keyed on project.yml (the sole source of the dependency set — the
59+
# .xcodeproj is xcodegen-generated and gitignored) so an unchanged set skips the network
60+
# entirely. The restore-keys fallback reuses an older cache after a dep change so only the
61+
# delta is fetched.
62+
- name: Cache SPM packages
63+
uses: actions/cache@v4
64+
with:
65+
path: macapp/DerivedData/SourcePackages
66+
key: spm-${{ runner.os }}-${{ hashFiles('macapp/project.yml') }}
67+
restore-keys: spm-${{ runner.os }}-
68+
69+
# Resolve up front with retries so a transient github.com blip mid-clone can't fail the whole
70+
# run (it did: swift-syntax clone hit "Couldn't connect to server"). The subsequent app-test
71+
# build reuses these checkouts via the same -clonedSourcePackagesDirPath, so it won't re-clone.
72+
- name: Resolve SPM packages (retry on network flake)
73+
working-directory: macapp
74+
run: |
75+
xcodegen generate
76+
for attempt in 1 2 3; do
77+
xcodebuild -project WorkroomApp.xcodeproj -scheme WorkroomApp \
78+
-derivedDataPath DerivedData -clonedSourcePackagesDirPath DerivedData/SourcePackages \
79+
-resolvePackageDependencies && exit 0
80+
echo "::warning::SPM resolve attempt $attempt failed; retrying in 15s"
81+
sleep 15
82+
done
83+
echo "::error::SPM resolve failed after 3 attempts"; exit 1
84+
5685
# Hosted runners have no signing cert / dev team: ad-hoc sign, clear the team, manual
5786
# style so xcodebuild won't provision against Apple's servers. Lets the non-sandboxed
5887
# app build and the unit tests launch their host app. (`make app-test` also builds.)

0 commit comments

Comments
 (0)