diff --git a/.github/workflows/ci-macos-compat.yml b/.github/workflows/ci-macos-compat.yml index 463e5a56..a51a96c0 100644 --- a/.github/workflows/ci-macos-compat.yml +++ b/.github/workflows/ci-macos-compat.yml @@ -73,11 +73,17 @@ jobs: - name: Clean DerivedData run: rm -rf ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-* + - name: Cache Swift packages + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: .ci-source-packages + key: spm-${{ matrix.os }}-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} + restore-keys: spm-${{ matrix.os }}- + - name: Resolve Swift packages run: | set -euo pipefail SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages" - rm -rf "$SOURCE_PACKAGES_DIR" mkdir -p "$SOURCE_PACKAGES_DIR" for attempt in 1 2 3; do diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c106a18a..6c1de0eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,11 +101,17 @@ jobs: # Remove stale build cache to avoid incremental build errors rm -rf ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-* + - 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- + - name: Resolve Swift packages run: | set -euo pipefail SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages" - rm -rf "$SOURCE_PACKAGES_DIR" mkdir -p "$SOURCE_PACKAGES_DIR" for attempt in 1 2 3; do @@ -226,11 +232,17 @@ jobs: - name: Clean DerivedData run: rm -rf ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-* + - 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- + - name: Resolve Swift packages run: | set -euo pipefail SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages" - rm -rf "$SOURCE_PACKAGES_DIR" mkdir -p "$SOURCE_PACKAGES_DIR" for attempt in 1 2 3; do diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index da320e73..3b9a0866 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 57bfb154..200f003a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,6 +129,14 @@ jobs: rm GhosttyKit.xcframework.tar.gz test -d GhosttyKit.xcframework + - name: Cache Swift packages + if: steps.guard_release_assets.outputs.skip_all != 'true' + 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 if: steps.guard_release_assets.outputs.skip_all != 'true' env: @@ -145,7 +153,9 @@ jobs: - name: Build app (Release) if: steps.guard_release_assets.outputs.skip_all != 'true' run: | - xcodebuild -scheme cmux -configuration Release -derivedDataPath build CODE_SIGNING_ALLOWED=NO build + xcodebuild -scheme cmux -configuration Release -derivedDataPath build \ + -clonedSourcePackagesDirPath .spm-cache \ + CODE_SIGNING_ALLOWED=NO build - name: Inject Sparkle keys into Info.plist if: steps.guard_release_assets.outputs.skip_all != 'true' diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 48b5e4de..23d595c7 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -151,11 +151,17 @@ jobs: - name: Clean DerivedData run: rm -rf ~/Library/Developer/Xcode/DerivedData/GhosttyTabs-* + - name: Cache Swift packages + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: .ci-source-packages + key: spm-${{ inputs.runner || 'macos-15' }}-${{ hashFiles('GhosttyTabs.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} + restore-keys: spm-${{ inputs.runner || 'macos-15' }}- + - name: Resolve Swift packages run: | set -euo pipefail SOURCE_PACKAGES_DIR="$PWD/.ci-source-packages" - rm -rf "$SOURCE_PACKAGES_DIR" mkdir -p "$SOURCE_PACKAGES_DIR" for attempt in 1 2 3; do if xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug \