@@ -3,67 +3,232 @@ name: Metro E2E Tests
33on :
44 workflow_call :
55
6+ permissions :
7+ actions : read
8+ contents : read
9+
10+ concurrency :
11+ group : e2e-tests-${{ github.workflow }}-${{ github.ref }}
12+ cancel-in-progress : true
13+
14+ env :
15+ METRO_APP_NAME : example-host
16+
617jobs :
7- build-metro :
18+ e2e-metro-check-affected :
19+ runs-on : ubuntu-latest
20+ timeout-minutes : 30
21+ outputs :
22+ should_run_e2e : ${{ steps.affected.outputs.should-run-e2e }}
23+ steps :
24+ - name : Check out repository
25+ uses : actions/checkout@v5
26+ with :
27+ fetch-depth : 0
28+
29+ - name : Set up pnpm
30+ uses : pnpm/action-setup@v4
31+
32+ - name : Set up Node.js 20
33+ uses : actions/setup-node@v6
34+ with :
35+ node-version : ' 20'
36+ cache : ' pnpm'
37+ cache-dependency-path : ' **/pnpm-lock.yaml'
38+
39+ - name : Export SKIP_DEVTOOLS_POSTINSTALL
40+ run : echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> "$GITHUB_ENV"
41+ shell : bash
42+
43+ - name : Install pnpm dependencies
44+ run : pnpm install --frozen-lockfile
45+
46+ - name : Evaluate Metro affected scope
47+ id : affected
48+ run : |
49+ ci_status=0
50+ node tools/scripts/ci-is-affected.mjs --appName=${{ env.METRO_APP_NAME }} || ci_status=$?
51+ if [ "$ci_status" -eq 0 ]; then
52+ echo "should-run-e2e=true" >> "$GITHUB_OUTPUT"
53+ elif [ "$ci_status" -eq 1 ]; then
54+ echo "should-run-e2e=false" >> "$GITHUB_OUTPUT"
55+ else
56+ echo "ci-is-affected failed with unexpected exit code: $ci_status" >&2
57+ exit "$ci_status"
58+ fi
59+
60+ e2e-metro-android :
61+ needs : e2e-metro-check-affected
62+ if : needs.e2e-metro-check-affected.outputs.should_run_e2e == 'true'
863 runs-on : ubuntu-latest
964 timeout-minutes : 60
65+ env :
66+ ANDROID_EMULATOR_API_LEVEL : 28
67+ ANDROID_EMULATOR_TARGET : default
68+ ANDROID_EMULATOR_ARCH : x86_64
69+ ANDROID_EMULATOR_DISK_SPACE : 1024M
70+ ANDROID_EMULATOR_RAM_SIZE : 256M
71+ ANDROID_EMULATOR_HEAP_SIZE : 256M
72+ ANDROID_EMULATOR_BOOT_TIMEOUT : 2700
1073 steps :
11- - name : Checkout Repository
74+ - name : Check out repository
1275 uses : actions/checkout@v5
1376 with :
1477 fetch-depth : 0
78+ submodules : true
79+ clean : true
1580
16- - name : Setup pnpm
81+ - name : Set up pnpm
1782 uses : pnpm/action-setup@v4
1883
19- - name : Setup Node.js 20
84+ - name : Set up Node.js 20
2085 uses : actions/setup-node@v6
2186 with :
2287 node-version : ' 20'
2388 cache : ' pnpm'
2489 cache-dependency-path : ' **/pnpm-lock.yaml'
2590
26- - name : Install dependencies
91+ - name : Export SKIP_DEVTOOLS_POSTINSTALL
92+ run : echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> "$GITHUB_ENV"
93+ shell : bash
94+
95+ - name : Install pnpm dependencies
2796 run : pnpm install --frozen-lockfile
2897
29- - name : Restore Turborepo cache
30- uses : actions/cache@v5
98+ - name : Configure KVM for Android emulator
99+ run : |
100+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
101+ sudo udevadm control --reload-rules
102+ sudo udevadm trigger --name-match=kvm
103+ shell : bash
104+
105+ - name : Build shared packages
106+ run : pnpm run build:packages
107+ shell : bash
108+
109+ - name : Install Maestro CLI
110+ run : |
111+ curl -Ls "https://get.maestro.mobile.dev" | bash
112+ echo "${HOME}/.maestro/bin" >> "$GITHUB_PATH"
113+ shell : bash
114+
115+ - name : Configure RNEF cache auth
116+ shell : bash
117+ run : |
118+ RNEF_PATH="apps/metro-${{ env.METRO_APP_NAME }}/.rnef/cache"
119+ mkdir -p "$RNEF_PATH"
120+ echo "{\"githubToken\": \"${{ secrets.GITHUB_TOKEN }}\"}" > "$RNEF_PATH/project.json"
121+
122+ - name : Build Metro Android app (RNEF action)
123+ uses : callstackincubator/android@v1
31124 with :
32- path : |
33- .turbo
34- **/.turbo
35- key : ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }}
36- restore-keys : |
37- ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.ref_name }}-
38- ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}-
39- ${{ runner.os }}-turbo-
125+ github-token : ${{ secrets.GITHUB_TOKEN }}
126+ comment-bot : false
127+ variant : ' Release'
128+ working-directory : ' ./apps/metro-${{ env.METRO_APP_NAME }}'
40129
41- - name : Verify Rslib Template Publint Wiring
42- run : node packages/create-module-federation/scripts/verify-rslib-templates.mjs
130+ - name : Run Metro Android E2E tests
131+ uses : reactivecircus/android-emulator-runner@v2
132+ env :
133+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134+ with :
135+ api-level : ${{ env.ANDROID_EMULATOR_API_LEVEL }}
136+ target : ${{ env.ANDROID_EMULATOR_TARGET }}
137+ arch : ${{ env.ANDROID_EMULATOR_ARCH }}
138+ ram-size : ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
139+ heap-size : ${{ env.ANDROID_EMULATOR_HEAP_SIZE }}
140+ disk-size : ${{ env.ANDROID_EMULATOR_DISK_SPACE }}
141+ emulator-boot-timeout : ${{ env.ANDROID_EMULATOR_BOOT_TIMEOUT }}
142+ force-avd-creation : false
143+ disable-animations : true
144+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
145+ script : |
146+ node tools/scripts/run-metro-e2e.mjs --platform=android --appName=${{ env.METRO_APP_NAME }} --skip-rnef-cache-auth
43147
44- - name : Verify Package Rslib Publint Wiring
45- run : node tools/scripts/verify-rslib-publint-coverage.mjs
148+ - name : Upload Android Maestro logs on failure
149+ if : failure()
150+ uses : actions/upload-artifact@v4
151+ with :
152+ name : maestro-logs-android-${{ env.METRO_APP_NAME }}
153+ path : ~/.maestro/tests/
46154
47- - name : Verify Publint Workflow Coverage
48- run : node tools/scripts/verify-publint-workflow-coverage.mjs
155+ e2e-metro-ios :
156+ needs : e2e-metro-check-affected
157+ if : needs.e2e-metro-check-affected.outputs.should_run_e2e == 'true'
158+ runs-on : macos-latest
159+ timeout-minutes : 60
160+ env :
161+ RUBY_VERSION : 2.7.6
162+ MAESTRO_VERSION : 1.39.13
163+ MAESTRO_DRIVER_STARTUP_TIMEOUT : 600000
164+ steps :
165+ - name : Check out repository
166+ uses : actions/checkout@v5
167+ with :
168+ fetch-depth : 0
169+ submodules : true
170+ clean : true
49171
50- - name : Verify Turbo Conventions
51- run : pnpm run verify:turbo
172+ - name : Set up pnpm
173+ uses : pnpm/action-setup@v4
174+
175+ - name : Set up Node.js 20
176+ uses : actions/setup-node@v6
177+ with :
178+ node-version : ' 20'
179+ cache : ' pnpm'
180+ cache-dependency-path : ' **/pnpm-lock.yaml'
181+
182+ - name : Export SKIP_DEVTOOLS_POSTINSTALL
183+ run : echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> "$GITHUB_ENV"
184+ shell : bash
185+
186+ - name : Install pnpm dependencies
187+ run : pnpm install --frozen-lockfile
188+
189+ - name : Set up Ruby
190+ uses : ruby/setup-ruby@v1
191+ with :
192+ ruby-version : ${{ env.RUBY_VERSION }}
52193
53194 - name : Build shared packages
54195 run : pnpm run build:packages
196+ shell : bash
55197
56- - name : Check metro package publishing compatibility
198+ - name : Install Maestro CLI and iOS Utilities
57199 run : |
58- for pkg in packages/metro-*; do
59- if [ -f "$pkg/package.json" ]; then
60- echo "Checking $pkg..."
61- npx publint "$pkg"
62- fi
63- done
64-
65- - name : Test metro packages
66- run : pnpm exec turbo run test --filter=@module-federation/metro*
67-
68- - name : Lint metro packages
69- run : pnpm exec turbo run lint --filter=@module-federation/metro*
200+ curl -Ls "https://get.maestro.mobile.dev" | bash
201+ brew tap facebook/fb
202+ brew install facebook/fb/idb-companion
203+ echo "${HOME}/.maestro/bin" >> "$GITHUB_PATH"
204+ shell : bash
205+
206+ - name : Configure RNEF cache auth
207+ shell : bash
208+ run : |
209+ RNEF_PATH="apps/metro-${{ env.METRO_APP_NAME }}/.rnef/cache"
210+ mkdir -p "$RNEF_PATH"
211+ echo "{\"githubToken\": \"${{ secrets.GITHUB_TOKEN }}\"}" > "$RNEF_PATH/project.json"
212+
213+ - name : Build Metro iOS app (RNEF action)
214+ uses : callstackincubator/ios@v1
215+ with :
216+ github-token : ${{ secrets.GITHUB_TOKEN }}
217+ comment-bot : false
218+ destination : ' simulator'
219+ scheme : ' MFExampleHost'
220+ configuration : ' Release'
221+ working-directory : ' ./apps/metro-${{ env.METRO_APP_NAME }}'
222+
223+ - name : Run Metro iOS E2E tests
224+ env :
225+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
226+ run : node tools/scripts/run-metro-e2e.mjs --platform=ios --appName=${{ env.METRO_APP_NAME }} --skip-rnef-cache-auth
227+ shell : bash
228+
229+ - name : Upload iOS Maestro logs on failure
230+ if : failure()
231+ uses : actions/upload-artifact@v4
232+ with :
233+ name : maestro-logs-ios-${{ env.METRO_APP_NAME }}
234+ path : ~/.maestro/tests/
0 commit comments