-
Notifications
You must be signed in to change notification settings - Fork 305
209 lines (203 loc) · 9.12 KB
/
reusable-build-system-test-react-native.yml
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
# Description: this is a reusable workflow that runs build on mega-apps that have all the connected components for React Native.
#
# See build-system-test-react-native.yml for usage.
on:
workflow_call:
inputs:
dist-tag:
required: true
type: string
jobs:
build:
runs-on: macos-13
environment: ci
strategy:
fail-fast: false
matrix:
framework: [react-native]
framework-version: [
# uncomment to enable
{ formatted: latest, value: latest },
{ formatted: 076, value: 0.76 },
{ formatted: 075, value: 0.75 },
{ formatted: 074, value: 0.74 },
{ formatted: 073, value: 0.73 },
{ formatted: 072, value: 0.72 },
{ formatted: 071, value: 0.71 },
]
build-tool: [cli, expo]
build-tool-version: [latest]
pkg-manager: [npm]
node-version: [20]
# uncomment to enable
# platform: [ios, android]
platform: [android]
logfile: [test.log]
exclude:
- build-tool: expo
platform: ios
- build-tool: expo
platform: android
framework-version: { formatted: '076', value: '0.76' }
- build-tool: expo
platform: android
framework-version: { formatted: '075', value: '0.75' }
- build-tool: expo
platform: android
framework-version: { formatted: '074', value: '0.74' }
- build-tool: expo
platform: android
framework-version: { formatted: '073', value: '0.73' }
- build-tool: expo
platform: android
framework-version: { formatted: '072', value: '0.72' }
- build-tool: expo
platform: android
framework-version: { formatted: '071', value: '0.71' }
include:
# Expo makes you specify a version of the SDK that supports a specific version of React Native
# https://stackoverflow.com/questions/63463373/create-an-expo-project-with-a-specific-version
- framework: react-native
framework-version: { formatted: 070, value: '0.70' }
build-tool: expo
build-tool-version: 47
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 071, value: '0.71' }
build-tool: expo
build-tool-version: 48
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 072, value: '0.72' }
build-tool: expo
build-tool-version: 49
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 073, value: '0.73' }
build-tool: expo
build-tool-version: 50
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 074, value: '0.74' }
build-tool: expo
build-tool-version: 51
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 075, value: '0.75' }
build-tool: expo
build-tool-version: 51
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
- framework: react-native
framework-version: { formatted: 076, value: '0.76' }
build-tool: expo
build-tool-version: 52
platform: android
pkg-manager: npm
node-version: 20
logfile: test.log
env:
MEGA_APP_NAME: rn${{ matrix.framework-version.formatted }}${{ matrix.build-tool }}${{ matrix.build-tool-version }}${{ matrix.platform }}ui${{ inputs.dist-tag }}
EMULATOR_PORT: 5554
steps:
- name: Checkout Amplify UI
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
with:
persist-credentials: false
- name: Setup Node.js ${{ matrix.node-version }} with ${{ matrix.pkg-manager }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: ${{ matrix.node-version }}
cache: ${{ matrix.pkg-manager }}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Restore CocoaPods cache
if: ${{ matrix.platform == 'ios' }}
id: restore-cocoapods-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 https://github.com/actions/cache/commit/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: ./examples/react-native/ios/Pods
key: ${{ runner.os }}-cocoapods
restore-keys: pods-${{ hashFiles('examples/react-native/ios/Podfile.lock') }}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Restore node_modules cache
if: ${{ matrix.platform == 'ios' }}
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 https://github.com/actions/cache/commit/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
id: restore-cache
with:
path: |
./node_modules
**/node_modules
key: ${{ runner.os }}-nodemodules
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
- name: Install Java 17
if: ${{ matrix.platform == 'android' }}
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc # 3.6.0
with:
distribution: 'corretto' # Amazon Corretto Build of OpenJDK
java-version: '17'
- name: Install iOS simulator
if: ${{ matrix.platform == 'ios' }}
run: |
brew tap wix/brew
brew install applesimutils
brew install watchman
brew link --overwrite [email protected]
echo "ruby --version"
ruby --version
continue-on-error: true # brew overwrite step addresses a python install issue: https://github.com/actions/runner-images/issues/8500
- name: Update CocoaPods
if: ${{ matrix.platform == 'ios' }}
run: |
gem update cocoapods xcodeproj
yarn react-native-example ios:pod-install
- name: Install Android emulator
if: ${{ matrix.platform == 'android' }}
run: |
echo -e "echo \$ANDROID_HOME"
echo $ANDROID_HOME
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'build-tools;33.0.2' platform-tools
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "system-images;android-27;default;x86_64"
echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd --force --name Pixel_5_API_27 --device "pixel_5" --abi x86_64 --package "system-images;android-27;default;x86_64"
printf 'hw.cpu.ncore=2\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
printf 'hw.ramSize=2048\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
printf 'hw.heapSize=576\n' >> ~/.android/avd/Pixel_5_API_27.avd/config.ini
- name: Start Android emulator
if: ${{ matrix.platform == 'android' }}
run: |
nohup $ANDROID_HOME/emulator/emulator -avd Pixel_5_API_27 -port ${{ env.EMULATOR_PORT }} -no-boot-anim -no-audio -no-snapshot-load -gpu host -accel on &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb devices
# disable spell checker
$ANDROID_HOME/platform-tools/adb shell settings put secure spell_checker_enabled 0
# disable animations
$ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0.0
$ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0.0
$ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0.0
- name: Create MegaApp ${{ env.MEGA_APP_NAME }} and run build on NodeJS ${{ matrix.node-version }}
run: npm run setup:${{matrix.framework}}:${{matrix.build-tool}} -- --name ${{ env.MEGA_APP_NAME }} --platform ${{matrix.platform}} --tag ${{inputs.dist-tag}} --framework-version ${{matrix.framework-version.value}} --build-tool-version ${{matrix.build-tool-version}}
shell: bash
working-directory: build-system-tests
- name: Detect Mega App Error in Log
run: npm run checkReactNativeLogs -- --log-file-name ${{ matrix.logfile }} --mega-app-name ${{ env.MEGA_APP_NAME }} --platform ${{ matrix.platform }}
shell: bash
working-directory: build-system-tests