7979 mkdir -p "$XDG_RUNTIME_DIR"
8080 chmod 700 "$XDG_RUNTIME_DIR"
8181
82+ # Start the tool-server out-of-band and hand `flow run` its URL via
83+ # $GITHUB_ENV. The simulator-server it later spawns inherits this step's
84+ # env; XDG_RUNTIME_DIR (pinned at job level) keeps its emulator-discovery
85+ # dir aligned with the emulator's, and adb is already on PATH from the
86+ # preinstalled SDK — so it no longer has to run inside the emulator step.
87+ # Backgrounded with our own readiness poll to dodge flow-run's hard ~15s
88+ # in-process startup timeout. SIMSERVER_LOG=debug surfaces the backend's
89+ # discovery/connect steps in argent-server.log (drop once green).
90+ - name : Start Argent tool-server
91+ run : |
92+ nohup env SIMSERVER_LOG=debug argent server start --detach --no-auth --port 3001 \
93+ > argent-server.log 2>&1 &
94+ echo "Waiting for Argent tool-server on :3001..."
95+ for i in $(seq 1 60); do
96+ if curl -fsS http://127.0.0.1:3001/tools >/dev/null 2>&1; then
97+ echo "tool-server is ready"
98+ echo "ARGENT_TOOLS_URL=http://127.0.0.1:3001" >> "$GITHUB_ENV"
99+ exit 0
100+ fi
101+ sleep 2
102+ done
103+ echo "Argent tool-server failed to become ready in time" >&2
104+ cat argent-server.log >&2
105+ exit 1
106+
82107 - name : Set up emulator and run tap E2E test
83108 uses : reactivecircus/android-emulator-runner@v2
84109 with :
@@ -93,22 +118,11 @@ jobs:
93118 # android-emulator-runner runs each line of `script` as a separate
94119 # `sh -c`, so exported vars don't persist between lines and multi-line
95120 # constructs (if/fi) break. Keep every command self-contained on one
96- # line and pass ARGENT_TOOLS_URL inline.
97- #
98- # Start the tool-server HERE (not in an earlier step) so the
99- # simulator-server it spawns inherits this action's HOME, adb, and SDK
100- # env. That backend discovers the emulator's gRPC endpoint from
101- # $XDG_RUNTIME_DIR/avd/running/*.ini (pinned at job level) and shells
102- # out to adb, so it must share the emulator's exact environment.
103- # Backgrounded with our own readiness poll to dodge flow-run's hard
104- # ~15s in-process startup timeout; the process persists after its
105- # launching `sh -c` exits. SIMSERVER_LOG=debug makes the backend's
106- # discovery/connect steps visible in argent-server.log (drop once green).
121+ # line. ARGENT_TOOLS_URL is inherited from the tool-server step above
122+ # via $GITHUB_ENV, so `flow run` reuses that server.
107123 script : |
108- nohup env SIMSERVER_LOG=debug argent server start --detach --no-auth --port 3001 > "$GITHUB_WORKSPACE/argent-server.log" 2>&1 &
109- for i in $(seq 1 60); do curl -fsS http://127.0.0.1:3001/tools >/dev/null 2>&1 && break; sleep 2; done
110124 adb install -r "$(find "$GITHUB_WORKSPACE/apps/expo-example/android/app/build/outputs/apk/release" -name '*.apk' | head -1)"
111- ARGENT_TOOLS_URL=http://127.0.0.1:3001 argent flow run simple-tap-test --device "$(adb devices | awk 'NR>1 && $2=="device"{print $1; exit}')"
125+ argent flow run simple-tap-test --device "$(adb devices | awk 'NR>1 && $2=="device"{print $1; exit}')"
112126
113127 # The simulator-server's stderr (prefixed `[sim <udid>]`) is written to the
114128 # tool-server log — this is where a "simulator-server exited before ready"
0 commit comments