4343 path : ${{ env.PREBUILT_DIR }}
4444 key : ios-runner-prebuilt-${{ steps.xcode.outputs.key }}-ios-${{ env.IOS_RUNTIME_VERSION }}
4545
46- - name : Resolve iOS runtime 26.2
47- if : steps.restore-prebuilt.outputs.cache-hit != 'true'
48- id : runtime
49- run : |
50- set -euo pipefail
51- RUNTIME_ID="$(
52- xcrun simctl list runtimes -j | node -e "
53- const fs = require('node:fs');
54- const payload = JSON.parse(fs.readFileSync(0, 'utf8'));
55- const targetVersion = process.env.IOS_RUNTIME_VERSION;
56- const runtime = (payload.runtimes ?? [])
57- .filter((item) => item.isAvailable)
58- .find((item) => item.platform === 'iOS' && item.version === targetVersion);
59- if (!runtime?.identifier) process.exit(1);
60- process.stdout.write(runtime.identifier);
61- "
62- )"
63-
64- if [ -z "$RUNTIME_ID" ]; then
65- echo "Could not find available iOS runtime ${IOS_RUNTIME_VERSION}" >&2
66- exit 1
67- fi
68-
69- echo "runtime_id=$RUNTIME_ID" >> "$GITHUB_OUTPUT"
70-
71- - name : Create simulator for runtime
72- if : steps.restore-prebuilt.outputs.cache-hit != 'true'
73- id : simulator
74- run : |
75- set -euo pipefail
76- UDID="$(xcrun simctl create "agent-device-prebuild-${GITHUB_RUN_ID}" "$IOS_DEVICE_NAME" "${{ steps.runtime.outputs.runtime_id }}")"
77- echo "udid=$UDID" >> "$GITHUB_OUTPUT"
78- xcrun simctl boot "$UDID" || true
79-
8046 - name : Build ios-runner for testing
8147 if : steps.restore-prebuilt.outputs.cache-hit != 'true'
8248 run : |
@@ -85,20 +51,18 @@ jobs:
8551 xcodebuild build-for-testing \
8652 -project ios-runner/AgentDeviceRunner/AgentDeviceRunner.xcodeproj \
8753 -scheme AgentDeviceRunner \
88- -destination "id=${{ steps.simulator.outputs.udid } }" \
54+ -destination "platform=iOS Simulator,name=${IOS_DEVICE_NAME},OS=${IOS_RUNTIME_VERSION }" \
8955 -derivedDataPath "$DERIVED_DATA_PATH"
9056
91- - name : Package prebuilt artifact
57+ - name : Package prebuilt cache payload
9258 if : steps.restore-prebuilt.outputs.cache-hit != 'true'
9359 run : |
9460 set -euo pipefail
9561 mkdir -p "$PREBUILT_DIR"
9662 cp -R "$DERIVED_DATA_PATH" "$PREBUILT_DIR/derived-data"
9763 cat > "$PREBUILT_DIR/metadata.txt" <<EOF
9864 runtime_version=${IOS_RUNTIME_VERSION}
99- runtime_id=${{ steps.runtime.outputs.runtime_id }}
10065 device_name=${IOS_DEVICE_NAME}
101- simulator_udid=${{ steps.simulator.outputs.udid }}
10266 xcode_version=${{ steps.xcode.outputs.version }}
10367 github_run_id=${GITHUB_RUN_ID}
10468 github_sha=${GITHUB_SHA}
11983 else
12084 echo "Created/updated prebuild cache."
12185 fi
122-
123- - name : Cleanup simulator
124- if : always() && steps.restore-prebuilt.outputs.cache-hit != 'true'
125- run : |
126- set -euo pipefail
127- xcrun simctl delete "${{ steps.simulator.outputs.udid }}" || true
0 commit comments