Skip to content

Commit 278b840

Browse files
committed
test(e2e): split e2e into separate ios and android
Frequently one fails but not the other and it is a tremendous waste to have to re-run both all the time
1 parent 3396da2 commit 278b840

File tree

2 files changed

+175
-160
lines changed

2 files changed

+175
-160
lines changed

.github/workflows/tests_e2e.yml renamed to .github/workflows/tests_e2e_android.yml

Lines changed: 1 addition & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing E2E
1+
name: Testing E2E Android
22

33
on:
44
pull_request:
@@ -20,9 +20,6 @@ on:
2020
- '**/*.md'
2121

2222
jobs:
23-
# ------------------
24-
# Android
25-
# ------------------
2623
android:
2724
name: Android
2825
runs-on: macos-latest
@@ -208,159 +205,3 @@ jobs:
208205
with:
209206
name: adb_logs
210207
path: adb-log.txt.gz
211-
212-
# ------------------
213-
# iOS
214-
# ------------------
215-
ios:
216-
name: iOS
217-
runs-on: macos-latest
218-
# TODO matrix across APIs, at least 10 and 13 (lowest to highest)
219-
timeout-minutes: 60
220-
env:
221-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
222-
steps:
223-
- uses: styfle/[email protected]
224-
with:
225-
all_but_latest: true
226-
227-
- uses: actions/checkout@v2
228-
with:
229-
fetch-depth: 50
230-
231-
- uses: actions/setup-node@v2
232-
with:
233-
node-version: 14
234-
235-
- uses: maxim-lobanov/setup-xcode@v1
236-
with:
237-
xcode-version: latest-stable
238-
239-
- name: Install firebase CLI
240-
uses: nick-invision/retry@v2
241-
with:
242-
timeout_minutes: 10
243-
retry_wait_seconds: 60
244-
max_attempts: 3
245-
command: npm i -g firebase-tools
246-
247-
- name: Cache Firestore Emulator
248-
uses: actions/cache@v2
249-
with:
250-
path: ~/.cache/firebase/emulators
251-
key: firebase-emulators-v1
252-
253-
- name: Start Firestore Emulator
254-
run: yarn tests:emulator:start-ci
255-
256-
- name: Get Xcode version
257-
id: xcode-version
258-
run: echo "::set-output name=xcode-version::$(xcodebuild -version|tail -1|cut -f3 -d' ')"
259-
260-
- name: Get yarn cache directory path
261-
id: yarn-cache-dir-path
262-
run: echo "::set-output name=dir::$(yarn cache dir)"
263-
264-
- uses: actions/cache@v2
265-
name: Yarn Cache
266-
id: yarn-cache
267-
with:
268-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
269-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
270-
271-
- uses: actions/cache@v2
272-
name: Cache Pods
273-
with:
274-
path: tests/ios/Pods
275-
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}-v1
276-
277-
- uses: actions/cache@v2
278-
name: Detox Framework Cache
279-
with:
280-
path: ~/Library/Detox/ios
281-
key: ${{ runner.os }}-detox-framework-cache-${{ steps.xcode-version.outputs.xcode-version }}
282-
283-
- name: Yarn Install
284-
uses: nick-invision/retry@v2
285-
with:
286-
timeout_minutes: 10
287-
retry_wait_seconds: 60
288-
max_attempts: 3
289-
command: yarn --no-audit --prefer-offline
290-
291-
- name: Update Ruby build tools
292-
uses: nick-invision/retry@v2
293-
with:
294-
timeout_minutes: 10
295-
retry_wait_seconds: 60
296-
max_attempts: 3
297-
command: gem update cocoapods xcodeproj
298-
299-
- name: Pod Install
300-
uses: nick-invision/retry@v2
301-
with:
302-
timeout_minutes: 10
303-
retry_wait_seconds: 60
304-
max_attempts: 3
305-
command: yarn tests:ios:pod:install
306-
307-
- name: Build iOS App
308-
run: |
309-
export SKIP_BUNDLING=1
310-
export RCT_NO_LAUNCH_PACKAGER=1
311-
cd tests
312-
set -o pipefail
313-
./node_modules/.bin/detox build --configuration ios.sim.debug
314-
shell: bash
315-
316-
- name: Install applesimutils
317-
uses: nick-invision/retry@v2
318-
with:
319-
timeout_minutes: 10
320-
retry_wait_seconds: 60
321-
max_attempts: 3
322-
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils && applesimutils --list
323-
324-
- name: Pre-fetch Javascript bundle
325-
run: |
326-
nohup yarn tests:packager:jet &
327-
printf 'Waiting for packager to come online'
328-
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
329-
printf '.'
330-
sleep 2
331-
done
332-
echo "Packager is online! Preparing bundle..."
333-
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
334-
echo "...javascript bundle ready"
335-
336-
- name: Create Simulator Log
337-
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
338-
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
339-
continue-on-error: true
340-
run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"
341-
342-
- name: Detox Test
343-
timeout-minutes: 40
344-
run: |
345-
cd tests
346-
./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup
347-
348-
- name: Compress Simulator Log
349-
if: always()
350-
run: gzip -9 simulator.log
351-
352-
- name: Upload Simulator Log
353-
uses: actions/upload-artifact@v2
354-
if: always()
355-
with:
356-
name: simulator_logs
357-
path: simulator.log.gz
358-
359-
- name: Submit Coverage
360-
# This can fail on timeouts etc, wrap with retry
361-
uses: nick-invision/retry@v2
362-
with:
363-
timeout_minutes: 10
364-
retry_wait_seconds: 60
365-
max_attempts: 3
366-
command: ./node_modules/.bin/codecov

