|
58 | 58 | sudo udevadm control --reload-rules |
59 | 59 | sudo udevadm trigger --name-match=kvm |
60 | 60 |
|
61 | | - # Start the tool-server out-of-band and hand `flow run` its URL, so it |
62 | | - # reuses this server instead of spawning one in-process and hitting the |
63 | | - # hard ~15s startup timeout on cold CI runners. The `/tools` endpoint is |
64 | | - # ready without a device attached, so we can start it before the emulator |
65 | | - # boots; the background process persists across steps and the emulator |
66 | | - # step below inherits ARGENT_TOOLS_URL via $GITHUB_ENV. |
67 | | - # |
68 | | - # `server start --detach` can fail to return on CI (its parent keeps the |
69 | | - # child's stdout pipe referenced), so background it with output redirected |
70 | | - # to a file — never the runner's pipe — and poll the port for readiness |
71 | | - # ourselves. |
72 | | - - name: Start Argent tool-server |
73 | | - run: | |
74 | | - nohup argent server start --detach --no-auth --port 3001 \ |
75 | | - > argent-server.log 2>&1 & |
76 | | - echo "Waiting for Argent tool-server on :3001..." |
77 | | - for i in $(seq 1 60); do |
78 | | - if curl -fsS http://127.0.0.1:3001/tools >/dev/null 2>&1; then |
79 | | - echo "tool-server is ready" |
80 | | - echo "ARGENT_TOOLS_URL=http://127.0.0.1:3001" >> "$GITHUB_ENV" |
81 | | - exit 0 |
82 | | - fi |
83 | | - sleep 2 |
84 | | - done |
85 | | - echo "Argent tool-server failed to become ready in time" >&2 |
86 | | - cat argent-server.log >&2 |
87 | | - exit 1 |
88 | | -
|
89 | 61 | - name: Set up emulator and run tap E2E test |
90 | 62 | uses: reactivecircus/android-emulator-runner@v2 |
91 | 63 | with: |
|
96 | 68 | emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
97 | 69 | disable-animations: true |
98 | 70 | # android-emulator-runner runs each line of `script` as a separate |
99 | | - # `sh -c`, so variables don't persist between lines and multi-line |
100 | | - # constructs (if/fi) break. Keep every command self-contained on one line. |
| 71 | + # `sh -c`, so exported vars don't persist between lines and multi-line |
| 72 | + # constructs (if/fi) break. Keep every command self-contained on one |
| 73 | + # line and pass ARGENT_TOOLS_URL inline. |
| 74 | + # |
| 75 | + # Start the tool-server HERE (not in an earlier step) so the |
| 76 | + # simulator-server it spawns inherits this action's HOME, adb, and SDK |
| 77 | + # 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 | 82 | script: | |
102 | | - adb install -r "$(find apps/expo-example/android/app/build/outputs/apk/release -name '*.apk' | head -1)" |
103 | | - argent flow run simple-tap-test --device "$(adb devices | awk 'NR>1 && $2=="device"{print $1; exit}')" |
| 83 | + nohup argent server start --detach --no-auth --port 3001 > "$GITHUB_WORKSPACE/argent-server.log" 2>&1 & |
| 84 | + for i in $(seq 1 60); do curl -fsS http://127.0.0.1:3001/tools >/dev/null 2>&1 && break; sleep 2; done |
| 85 | + adb install -r "$(find "$GITHUB_WORKSPACE/apps/expo-example/android/app/build/outputs/apk/release" -name '*.apk' | head -1)" |
| 86 | + 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}')" |
| 87 | +
|
| 88 | + # The simulator-server's stderr (prefixed `[sim <udid>]`) is written to the |
| 89 | + # tool-server log — this is where a "simulator-server exited before ready" |
| 90 | + # crash reason shows up. Always print it so failures are diagnosable. |
| 91 | + - name: Print Argent tool-server log |
| 92 | + if: always() |
| 93 | + run: cat argent-server.log 2>/dev/null || echo "no argent-server.log" |
0 commit comments