Skip to content

Commit 4baa0ab

Browse files
authored
ci(expo): Switch to maestro runner (#9264)
1 parent d8407c9 commit 4baa0ab

3 files changed

Lines changed: 40 additions & 28 deletions

File tree

.changeset/nine-hoops-press.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/expo-native-build.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ env:
2727
SDK_PACK_DIR: /tmp/clerk-expo-pack
2828
E2E_INSTANCE_NAME: clerkstage-with-native-components
2929
BAPI_URL: https://api.clerkstage.dev
30-
MAESTRO_VERSION: '2.6.1'
30+
MAESTRO_RUNNER_VERSION: '1.1.21'
3131

3232
jobs:
3333
native-build:
@@ -214,34 +214,33 @@ jobs:
214214
path: ${{ steps.native-build-key.outputs.artifact }}
215215
key: ${{ steps.native-build-cache.outputs.cache-primary-key }}
216216

217-
- name: Cache Maestro
217+
- name: Cache maestro-runner
218218
if: steps.keys.outputs.pk != ''
219219
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
220220
with:
221-
path: ~/.maestro
222-
key: maestro-${{ runner.os }}-${{ env.MAESTRO_VERSION }}
221+
path: ~/.maestro-runner
222+
key: maestro-runner-${{ runner.os }}-${{ runner.arch }}-${{ env.MAESTRO_RUNNER_VERSION }}
223223

224-
- name: Install Maestro
224+
- name: Install maestro-runner
225225
if: steps.keys.outputs.pk != ''
226-
# pipefail + binary check so a curl flake doesn't leave a missing
227-
# binary that only surfaces later as exit-code-127.
228226
run: |
229227
set -o pipefail
230-
if [ -x "$HOME/.maestro/bin/maestro" ]; then
231-
echo "Using cached Maestro"
228+
if [ -x "$HOME/.maestro-runner/bin/maestro-runner" ]; then
229+
echo "Using cached maestro-runner"
232230
else
233231
installed=0
234232
for i in 1 2 3; do
235-
if curl -fLs --retry 3 --retry-delay 5 "https://get.maestro.mobile.dev" | MAESTRO_VERSION="$MAESTRO_VERSION" bash; then
236-
if [ -x "$HOME/.maestro/bin/maestro" ]; then installed=1; break; fi
233+
if curl -fsSL --retry 3 --retry-delay 5 "https://open.devicelab.dev/install/maestro-runner" |
234+
bash -s -- --version "$MAESTRO_RUNNER_VERSION"; then
235+
if [ -x "$HOME/.maestro-runner/bin/maestro-runner" ]; then installed=1; break; fi
237236
fi
238-
echo "Maestro install attempt $i failed (or binary missing); retrying"
237+
echo "maestro-runner install attempt $i failed (or binary missing); retrying"
239238
sleep 5
240239
done
241-
[ "$installed" = 1 ] || { echo "::error::Maestro install failed after 3 attempts"; exit 1; }
240+
[ "$installed" = 1 ] || { echo "::error::maestro-runner install failed after 3 attempts"; exit 1; }
242241
fi
243-
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
244-
"$HOME/.maestro/bin/maestro" --version
242+
echo "$HOME/.maestro-runner/bin" >> "$GITHUB_PATH"
243+
"$HOME/.maestro-runner/bin/maestro-runner" --version
245244
246245
- name: Boot iOS simulator
247246
id: sim
@@ -289,6 +288,9 @@ jobs:
289288
env:
290289
CLERK_TEST_EMAIL: ${{ steps.user.outputs.email }}
291290
CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }}
291+
MAESTRO_DEVICE: ${{ steps.sim.outputs.udid }}
292+
MAESTRO_DRIVER: wda
293+
MAESTRO_PLATFORM: ios
292294
SIM_UDID: ${{ steps.sim.outputs.udid }}
293295
run: |
294296
echo "Using simulator $SIM_UDID"
@@ -352,6 +354,8 @@ jobs:
352354
env:
353355
CLERK_TEST_EMAIL: ${{ steps.user.outputs.email }}
354356
CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }}
357+
MAESTRO_DRIVER: devicelab
358+
MAESTRO_PLATFORM: android
355359
with:
356360
api-level: 34
357361
target: google_apis
@@ -377,9 +381,9 @@ jobs:
377381
curl -fsS -X DELETE "$BAPI_URL/v1/users/$USER_ID" \
378382
-H "Authorization: Bearer $CLERK_SECRET_KEY" || true
379383
380-
# Maestro debug files record flow env (and typed input) in plaintext;
384+
# Test reports record flow env (and typed input) in plaintext;
381385
# add-mask only covers step logs, not artifact contents.
382-
- name: Scrub test credentials from Maestro debug output
386+
- name: Scrub test credentials from maestro-runner reports
383387
if: always() && (steps.run_e2e_ios.outcome == 'failure' || steps.run_e2e_android.outcome == 'failure')
384388
env:
385389
CLERK_TEST_PASSWORD: ${{ steps.user.outputs.password }}
@@ -388,10 +392,10 @@ jobs:
388392
[ -n "$CLERK_TEST_PASSWORD" ] || exit 0
389393
# shellcheck disable=SC2016
390394
find "$RUNNER_TEMP/maestro-debug" -type f \
391-
\( -name '*.json' -o -name '*.log' -o -name '*.txt' -o -name '*.yaml' \) \
395+
\( -name '*.html' -o -name '*.json' -o -name '*.log' -o -name '*.txt' -o -name '*.xml' -o -name '*.yaml' \) \
392396
-exec perl -pi -e 's/\Q$ENV{CLERK_TEST_PASSWORD}\E/[REDACTED]/g' {} +
393397
394-
- name: Upload Maestro artifacts on e2e failure
398+
- name: Upload maestro-runner artifacts on e2e failure
395399
if: always() && (steps.run_e2e_ios.outcome == 'failure' || steps.run_e2e_android.outcome == 'failure')
396400
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
397401
with:

