Skip to content

Commit bbca20b

Browse files
committed
Add rn-shell, a React Native (Expo SDK 55) version of the phone app's web view shell, with its Maestro flows and CI for iOS and Android.
The app is one react-native-webview around the web app with a native first screen, system-sheet sign-in through the hand-off, tab bar, lock screen and skeleton. Its behaviour is a pure reducer under src/logic with unit tests; a small local Expo module gives the web view's cookie store, site data clearing, keyboard dismissal and Android's sign-in callback trampoline, and a patch to react-native-webview titles and confines JavaScript dialogs and tells Android navigations' frame and gesture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012xYtaUjbkB1hwLtK4TEzhq
1 parent 2b74165 commit bbca20b

72 files changed

Lines changed: 13991 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: RN shell (Android)
2+
3+
# Builds the React Native shell in rn-shell/ (Expo prebuild, a release build with the test hooks) and
4+
# runs its Maestro flows on an Android emulator: against two mock stacks of this branch's built web
5+
# app (app/workbench/mock-server.ts), and against the hosted web app at my.open.bot.
6+
#
7+
# Artifacts: rn-shell-android-<run id> (SUMMARY.md, results, screenshots under shots/, logs) and,
8+
# only when the signed-in real-backend journey ran, rn-shell-android-private-<run id>.
9+
# Optional repository secret: OPENBOT_SHELL_TEST_SESSION (the real-backend signed-in journey skips
10+
# without it). On a public repository Actions artifacts can be downloaded by any signed-in GitHub user.
11+
on:
12+
push:
13+
branches:
14+
- rn-webview-shell
15+
paths:
16+
- rn-shell/**
17+
- .github/workflows/rn-shell-android.yml
18+
workflow_dispatch:
19+
inputs:
20+
only:
21+
description: Comma-separated flow names to run (empty runs every flow)
22+
type: string
23+
default: ""
24+
25+
permissions: {}
26+
27+
concurrency:
28+
group: rn-shell-android-${{ github.ref }}
29+
cancel-in-progress: true
30+
31+
jobs:
32+
emulator:
33+
name: Build and test on the Android emulator
34+
if: github.repository == 'CopilotKit/OpenBot'
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 40
37+
permissions:
38+
contents: read
39+
env:
40+
API_LEVEL: "35"
41+
ARTIFACTS: ${{ github.workspace }}/artifacts
42+
PRIVATE_ARTIFACTS: ${{ github.workspace }}/private-artifacts
43+
ONLY: ${{ inputs.only || '' }}
44+
steps:
45+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46+
with:
47+
persist-credentials: false
48+
49+
- name: Start the clock
50+
run: |
51+
mkdir -p "$ARTIFACTS" "$PRIVATE_ARTIFACTS"
52+
echo "$(date +%s) start" > "$RUNNER_TEMP/timing"
53+
54+
- name: Cache the emulator's system image
55+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
56+
with:
57+
path: /usr/local/lib/android/sdk/system-images/android-35/google_apis/x86_64
58+
key: android-system-image-35-google_apis-x86_64-v1
59+
60+
- name: Boot the emulator in the background (guest GPU)
61+
env:
62+
GPU_MODE: guest
63+
run: |
64+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules > /dev/null
65+
sudo udevadm control --reload-rules
66+
sudo udevadm trigger --name-match=kvm
67+
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
68+
nohup bash -c 'rn-shell/ci/emulator.sh boot && touch "$1/emulator.booted" || touch "$1/emulator.failed"' boot "$ARTIFACTS" \
69+
> "$ARTIFACTS/emulator-boot.log" 2>&1 &
70+
71+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
72+
with:
73+
bun-version: 1.4.3
74+
75+
- name: Look for the built web app in the cache
76+
id: web-cache
77+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
78+
with:
79+
path: app/dist
80+
key: rn-shell-web-${{ hashFiles('app/src/**', 'app/public/**', 'app/index.html', 'app/package.json', 'app/vite.config.*', 'app/tsconfig*.json', 'shared/**', 'tokens/**', 'bun.lock', 'package.json', '.env.example') }}
81+
82+
- name: Build the web app and start the servers in the background
83+
run: nohup rn-shell/ci/start_servers.sh "$ARTIFACTS" > /dev/null 2>&1 &
84+
85+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
86+
with:
87+
node-version: "22"
88+
cache: npm
89+
cache-dependency-path: rn-shell/package-lock.json
90+
91+
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
92+
with:
93+
distribution: temurin
94+
java-version: "17"
95+
96+
- name: Cache Gradle
97+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
98+
with:
99+
path: |
100+
~/.gradle/caches
101+
~/.gradle/wrapper
102+
key: rn-shell-gradle-${{ hashFiles('rn-shell/package-lock.json', 'rn-shell/patches/**') }}
103+
restore-keys: rn-shell-gradle-
104+
105+
- name: Install, check and prebuild the test build
106+
timeout-minutes: 6
107+
working-directory: rn-shell
108+
env:
109+
EXPO_PUBLIC_OPENBOT_TEST_BUILD: "1"
110+
run: |
111+
echo "$(date +%s) npm" >> "$RUNNER_TEMP/timing"
112+
npm ci --no-audit --no-fund
113+
npx tsc --noEmit
114+
bun test __tests__
115+
npx expo prebuild --platform android --no-install --clean
116+
sed -i 's/^org.gradle.jvmargs=.*/org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g/' android/gradle.properties
117+
echo "org.gradle.caching=true" >> android/gradle.properties
118+
119+
- name: Build the release APK with the test hooks (x86_64)
120+
timeout-minutes: 20
121+
working-directory: rn-shell/android
122+
env:
123+
EXPO_PUBLIC_OPENBOT_TEST_BUILD: "1"
124+
run: |
125+
echo "$(date +%s) gradle" >> "$RUNNER_TEMP/timing"
126+
./gradlew --no-daemon :app:assembleRelease -PreactNativeArchitectures=x86_64 2>&1 \
127+
| tee "$ARTIFACTS/gradle.log" | grep -E "BUILD|error:|^e: |FAILURE" || true
128+
test -f app/build/outputs/apk/release/app-release.apk || { tail -n 120 "$ARTIFACTS/gradle.log"; exit 1; }
129+
ls -la app/build/outputs/apk/release/
130+
131+
- name: Free the build's memory for the emulator
132+
run: |
133+
(cd rn-shell/android && ./gradlew --stop > /dev/null 2>&1) || true
134+
pkill -f KotlinCompileDaemon || true
135+
free -m
136+
137+
- name: Install Maestro
138+
timeout-minutes: 4
139+
run: |
140+
echo "$(date +%s) maestro" >> "$RUNNER_TEMP/timing"
141+
curl -fsSL "https://get.maestro.mobile.dev" | bash > "$ARTIFACTS/maestro-install.log" 2>&1
142+
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
143+
"$HOME/.maestro/bin/maestro" --version
144+
145+
- name: Wait for the emulator and the servers, then install the app
146+
timeout-minutes: 12
147+
run: |
148+
echo "$(date +%s) wait" >> "$RUNNER_TEMP/timing"
149+
rn-shell/ci/wait_for.sh "$ARTIFACTS/emulator.booted" "$ARTIFACTS/emulator.failed" 600 "$ARTIFACTS/emulator-boot.log"
150+
GPU_MODE=guest rn-shell/ci/emulator.sh prepare
151+
rn-shell/ci/emulator.sh describe
152+
rn-shell/ci/wait_for.sh "$ARTIFACTS/servers.ready" "$ARTIFACTS/servers.failed" 420 "$ARTIFACTS/servers.log"
153+
adb install -r -g rn-shell/android/app/build/outputs/apk/release/app-release.apk
154+
adb shell pm list packages | grep ai.openbot
155+
156+
- name: Run the mock suite
157+
id: mock
158+
timeout-minutes: 25
159+
run: |
160+
echo "$(date +%s) mock-suite" >> "$RUNNER_TEMP/timing"
161+
adb logcat -c || true
162+
nohup adb logcat -v time ReactNativeJS:V ReactNative:W chromium:W '*:S' > "$ARTIFACTS/logcat.txt" 2>&1 &
163+
python3 rn-shell/ci/run_flows.py --platform android --suite mock --artifacts "$ARTIFACTS" --only "$ONLY"
164+
165+
- name: Run the real-backend suite
166+
if: always() && steps.mock.conclusion != 'cancelled'
167+
timeout-minutes: 12
168+
env:
169+
OPENBOT_SHELL_TEST_SESSION: ${{ secrets.OPENBOT_SHELL_TEST_SESSION }}
170+
run: |
171+
echo "$(date +%s) real-suite" >> "$RUNNER_TEMP/timing"
172+
python3 rn-shell/ci/run_flows.py --platform android --suite real --artifacts "$ARTIFACTS" --private "$PRIVATE_ARTIFACTS" --only "$ONLY"
173+
174+
- name: Keep the built web app for the next run
175+
if: always() && steps.web-cache.outputs.cache-hit != 'true' && hashFiles('app/dist/index.html') != ''
176+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
177+
with:
178+
path: app/dist
179+
key: ${{ steps.web-cache.outputs.cache-primary-key }}
180+
181+
- name: Summary
182+
if: always()
183+
run: |
184+
echo "$(date +%s) end" >> "$RUNNER_TEMP/timing"
185+
grep -h OPENBOT_DIAG "$ARTIFACTS/logcat.txt" > "$ARTIFACTS/diagnostics.txt" 2>/dev/null || true
186+
{
187+
[ -f "$ARTIFACTS/SUMMARY.md" ] && cat "$ARTIFACTS/SUMMARY.md"
188+
echo "### Seconds per step"
189+
awk 'NR > 1 { printf "- %s: %d s\n", name, $1 - previous } { previous = $1; name = $2 }' "$RUNNER_TEMP/timing"
190+
} | tee -a "$GITHUB_STEP_SUMMARY"
191+
cp "$RUNNER_TEMP/timing" "$ARTIFACTS/timing.txt" || true
192+
if [ -n "$(ls -A "$PRIVATE_ARTIFACTS" 2>/dev/null)" ]; then echo "HAS_PRIVATE=1" >> "$GITHUB_ENV"; fi
193+
194+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
195+
if: always()
196+
with:
197+
name: rn-shell-android-${{ github.run_id }}
198+
path: artifacts/
199+
retention-days: 14
200+
if-no-files-found: warn
201+
202+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
203+
if: always() && env.HAS_PRIVATE == '1'
204+
with:
205+
name: rn-shell-android-private-${{ github.run_id }}
206+
path: private-artifacts/
207+
retention-days: 7
208+
if-no-files-found: ignore
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: RN shell (checks and store builds)
2+
3+
# The React Native shell's checks that need no simulator: typecheck and unit tests, then what a store
4+
# build ships. The store build is the one made WITHOUT EXPO_PUBLIC_OPENBOT_TEST_BUILD: this proves it
5+
# has none of the test hooks in its JavaScript, no App Transport Security exception and no URL scheme
6+
# on iOS, no cleartext on Android, and measures the Android store APK (arm64-v8a).
7+
on:
8+
push:
9+
branches:
10+
- rn-webview-shell
11+
paths:
12+
- rn-shell/**
13+
- .github/workflows/rn-shell-checks.yml
14+
workflow_dispatch:
15+
16+
permissions: {}
17+
18+
concurrency:
19+
group: rn-shell-checks-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
store:
24+
name: Unit tests and the store builds' contents
25+
if: github.repository == 'CopilotKit/OpenBot'
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 30
28+
permissions:
29+
contents: read
30+
env:
31+
ARTIFACTS: ${{ github.workspace }}/artifacts
32+
steps:
33+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34+
with:
35+
persist-credentials: false
36+
37+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
38+
with:
39+
bun-version: 1.4.3
40+
41+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
42+
with:
43+
node-version: "22"
44+
cache: npm
45+
cache-dependency-path: rn-shell/package-lock.json
46+
47+
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
48+
with:
49+
distribution: temurin
50+
java-version: "17"
51+
52+
- name: Install, typecheck, unit tests
53+
timeout-minutes: 6
54+
working-directory: rn-shell
55+
run: |
56+
mkdir -p "$ARTIFACTS"
57+
npm ci --no-audit --no-fund
58+
npx tsc --noEmit
59+
bun test __tests__ 2>&1 | tee "$ARTIFACTS/unit-tests.txt"
60+
61+
- name: The store configuration (prebuild without the test flag)
62+
timeout-minutes: 4
63+
working-directory: rn-shell
64+
run: bash ci/check_store.sh config "$ARTIFACTS"
65+
66+
- name: The store JavaScript bundles have no test hooks
67+
timeout-minutes: 6
68+
working-directory: rn-shell
69+
run: bash ci/check_store.sh bundles "$ARTIFACTS"
70+
71+
- name: Cache Gradle
72+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
73+
with:
74+
path: |
75+
~/.gradle/caches
76+
~/.gradle/wrapper
77+
key: rn-shell-gradle-store-${{ hashFiles('rn-shell/package-lock.json', 'rn-shell/patches/**') }}
78+
restore-keys: rn-shell-gradle-
79+
80+
- name: Build the Android store APK (arm64-v8a) and check it
81+
timeout-minutes: 20
82+
working-directory: rn-shell
83+
run: bash ci/check_store.sh apk "$ARTIFACTS"
84+
85+
- name: Summary
86+
if: always()
87+
run: |
88+
[ -f "$ARTIFACTS/STORE.md" ] && cat "$ARTIFACTS/STORE.md" >> "$GITHUB_STEP_SUMMARY" || true
89+
90+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
91+
if: always()
92+
with:
93+
name: rn-shell-checks-${{ github.run_id }}
94+
path: artifacts/
95+
retention-days: 14
96+
if-no-files-found: warn

0 commit comments

Comments
 (0)