Skip to content

Commit 6ada614

Browse files
committed
add e2e
1 parent 81e569c commit 6ada614

27 files changed

Lines changed: 2786 additions & 412 deletions

.github/workflows/e2e_android.yml

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,67 @@
11
name: e2e-android
2-
on: push
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
push:
8+
branches:
9+
- master
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
315

416
jobs:
517
e2e-android:
618
runs-on: macos-latest
19+
timeout-minutes: 10
720
steps:
8-
- name: Checkout repository
9-
uses: actions/checkout@v3
21+
- name: Checkout react-native-update
22+
uses: actions/checkout@v4
23+
24+
- name: Checkout react-native-update-cli
25+
uses: actions/checkout@v4
26+
with:
27+
repository: reactnativecn/react-native-update-cli
28+
path: react-native-update-cli
1029

1130
- name: Setup Node.js
12-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@v6
1332
with:
14-
cache: yarn
15-
node-version-file: .nvmrc
33+
node-version: 20
1634

17-
- name: Install Yarn dependencies
18-
run: yarn --frozen-lockfile --prefer-offline
35+
- name: Setup Bun
36+
uses: oven-sh/setup-bun@v2
37+
with:
38+
bun-version: latest
1939

2040
- name: Setup Java
21-
uses: actions/setup-java@v3
41+
uses: actions/setup-java@v4
2242
with:
23-
cache: gradle
2443
distribution: temurin
25-
java-version: 17
44+
java-version: '17'
2645

27-
- name: Cache Detox build
28-
id: cache-detox-build
29-
uses: actions/cache@v3
30-
with:
31-
path: android/app/build
32-
key: ${{ runner.os }}-detox-build
33-
restore-keys: |
34-
${{ runner.os }}-detox-build
46+
- name: Install testHotUpdate dependencies
47+
run: cd Example/testHotUpdate && bun install --frozen-lockfile
48+
49+
- name: Install react-native-update-cli dependencies
50+
run: cd react-native-update-cli && bun install --frozen-lockfile
3551

36-
- name: Detox build
37-
run: yarn build:android-debug
52+
- name: Detox build (android.emu.release)
53+
run: cd Example/testHotUpdate && E2E_PLATFORM=android npx detox build --configuration android.emu.release
3854

39-
- name: Get device name
55+
- name: Read Detox emulator name
4056
id: device
4157
run: node -e "console.log('AVD_NAME=' + require('./Example/testHotUpdate/.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT
4258

43-
- name: Detox test
59+
- name: Detox test (android.emu.release)
4460
uses: reactivecircus/android-emulator-runner@v2
61+
env:
62+
RNU_CLI_ROOT: ${{ github.workspace }}/react-native-update-cli
4563
with:
46-
api-level: 31
47-
arch: x86_64
64+
api-level: 33
65+
arch: arm64-v8a
4866
avd-name: ${{ steps.device.outputs.AVD_NAME }}
49-
script: yarn test:android-debug
67+
script: cd Example/testHotUpdate && E2E_PLATFORM=android npx detox test --configuration android.emu.release --headless --record-logs all

.github/workflows/e2e_ios.yml

Lines changed: 43 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,73 @@
1-
name: Testing E2E iOS
1+
name: e2e-ios
22

33
on:
44
pull_request:
55
branches:
66
- '**'
7-
paths-ignore:
8-
- 'docs/**'
9-
- 'website/**'
10-
- '.spellcheck.dict.txt'
11-
- '**/*.md'
12-
137
push:
148
branches:
159
- master
16-
paths-ignore:
17-
- 'docs/**'
18-
- 'website/**'
19-
- '.spellcheck.dict.txt'
20-
# - '**/*.md'
2110

2211
concurrency:
2312
group: ${{ github.workflow }}-${{ github.ref }}
2413
cancel-in-progress: true
2514

