Skip to content

Commit 181566a

Browse files
mikepitreclaude
andcommitted
ci(repo): prepare the device image in a background step
Creating and booting the template simulator took four and a half minutes of waiting in the last full run, and the emulator download up to three. Both now run as one background step that starts before the dependency install, and the job waits for it before `up`. actionlint 1.7.12 predates the `background` and `wait` step keys and rejects them, so .github/actionlint.yaml ignores its two messages for this one workflow file, the way clerk_go does for its own. Until actionlint supports the keys, a step in this file with neither `run` nor `uses` is not reported either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0bf79e7 commit 181566a

2 files changed

Lines changed: 42 additions & 30 deletions

File tree

‎.github/actionlint.yaml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ self-hosted-runner:
77
labels:
88
- blacksmith-8vcpu-ubuntu-2204
99
- blacksmith-6vcpu-macos-26
10+
11+
paths:
12+
# actionlint 1.7.x predates GitHub's background steps and rejects them:
13+
# https://github.com/rhysd/actionlint/issues/693
14+
# Remove once actionlint supports those keys. Until then, a step in this file
15+
# with neither `run` nor `uses` is not reported either.
16+
.github/workflows/verify-e2e.yml:
17+
ignore:
18+
- 'unexpected key "background" for step to run shell command'
19+
- 'step must run script with "run" section or run action with "uses" section'

‎.github/workflows/verify-e2e.yml‎

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ jobs:
9393
node-version: 24.15.0
9494
cache: ${{ matrix.platform == 'android' && 'pnpm' || '' }}
9595

96-
- name: Install monorepo dependencies
97-
run: pnpm install --frozen-lockfile
98-
9996
- name: Set up JDK 21
10097
if: matrix.platform == 'android'
10198
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
@@ -110,39 +107,41 @@ jobs:
110107
sudo udevadm control --reload-rules
111108
sudo udevadm trigger --name-match=kvm
112109
113-
- name: Install the emulator and its system image
114-
if: matrix.platform == 'android'
115-
run: |
116-
set -euo pipefail
117-
IMAGE="system-images;android-36;google_apis;x86_64"
118-
for attempt in 1 2 3; do
119-
if "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "$IMAGE" emulator platform-tools < /dev/null > "$RUNNER_TEMP/sdkmanager.log" 2>&1; then
120-
break
121-
fi
122-
echo "::warning::sdkmanager could not install $IMAGE on attempt $attempt"
123-
grep -v '^\[' "$RUNNER_TEMP/sdkmanager.log" | tail -20 || true
124-
if [ "$attempt" = "3" ]; then
125-
exit 1
126-
fi
127-
done
128-
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
129-
130-
- name: Create the template simulator that the skill clones
131-
if: matrix.platform == 'ios'
110+
- name: Prepare the device image
111+
id: device-image
112+
background: true
132113
timeout-minutes: 15
133114
env:
134115
IOS_RUNTIME: com.apple.CoreSimulator.SimRuntime.iOS-26-5
135116
run: |
136117
set -euo pipefail
137-
if ! xcrun simctl list runtimes available -j | jq -e --arg id "$IOS_RUNTIME" '.runtimes[] | select(.identifier == $id)' > /dev/null; then
138-
echo "::error::This runner image has no $IOS_RUNTIME. It has: $(xcrun simctl list runtimes available -j | jq -r '[.runtimes[].identifier] | join(", ")')"
139-
exit 1
118+
if [ "$PLATFORM" = "ios" ]; then
119+
if ! xcrun simctl list runtimes available -j | jq -e --arg id "$IOS_RUNTIME" '.runtimes[] | select(.identifier == $id)' > /dev/null; then
120+
echo "::error::This runner image has no $IOS_RUNTIME. It has: $(xcrun simctl list runtimes available -j | jq -r '[.runtimes[].identifier] | join(", ")')"
121+
exit 1
122+
fi
123+
udid="$(xcrun simctl create "Clerk Verify Template iOS" "iPhone 17 Pro" "$IOS_RUNTIME")"
124+
xcrun simctl boot "$udid"
125+
xcrun simctl bootstatus "$udid" -b
126+
CLERK_TEST_DEVICES="$udid" integration/tests/expo-native/boot-ios-simulators.sh wait
127+
xcrun simctl shutdown "$udid"
128+
else
129+
IMAGE="system-images;android-36;google_apis;x86_64"
130+
for attempt in 1 2 3; do
131+
if "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "$IMAGE" emulator platform-tools < /dev/null > "$RUNNER_TEMP/sdkmanager.log" 2>&1; then
132+
break
133+
fi
134+
echo "::warning::sdkmanager could not install $IMAGE on attempt $attempt"
135+
grep -v '^\[' "$RUNNER_TEMP/sdkmanager.log" | tail -20 || true
136+
if [ "$attempt" = "3" ]; then
137+
exit 1
138+
fi
139+
done
140+
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
140141
fi
141-
udid="$(xcrun simctl create "Clerk Verify Template iOS" "iPhone 17 Pro" "$IOS_RUNTIME")"
142-
xcrun simctl boot "$udid"
143-
xcrun simctl bootstatus "$udid" -b
144-
CLERK_TEST_DEVICES="$udid" integration/tests/expo-native/boot-ios-simulators.sh wait
145-
xcrun simctl shutdown "$udid"
142+
143+
- name: Install monorepo dependencies
144+
run: pnpm install --frozen-lockfile
146145

147146
- name: Install the verify skill
148147
id: install
@@ -206,6 +205,9 @@ jobs:
206205
echo "No native build of this branch is kept for $NATIVE_ID, and the Expo workflow has none for this commit, so this job builds it."
207206
echo "found=none" >> "$GITHUB_OUTPUT"
208207
208+
- name: Wait for the device image
209+
wait: device-image
210+
209211
- name: Build the fixture and boot a device
210212
timeout-minutes: 30
211213
env:

0 commit comments

Comments
 (0)