integration/tests/expo-native/run-flows.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
set -euo pipefail
1616
cd "$(dirname "${BASH_SOURCE[0]}")"
1717

18-
command -v maestro >/dev/null 2>&1 || {
19-
echo "maestro CLI is required: https://docs.maestro.dev/getting-started/installing-maestro"
18+
command -v maestro-runner >/dev/null 2>&1 || {
19+
echo "maestro-runner is required: https://devicelab.dev/open-source/maestro-runner/docs/getting-started"
2020
exit 1
2121
}
2222

@@ -25,10 +25,17 @@ command -v maestro >/dev/null 2>&1 || {
2525

2626
force_stop() { if [ "$#" -gt 0 ]; then "$@" >/dev/null 2>&1 || true; fi; }
2727

28-
debug_args=()
29-
if [ -n "${MAESTRO_DEBUG_OUTPUT:-}" ]; then
30-
debug_args=(--debug-output "$MAESTRO_DEBUG_OUTPUT" --flatten-debug-output)
31-
fi
28+
run_flow() {
29+
local output_name=$1
30+
shift
31+
local output_root=${MAESTRO_DEBUG_OUTPUT:-${TMPDIR:-/tmp}/clerk-expo-maestro-runner}
32+
33+
maestro-runner test \
34+
--output "$output_root/$output_name" \
35+
--flatten \
36+
--artifacts on-failure \
37+
"$@"
38+
}
3239

3340
record_result() {
3441
local flow=$1
@@ -54,7 +61,7 @@ fi
5461
warmup_started=$SECONDS
5562
warmup_result=failed
5663
for warmup_attempt in 1 2; do
57-
if maestro test ${debug_args+"${debug_args[@]}"} flows/subflows/_warmup.yaml; then
64+
if run_flow "warmup-attempt-$warmup_attempt" flows/subflows/_warmup.yaml; then
5865
warmup_result=passed
5966
break
6067
fi
@@ -82,10 +89,9 @@ for flow in flows/*.yaml; do
8289
flow_started=$SECONDS
8390
flow_result=failed
8491
for attempt in 1 2; do
85-
if maestro test \
92+
if run_flow "${flow##*/}-attempt-$attempt" \
8693
--env CLERK_TEST_EMAIL="$CLERK_TEST_EMAIL" \
8794
--env CLERK_TEST_PASSWORD="$CLERK_TEST_PASSWORD" \
88-
${debug_args+"${debug_args[@]}"} \
8995
"$flow"; then
9096
flow_result=passed
9197
break

0 commit comments

Comments
 (0)