2615
jobs:
27-
ios:
28-
name: iOS
29-
runs-on: macos-14-arm64
30-
# TODO matrix across APIs, at least 11 and 15 (lowest to highest)
31-
timeout-minutes: 60
32-
env:
33-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
16+
e2e-ios:
17+
runs-on: macos-latest
18+
timeout-minutes: 10
3419
steps:
35-
# Set up tool versions
36-
- uses: actions/setup-node@v4
37-
with:
38-
node-version: 18
39-
40-
- name: Configure JDK 1.11
41-
uses: actions/setup-java@v3
42-
with:
43-
distribution: 'temurin'
44-
java-version: '11'
45-
46-
- uses: maxim-lobanov/setup-xcode@v1
47-
with:
48-
xcode-version: 'latest-stable'
49-
50-
- uses: actions/checkout@v3
51-
with:
52-
fetch-depth: 50
53-
54-
# Set path variables needed for caches
55-
- name: Set workflow variables
56-
id: workflow-variables
57-
run: |
58-
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
59-
echo "xcode-version=$(xcodebuild -version|tail -1|cut -f3 -d' ')" >> $GITHUB_OUTPUT
60-
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
61-
62-
- uses: actions/cache@v3
63-
name: Yarn Cache
64-
id: yarn-cache
65-
with:
66-
path: ${{ steps.workflow-variables.outputs.yarn-cache-dir }}
67-
key: ${{ runner.os }}-yarn-v1-${{ hashFiles('yarn.lock') }}
68-
restore-keys: ${{ runner.os }}-yarn-v1
20+
- name: Checkout react-native-update
21+
uses: actions/checkout@v4
6922

70-
- uses: actions/cache@v3
71-
name: Detox Framework Cache
72-
id: detox-cache
23+
- name: Checkout react-native-update-cli
24+
uses: actions/checkout@v4
7325
with:
74-
path: ~/Library/Detox/ios
75-
key: ${{ runner.os }}-detox-framework-cache-${{ steps.workflow-variables.outputs.xcode-version }}
26+
repository: reactnativecn/react-native-update-cli
27+
path: react-native-update-cli
7628

77-
# Detox is compiled during yarn install, using Xcode, set up cache first
78-
- uses: hendrikmuhs/ccache-action@v1.2
79-
name: Xcode Compile Cache
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
8031
with:
81-
key: ${{ runner.os }}-v2 # makes a unique key w/related restore key internally
82-
max-size: 1500M
32+
node-version: 20
8333

84-
- name: Yarn Install
85-
uses: nick-invision/retry@v2
34+
- name: Setup Bun
35+
uses: oven-sh/setup-bun@v2
8636
with:
87-
timeout_minutes: 10
88-
retry_wait_seconds: 60
89-
max_attempts: 3
90-
command: yarn --no-audit --prefer-offline
37+
bun-version: latest
9138

92-
- name: Setup Ruby
93-
uses: ruby/setup-ruby@v1
39+
- name: Setup Java
40+
uses: actions/setup-java@v4
9441
with:
95-
ruby-version: 3
42+
distribution: temurin
43+
java-version: '17'
9644

97-
- name: Update Ruby build tools
98-
uses: nick-invision/retry@v2
45+
- name: Setup Xcode
46+
uses: maxim-lobanov/setup-xcode@v1
9947
with:
100-
timeout_minutes: 2
101-
retry_wait_seconds: 60
102-
max_attempts: 3
103-
command: gem update cocoapods xcodeproj
48+
xcode-version: latest-stable
10449

105-
- uses: actions/cache@v3
106-
name: Cache Pods
107-
id: pods-cache
108-
with:
109-
path: tests/ios/Pods
110-
key: ${{ runner.os }}-pods-v2-${{ hashFiles('tests/ios/Podfile.lock') }}
111-
restore-keys: ${{ runner.os }}-pods-v2
112-
113-
- name: Pod Install
114-
uses: nick-invision/retry@v2
115-
with:
116-
timeout_minutes: 10
117-
retry_wait_seconds: 30
118-
max_attempts: 3
119-
command: yarn tests:ios:pod:install
120-
121-
- name: Cache Firestore Emulator
122-
uses: actions/cache@v3
123-
with:
124-
path: ~/.cache/pushy/emulators
125-
key: pushy-emulators-v1-${{ github.run_id }}
126-
restore-keys: pushy-emulators-v1
127-
128-
- name: Start Firestore Emulator
129-
run: yarn tests:emulator:start-ci
50+
- name: Install applesimutils
51+
run: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils
13052

