2525 group : android-e2e-${{ github.ref }}
2626 cancel-in-progress : true
2727
28+ # Pin the emulator "discovery directory" for BOTH the emulator (launched by
29+ # the action) and the simulator-server backend (spawned by the tool-server
30+ # inside the action's script). The Android touch/key backend finds the
31+ # running emulator's gRPC console by scanning $XDG_RUNTIME_DIR/avd/running/
32+ # pid_*.ini for grpc.port/grpc.token. XDG_RUNTIME_DIR is unset on GitHub
33+ # runners and /run/user/$UID doesn't exist for the runner user, so the
34+ # emulator and the backend can otherwise resolve DIFFERENT fallback dirs —
35+ # the backend then logs "Failed to find any running emulator" and exits
36+ # before becoming ready. Pinning it (checked first by both) removes that
37+ # divergence. Job-level env reaches every step, including the emulator
38+ # subprocess the action spawns.
39+ env :
40+ XDG_RUNTIME_DIR : /tmp/xdg-runtime
41+
2842 steps :
2943 - name : checkout
3044 uses : actions/checkout@v4
@@ -58,14 +72,23 @@ jobs:
5872 sudo udevadm control --reload-rules
5973 sudo udevadm trigger --name-match=kvm
6074
75+ # Must exist BEFORE the emulator boots: the emulator falls back to another
76+ # dir if XDG_RUNTIME_DIR points at a missing path. 0700 per the XDG spec.
77+ - name : Prepare shared XDG_RUNTIME_DIR
78+ run : |
79+ mkdir -p "$XDG_RUNTIME_DIR"
80+ chmod 700 "$XDG_RUNTIME_DIR"
81+
6182 - name : Set up emulator and run tap E2E test
6283 uses : reactivecircus/android-emulator-runner@v2
6384 with :
6485 api-level : 34
6586 target : google_apis
6687 arch : x86_64
6788 force-avd-creation : false
68- emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
89+ # `-grpc 8554` guarantees grpc.port is written to the discovery ini
90+ # (token-less is fine — the backend handles a missing grpc.token).
91+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -grpc 8554 -camera-back none
6992 disable-animations : true
7093 # android-emulator-runner runs each line of `script` as a separate
7194 # `sh -c`, so exported vars don't persist between lines and multi-line
@@ -75,12 +98,14 @@ jobs:
7598 # Start the tool-server HERE (not in an earlier step) so the
7699 # simulator-server it spawns inherits this action's HOME, adb, and SDK
77100 # env. That backend discovers the emulator's gRPC endpoint from
78- # $HOME/.android/avd/running/*.ini and shells out to adb, so it must
79- # share the emulator's exact environment. Backgrounded with our own
80- # readiness poll to dodge flow-run's hard ~15s in-process startup
81- # timeout; the process persists after its launching `sh -c` exits.
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).
82107 script : |
83- nohup argent server start --detach --no-auth --port 3001 > "$GITHUB_WORKSPACE/argent-server.log" 2>&1 &
108+ nohup env SIMSERVER_LOG=debug argent server start --detach --no-auth --port 3001 > "$GITHUB_WORKSPACE/argent-server.log" 2>&1 &
84109 for i in $(seq 1 60); do curl -fsS http://127.0.0.1:3001/tools >/dev/null 2>&1 && break; sleep 2; done
85110 adb install -r "$(find "$GITHUB_WORKSPACE/apps/expo-example/android/app/build/outputs/apk/release" -name '*.apk' | head -1)"
86111 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}')"
0 commit comments