Cache Swift packages across CI runs (#998)

* 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.
This commit is contained in:
Lawrence Chen 2026-03-05 23:26:05 -08:00 committed by GitHub
parent 380fc081f5
commit c37ace5deb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 13 deletions

View file

@ -142,13 +142,12 @@ jobs:
rm GhosttyKit.xcframework.tar.gz
test -d GhosttyKit.xcframework
- name: Configure SwiftPM cache
run: |
set -euo pipefail
CACHE_DIR="${RUNNER_TEMP}/swiftpm-cache/${GITHUB_RUN_ID}"
rm -rf "$CACHE_DIR"
mkdir -p "$CACHE_DIR"
echo "SWIFTPM_CACHE_PATH=$CACHE_DIR" >> "$GITHUB_ENV"
- name: Cache Swift packages
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: .spm-cache
key: spm-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: spm-
- name: Derive Sparkle public key from private key
env:
@ -164,7 +163,9 @@ jobs:
- name: Build app (Release)
run: |
xcodebuild -scheme cmux -configuration Release -derivedDataPath build CODE_SIGNING_ALLOWED=NO ASSETCATALOG_COMPILER_APPICON_NAME=AppIcon-Nightly build
xcodebuild -scheme cmux -configuration Release -derivedDataPath build \
-clonedSourcePackagesDirPath .spm-cache \
CODE_SIGNING_ALLOWED=NO ASSETCATALOG_COMPILER_APPICON_NAME=AppIcon-Nightly build
- name: Inject nightly identity and metadata
run: |