131-
- name: Install brew utilities
132-
uses: nick-invision/retry@v2
133-
with:
134-
timeout_minutes: 5
135-
retry_wait_seconds: 60
136-
max_attempts: 3
137-
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils xcbeautify && applesimutils --list
138-
139-
- name: Build iOS App
140-
run: |
141-
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
142-
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
143-
export CCACHE_FILECLONE=true
144-
export CCACHE_DEPEND=true
145-
export CCACHE_INODECACHE=true
146-
export CCACHE_LIMIT_MULTIPLE=0.95
147-
ccache -s
148-
export SKIP_BUNDLING=1
149-
export RCT_NO_LAUNCH_PACKAGER=1
150-
set -o pipefail
151-
yarn build:ios-debug
152-
ccache -s
153-
shell: bash
53+
- name: Install testHotUpdate dependencies
54+
run: cd Example/testHotUpdate && bun install --frozen-lockfile
15455

155-
- name: Metro Bundler Cache
156-
uses: actions/cache@v3
157-
with:
158-
path: ${{ steps.workflow-variables.outputs.metro-cache }}
159-
key: ${{ runner.os }}-metro-v1-${{ github.run_id }}
160-
restore-keys: ${{ runner.os }}-metro-v1
56+
- name: Install react-native-update-cli dependencies
57+
run: cd react-native-update-cli && bun install --frozen-lockfile
16158

162-
- name: Pre-fetch Javascript bundle
59+
- name: Rebuild Detox iOS framework cache
16360
run: |
164-
nohup yarn tests:packager:jet-ci &
165-
printf 'Waiting for packager to come online'
166-
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
167-
printf '.'
168-
sleep 2
169-
done
170-
echo "Packager is online! Preparing bundle..."
171-
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
172-
echo "...javascript bundle ready"
173-
174-
- name: Create Simulator Log
175-
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
176-
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
177-
continue-on-error: true
178-
run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"
179-
180-
- name: Detox Test
181-
timeout-minutes: 60
182-
run: yarn test:ios-debug
61+
cd Example/testHotUpdate
62+
npx detox clean-framework-cache
63+
npx detox build-framework-cache
64+
65+
- name: Detox build (ios.sim.release)
66+
env:
67+
RNU_CLI_ROOT: ${{ github.workspace }}/react-native-update-cli
68+
run: cd Example/testHotUpdate && E2E_PLATFORM=ios npx detox build --configuration ios.sim.release
69+
70+
- name: Detox test (ios.sim.release)
71+
env:
72+
RNU_CLI_ROOT: ${{ github.workspace }}/react-native-update-cli
73+
run: cd Example/testHotUpdate && E2E_PLATFORM=ios npx detox test --configuration ios.sim.release

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727
- uses: oven-sh/setup-bun@v2
28-
- uses: actions/setup-node@v4
28+
- uses: actions/setup-node@v6
2929
with:
3030
node-version: '20.x'
3131
registry-url: 'https://registry.npmjs.org'
@@ -38,8 +38,8 @@ jobs:
3838
env:
3939
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4040
NODE_OPTIONS: '--max_old_space_size=4096'
41-
run: bun install --frozen-lockfile
42-
41+
run: bun install --frozen-lockfile
42+
4343
- name: Run lint
4444
env:
4545
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ harmony/pushy/.preview
6060
Example/harmony_use_pushy/harmony/entry/src/main/resources/rawfile/meta.json
6161
**/.hvigor
6262
Example/harmony_use_pushy/harmony/entry/src/main/cpp/generated
63+
Example/testHotUpdate/.e2e-artifacts

0 commit comments

Comments
 (0)