Skip to content

Commit dbdaef6

Browse files
ci: cache SPM packages and add timeout in release-publish build-kits (#719)
ci: cache SPM packages and add timeout in release-publish build-kits job - Add actions/cache@v4 step to cache DerivedData/SourcePackages per kit, keyed on Package.swift hash — avoids cold-fetching large dependencies on every release run (e.g. Airship ios-library takes 8+ min cold) - Add explicit -resolvePackageDependencies step before archiving so resolution is separated from compilation and benefits from the cache - Pass -derivedDataPath DerivedData and -packageCachePath to all xcodebuild archive calls for consistency with the resolved packages - Add timeout-minutes: 30 to prevent hung jobs blocking the pipeline - Remove committed Package.resolved files (already covered by .gitignore) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 345fdb3 commit dbdaef6

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

.github/workflows/release-publish.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ jobs:
123123
name: Build ${{ matrix.kit.name }}
124124
needs: load-matrix
125125
runs-on: macOS-latest
126+
timeout-minutes: 30
126127
env:
127128
XCODE_VERSION: "26.2"
128129
# Build xcframeworks against mParticle-Apple-SDK from this checkout (same commit as VERSION).
@@ -141,6 +142,22 @@ jobs:
141142
- name: Select Xcode
142143
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
143144

145+
- name: Cache SPM packages
146+
uses: actions/cache@v4
147+
with:
148+
path: DerivedData/SourcePackages
149+
key: spm-${{ runner.os }}-${{ matrix.kit.name }}-${{ hashFiles(format('{0}/Package.swift', matrix.kit.local_path)) }}
150+
restore-keys: |
151+
spm-${{ runner.os }}-${{ matrix.kit.name }}-
152+
spm-${{ runner.os }}-
153+
154+
- name: Resolve SPM dependencies
155+
run: |
156+
SCHEME=$(echo '${{ toJson(matrix.kit.schemes) }}' | jq -r '.[0].scheme')
157+
PROJECT="$(ls -d ${{ matrix.kit.local_path }}/*.xcodeproj | head -1)"
158+
xcodebuild -resolvePackageDependencies -project "$PROJECT" \
159+
-scheme "$SCHEME" -derivedDataPath DerivedData
160+
144161
- name: Build kit xcframeworks
145162
shell: bash
146163
run: |
@@ -184,9 +201,15 @@ jobs:
184201
esac
185202
186203
xcodebuild archive -project "$PROJECT" -scheme "$SCHEME" \
187-
-destination "$PLATFORM_DEVICE" -archivePath "$ARCHIVE_DEVICE" $BUILD_SETTINGS
204+
-destination "$PLATFORM_DEVICE" -archivePath "$ARCHIVE_DEVICE" \
205+
-derivedDataPath DerivedData \
206+
-packageCachePath DerivedData/SourcePackages \
207+
$BUILD_SETTINGS
188208
xcodebuild archive -project "$PROJECT" -scheme "$SCHEME" \
189-
-destination "$PLATFORM_SIM" -archivePath "$ARCHIVE_SIM" $BUILD_SETTINGS
209+
-destination "$PLATFORM_SIM" -archivePath "$ARCHIVE_SIM" \
210+
-derivedDataPath DerivedData \
211+
-packageCachePath DerivedData/SourcePackages \
212+
$BUILD_SETTINGS
190213
191214
XCFRAMEWORK_ARGS+=" -archive ${ARCHIVE_DEVICE}.xcarchive -framework ${MODULE}.framework"
192215
XCFRAMEWORK_ARGS+=" -archive ${ARCHIVE_SIM}.xcarchive -framework ${MODULE}.framework"

Kits/braze/braze-12/mParticle-Braze.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)