Repository navigation
Cache Swift packages across CI runs - #998
Conversation
Add actions/cache for the SPM cloned source packages directory so subsequent runs skip fetching Sparkle, sentry-cocoa, swift-markdown-ui, posthog-ios, and NetworkImage from GitHub each time. - nightly/release: replace the no-op SwiftPM cache step with actions/cache + -clonedSourcePackagesDirPath on xcodebuild - ci/ci-macos-compat/test-e2e: add actions/cache before the existing resolve step, stop deleting the cache dir each run
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds GitHub Actions caching for Swift packages across CI workflows, reusing .ci-source-packages / .spm-cache via keys derived from Package.resolved and removing pre-emptive rm -rf cleanup steps so cached packages persist between runs. Changes
Sequence Diagram(s)sequenceDiagram
participant Actions as GitHub Actions workflow
participant Cache as actions/cache
participant SwiftPM as Swift Package Manager (resolve)
participant Xcode as xcodebuild
Actions->>Cache: restore cache (key: Package.resolved hash)
Cache-->>Actions: cache hit/miss
Actions->>SwiftPM: Resolve Swift packages (use cached dir if present)
SwiftPM-->>Actions: resolved packages in .ci-source-packages / .spm-cache
Actions->>Xcode: build with -clonedSourcePackagesDirPath .spm-cache
Xcode-->>Actions: build artifacts
Actions->>Cache: save updated cache (if changes)
Cache-->>Actions: persisted cache
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/test-e2e.yml (1)
154-159: Consider including runner in cache key for consistency.The
runnerinput allows selectingmacos-15ormacos-26, but the cache key doesn't include this. While SwiftPM cloned packages are source code and likely OS-agnostic,ci-macos-compat.ymldoes includematrix.osin its cache key. For consistency, consider:♻️ Suggested change
- name: Cache Swift packages uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 with: path: .ci-source-packages - key: spm-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} - restore-keys: spm- + key: spm-${{ inputs.runner || 'macos-15' }}-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} + restore-keys: spm-${{ inputs.runner || 'macos-15' }}-🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/test-e2e.yml around lines 154 - 159, The cache key for "Cache Swift packages" omits the selected runner/OS, causing inconsistent cache scopes; update the key generation used in the with.key for that step (the line starting with key: spm-) to include the workflow runner/OS identifier (e.g. append -${{ inputs.runner }} or -${{ matrix.os }} to the key) so the cache is namespaced per runner like ci-macos-compat.yml does.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/test-e2e.yml:
- Around line 154-159: The cache key for "Cache Swift packages" omits the
selected runner/OS, causing inconsistent cache scopes; update the key generation
used in the with.key for that step (the line starting with key: spm-) to include
the workflow runner/OS identifier (e.g. append -${{ inputs.runner }} or -${{
matrix.os }} to the key) so the cache is namespaced per runner like
ci-macos-compat.yml does.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e6a21f34-3382-46b0-a9fe-7e00cbcdf282
📒 Files selected for processing (5)
.github/workflows/ci-macos-compat.yml.github/workflows/ci.yml.github/workflows/nightly.yml.github/workflows/release.yml.github/workflows/test-e2e.yml
Greptile SummaryThis PR adds
The changes follow consistent patterns across workflows and should provide the intended caching benefits. Confidence Score: 5/5
Last reviewed commit: d8db3ee |
Consistent with ci-macos-compat.yml which uses matrix.os in the key.
* Cache Swift packages across CI runs Add actions/cache for the SPM cloned source packages directory so subsequent runs skip fetching Sparkle, sentry-cocoa, swift-markdown-ui, posthog-ios, and NetworkImage from GitHub each time. - nightly/release: replace the no-op SwiftPM cache step with actions/cache + -clonedSourcePackagesDirPath on xcodebuild - ci/ci-macos-compat/test-e2e: add actions/cache before the existing resolve step, stop deleting the cache dir each run * Include runner in test-e2e cache key Consistent with ci-macos-compat.yml which uses matrix.os in the key.
Summary
All CI workflows were re-fetching SPM dependencies (Sparkle, sentry-cocoa, swift-markdown-ui, posthog-ios, NetworkImage) from GitHub on every run. This adds
actions/cachekeyed onPackage.resolvedto persist the cloned source packages directory across runs.actions/cache+-clonedSourcePackagesDirPath .spm-cacheon the xcodebuild commandactions/cachebefore the existing resolve step, stopped deleting the cache directory each runTest plan
Summary by cubic
Caches SwiftPM dependencies across CI runs to avoid re-fetching packages and speed up builds. Uses actions/cache keyed by Package.resolved, with xcodebuild pointing to the cached source packages directory; cache keys are scoped by runner/OS where needed.
Written for commit d767274. Summary will update on new commits.
Summary by CodeRabbit