.github/workflows/tests_e2e_ios.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: Testing E2E iOS
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
paths-ignore:
8+
- 'docs/**'
9+
- 'website/**'
10+
- '.spellcheck.dict.txt'
11+
- '**/*.md'
12+
13+
push:
14+
branches:
15+
- master
16+
paths-ignore:
17+
- 'docs/**'
18+
- 'website/**'
19+
- '.spellcheck.dict.txt'
20+
- '**/*.md'
21+
22+
jobs:
23+
ios:
24+
name: iOS
25+
runs-on: macos-latest
26+
# TODO matrix across APIs, at least 10 and 13 (lowest to highest)
27+
timeout-minutes: 60
28+
env:
29+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
30+
steps:
31+
- uses: styfle/[email protected]
32+
with:
33+
all_but_latest: true
34+
35+
- uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 50
38+
39+
- uses: actions/setup-node@v2
40+
with:
41+
node-version: 14
42+
43+
- uses: maxim-lobanov/setup-xcode@v1
44+
with:
45+
xcode-version: latest-stable
46+
47+
- name: Install firebase CLI
48+
uses: nick-invision/retry@v2
49+
with:
50+
timeout_minutes: 10
51+
retry_wait_seconds: 60
52+
max_attempts: 3
53+
command: npm i -g firebase-tools
54+
55+
- name: Cache Firestore Emulator
56+
uses: actions/cache@v2
57+
with:
58+
path: ~/.cache/firebase/emulators
59+
key: firebase-emulators-v1
60+
61+
- name: Start Firestore Emulator
62+
run: yarn tests:emulator:start-ci
63+
64+
- name: Get Xcode version
65+
id: xcode-version
66+
run: echo "::set-output name=xcode-version::$(xcodebuild -version|tail -1|cut -f3 -d' ')"
67+
68+
- name: Get yarn cache directory path
69+
id: yarn-cache-dir-path
70+
run: echo "::set-output name=dir::$(yarn cache dir)"
71+
72+
- uses: actions/cache@v2
73+
name: Yarn Cache
74+
id: yarn-cache
75+
with:
76+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
77+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-v1
78+
79+
- uses: actions/cache@v2
80+
name: Cache Pods
81+
with:
82+
path: tests/ios/Pods
83+
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}-v1
84+
85+
- uses: actions/cache@v2
86+
name: Detox Framework Cache
87+
with:
88+
path: ~/Library/Detox/ios
89+
key: ${{ runner.os }}-detox-framework-cache-${{ steps.xcode-version.outputs.xcode-version }}
90+
91+
- name: Yarn Install
92+
uses: nick-invision/retry@v2
93+
with:
94+
timeout_minutes: 10
95+
retry_wait_seconds: 60
96+
max_attempts: 3
97+
command: yarn --no-audit --prefer-offline
98+
99+
- name: Update Ruby build tools
100+
uses: nick-invision/retry@v2
101+
with:
102+
timeout_minutes: 10
103+
retry_wait_seconds: 60
104+
max_attempts: 3
105+
command: gem update cocoapods xcodeproj
106+
107+
- name: Pod Install
108+
uses: nick-invision/retry@v2
109+
with:
110+
timeout_minutes: 10
111+
retry_wait_seconds: 60
112+
max_attempts: 3
113+
command: yarn tests:ios:pod:install
114+
115+
- name: Build iOS App
116+
run: |
117+
export SKIP_BUNDLING=1
118+
export RCT_NO_LAUNCH_PACKAGER=1
119+
cd tests
120+
set -o pipefail
121+
./node_modules/.bin/detox build --configuration ios.sim.debug
122+
shell: bash
123+
124+
- name: Install applesimutils
125+
uses: nick-invision/retry@v2
126+
with:
127+
timeout_minutes: 10
128+
retry_wait_seconds: 60
129+
max_attempts: 3
130+
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils && applesimutils --list
131+
132+
- name: Pre-fetch Javascript bundle
133+
run: |
134+
nohup yarn tests:packager:jet &
135+
printf 'Waiting for packager to come online'
136+
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
137+
printf '.'
138+
sleep 2
139+
done
140+
echo "Packager is online! Preparing bundle..."
141+
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
142+
echo "...javascript bundle ready"
143+
144+
- name: Create Simulator Log
145+
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
146+
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
147+
continue-on-error: true
148+
run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"
149+
150+
- name: Detox Test
151+
timeout-minutes: 40
152+
run: |
153+
cd tests
154+
./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup
155+
156+
- name: Compress Simulator Log
157+
if: always()
158+
run: gzip -9 simulator.log
159+
160+
- name: Upload Simulator Log
161+
uses: actions/upload-artifact@v2
162+
if: always()
163+
with:
164+
name: simulator_logs
165+
path: simulator.log.gz
166+
167+
- name: Submit Coverage
168+
# This can fail on timeouts etc, wrap with retry
169+
uses: nick-invision/retry@v2
170+
with:
171+
timeout_minutes: 10
172+
retry_wait_seconds: 60
173+
max_attempts: 3
174+
command: ./node_modules/.bin/codecov

0 commit comments

Comments
 (0)