@@ -2,6 +2,11 @@ name: iOS Runner Prebuild (CI-only)
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ cache_buster :
7+ description : Optional suffix to force a fresh prebuild cache entry
8+ required : false
9+ default : stable
510
611permissions :
712 contents : read
1823 env :
1924 IOS_RUNTIME_VERSION : ' 26.2'
2025 IOS_DEVICE_NAME : ' iPhone 17 Pro'
21- PREBUILT_DIR : ${{ github.workspace }}/.tmp/ios-runner-prebuilt
2226 DERIVED_DATA_PATH : ${{ github.workspace }}/.tmp/ios-runner-derived
2327 steps :
2428 - name : Checkout
@@ -36,48 +40,39 @@ jobs:
3640 echo "version=$XCODE_VERSION" >> "$GITHUB_OUTPUT"
3741 echo "key=$XCODE_KEY" >> "$GITHUB_OUTPUT"
3842
43+ - name : Resolve prebuild source hash
44+ id : source-hash
45+ run : echo "value=${{ hashFiles('ios-runner/**', 'package.json', 'pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
46+
3947 - name : Restore prebuilt cache
4048 id : restore-prebuilt
4149 uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
4250 with :
43- path : ${{ env.PREBUILT_DIR }}
44- key : ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}
51+ path : ${{ env.DERIVED_DATA_PATH }}
52+ key : ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}-${{ steps.source-hash.outputs.value }}-${{ github.event.inputs.cache_buster }}
4553
4654 - name : Build ios-runner for testing
4755 if : steps.restore-prebuilt.outputs.cache-hit != 'true'
4856 run : |
4957 set -euo pipefail
50- rm -rf "$DERIVED_DATA_PATH" "$PREBUILT_DIR"
58+ rm -rf "$DERIVED_DATA_PATH"
5159 xcodebuild build-for-testing \
5260 -project ios-runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj \
5361 -scheme AgentDeviceRunner \
5462 -destination "platform=iOS Simulator,name=${IOS_DEVICE_NAME},OS=${IOS_RUNTIME_VERSION}" \
5563 -derivedDataPath "$DERIVED_DATA_PATH"
5664
57- - name : Package prebuilt cache payload
58- if : steps.restore-prebuilt.outputs.cache-hit != 'true'
59- run : |
60- set -euo pipefail
61- mkdir -p "$PREBUILT_DIR"
62- cp -R "$DERIVED_DATA_PATH" "$PREBUILT_DIR/derived-data"
63- cat > "$PREBUILT_DIR/metadata.txt" <<EOF
64- runtime_version=${IOS_RUNTIME_VERSION}
65- device_name=${IOS_DEVICE_NAME}
66- xcode_version=${{ steps.xcode.outputs.version }}
67- github_run_id=${GITHUB_RUN_ID}
68- github_sha=${GITHUB_SHA}
69- EOF
70-
7165 - name : Save prebuilt cache
7266 if : steps.restore-prebuilt.outputs.cache-hit != 'true'
7367 uses : actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.2.3
7468 with :
75- path : ${{ env.PREBUILT_DIR }}
76- key : ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}
69+ path : ${{ env.DERIVED_DATA_PATH }}
70+ key : ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}-${{ steps.source-hash.outputs.value }}-${{ github.event.inputs.cache_buster }}
7771
7872 - name : Report prebuild cache status
7973 run : |
8074 set -euo pipefail
75+ echo "cache_key=ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}-${{ steps.source-hash.outputs.value }}-${{ github.event.inputs.cache_buster }}"
8176 if [ "${{ steps.restore-prebuilt.outputs.cache-hit }}" = "true" ]; then
8277 echo "Reused existing prebuild cache."
8378 else
0 commit comments