Repository navigation
270 lines (243 loc) · 9.47 KB
/
Copy pathe2e.yml
File metadata and controls
270 lines (243 loc) · 9.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: E2E Tests
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect native changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
native: ${{ steps.filter.outputs.native }}
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Path filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: .github/path-filters.yml
e2e-ios:
name: E2E iOS (${{ matrix.app }})
needs: changes
if: ${{ needs.changes.outputs.native == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- app: rn
dir: playground-rn
workspace: PlaygroundRN.xcworkspace
scheme: PlaygroundRN
app_name: PlaygroundRN
bundle_id: com.rnziparchive.playground.rn
runner: macos-15
- app: expo
dir: playground-expo
workspace: RNZipArchivePlayground.xcworkspace
scheme: RNZipArchivePlayground
app_name: RNZipArchivePlayground
bundle_id: com.rnziparchive.playground.expo
runner: macos-26
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
- name: Install Maestro
run: |
set -euo pipefail
for attempt in 1 2 3; do
echo "Installing Maestro (attempt $attempt)..."
if curl -fsSL "https://get.maestro.mobile.dev" | bash \
&& test -x "$HOME/.maestro/bin/maestro"; then
break
fi
echo "Maestro install failed on attempt $attempt"
rm -rf "$HOME/.maestro"
if [ "$attempt" -eq 3 ]; then
echo "Maestro install failed after 3 attempts"
exit 1
fi
sleep $((attempt * 5))
done
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
"$HOME/.maestro/bin/maestro" --version
- name: Cache node_modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ matrix.dir }}/node_modules
key: ${{ runner.os }}-${{ matrix.app }}-node-${{ hashFiles(format('{0}/package.json', matrix.dir)) }}
- name: Install dependencies
working-directory: ${{ matrix.dir }}
run: |
if [ -f "pnpm-lock.yaml" ]; then
npm install -g pnpm@9
pnpm install
else
npm install
fi
- name: Cache CocoaPods
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ matrix.dir }}/ios/Pods
key: ${{ runner.os }}-${{ matrix.app }}-pods-${{ hashFiles(format('{0}/ios/Podfile.lock', matrix.dir)) }}
- name: Install CocoaPods
working-directory: ${{ matrix.dir }}/ios
run: |
gem install cocoapods -v '>= 1.13'
pod install
- name: Build iOS app
working-directory: ${{ matrix.dir }}/ios
run: |
xcodebuild \
-workspace ${{ matrix.workspace }} \
-scheme ${{ matrix.scheme }} \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
COMPILER_INDEX_STORE_ENABLE=NO
- name: Boot iOS Simulator
run: |
DEVICE_ID=$(xcrun simctl list devices | grep -E 'iPhone [0-9]+ \(' | grep -oE '[0-9A-F]{8}-([0-9A-F]{4}-){3}[0-9A-F]{12}' | head -1)
echo "Booting simulator: $DEVICE_ID"
xcrun simctl boot "$DEVICE_ID"
echo "MAESTRO_IOS_DEVICE=$DEVICE_ID" >> $GITHUB_ENV
xcrun simctl bootstatus "$DEVICE_ID"
- name: Run E2E tests
env:
MAESTRO_DRIVER_STARTUP_TIMEOUT: 300000
run: |
APP_PATH="${{ matrix.dir }}/ios/build/Build/Products/Release-iphonesimulator/${{ matrix.app_name }}.app"
xcrun simctl install "$MAESTRO_IOS_DEVICE" "$APP_PATH"
export APP_ID="${{ matrix.bundle_id }}"
maestro test --device="$MAESTRO_IOS_DEVICE" --env APP_ID="$APP_ID" .maestro/flows/ci-master.yaml
- name: Upload Maestro debug artifacts
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: maestro-debug-ios-${{ matrix.app }}
path: ~/.maestro/tests/
- name: Upload iOS crash logs
if: failure()
run: |
mkdir -p crash-logs
cp ~/Library/Logs/DiagnosticReports/*.crash crash-logs/ 2>/dev/null || true
ls crash-logs/ || echo "No crash logs found"
shell: bash
- name: Upload crash logs artifact
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ios-crash-logs-${{ matrix.app }}
path: crash-logs/
e2e-android:
name: E2E Android (${{ matrix.app }})
needs: changes
if: ${{ needs.changes.outputs.native == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- app: rn
dir: playground-rn
bundle_id: com.rnziparchive.playground.rn
- app: expo
dir: playground-expo
bundle_id: com.rnziparchive.playground.expo
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
- name: Setup Java
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
with:
distribution: 'zulu'
java-version: '17'
- name: Install Maestro
run: |
set -euo pipefail
for attempt in 1 2 3; do
echo "Installing Maestro (attempt $attempt)..."
if curl -fsSL "https://get.maestro.mobile.dev" | bash \
&& test -x "$HOME/.maestro/bin/maestro"; then
break
fi
echo "Maestro install failed on attempt $attempt"
rm -rf "$HOME/.maestro"
if [ "$attempt" -eq 3 ]; then
echo "Maestro install failed after 3 attempts"
exit 1
fi
sleep $((attempt * 5))
done
echo "$HOME/.maestro/bin" >> "$GITHUB_PATH"
"$HOME/.maestro/bin/maestro" --version
- name: Cache node_modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ matrix.dir }}/node_modules
key: ${{ runner.os }}-${{ matrix.app }}-node-${{ hashFiles(format('{0}/package.json', matrix.dir)) }}
- name: Install dependencies
working-directory: ${{ matrix.dir }}
run: |
if [ -f "pnpm-lock.yaml" ]; then
npm install -g pnpm@9
pnpm install
else
npm install
fi
- name: Cache Gradle
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.app }}-gradle-${{ hashFiles(format('{0}/android/gradle/wrapper/gradle-wrapper.properties', matrix.dir), format('{0}/android/build.gradle', matrix.dir)) }}
restore-keys: |
${{ runner.os }}-${{ matrix.app }}-gradle-
- name: Build Android app
working-directory: ${{ matrix.dir }}/android
run: ./gradlew :app:assembleRelease
- name: Run E2E tests on Android emulator
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
with:
api-level: 29
arch: x86_64
cores: 4
ram-size: 4096M
heap-size: 1024M
disk-size: 4096M
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
# Expo's heavier UI can trigger a system-level ANR dialog on the
# low-memory GitHub Actions emulator. hide_error_dialogs is the
# documented AOSP global setting (Settings.Global.HIDE_ERROR_DIALOGS)
# used by CTS/Input ANR tests to suppress error dialogs on API 29+.
# Maestro still dismisses any dialog that slips through (_setup.yaml).
adb shell settings put global hide_error_dialogs 1
adb install ${{ matrix.dir }}/android/app/build/outputs/apk/release/app-release.apk
maestro test --env APP_ID="${{ matrix.bundle_id }}" .maestro/flows/ci-master.yaml
- name: Upload Maestro debug artifacts
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: maestro-debug-android-${{ matrix.app }}
path: ~/.maestro/tests/