-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
240 lines (201 loc) · 7.05 KB
/
tests.yaml
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
---
name: Tests
on:
- push
- pull_request
jobs:
android:
name: Android
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [34]
rn-version: ['0.75', '0.74', '0.73']
arch: ['new', 'old']
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/setup-node@v4
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
with:
# TODO: Remove this after we merge
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/monorepo' }}
- name: AVD Deps
run: |
sudo apt update
sudo apt-get install -y libpulse0 libgl1
# - name: SDK cache
# uses: actions/cache@v4
# id: sdk-cache
# with:
# path: |
# /usr/local/lib/android/sdk/system-images
# /usr/local/lib/android/sdk/platform-tools
# key: sdk-${{ matrix.api-level }}
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: SDKs
run: |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \
"system-images;android-${{ matrix.api-level }};default;x86_64"
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager platform-tools
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | \
sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Emulator
run: |
if ! $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list avd --compact | grep -q "Pixel_API_${{ matrix.api-level }}"; then
$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd \
-n Pixel_API_${{ matrix.api-level }} \
--device 'pixel_6_pro' \
--package "system-images;android-${{ matrix.api-level }};default;x86_64" \
--sdcard 512M
fi
$ANDROID_HOME/emulator/emulator -memory 4096 -avd Pixel_API_${{ matrix.api-level }} \
-no-metrics -wipe-data -no-window -gpu swiftshader_indirect \
-no-snapshot -no-snapshot-save -noaudio -no-boot-anim -camera-back none 2>&1 | tee /tmp/avd_log &
- name: Setup yarn
run: |
corepack enable
- name: Setup npm
uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
- name: Build
run: |
yarn prepare
- name: Set up RN version
run: |
cd packages/icon-explorer
./set-rn-version.sh ${{ matrix.arch }} ${{ matrix.rn-version }}
- name: Build App
run: |
cd packages/icon-explorer
yarn test:android:build
- name: ADB Wait For Device
timeout-minutes: 3
run: |
$ANDROID_HOME/platform-tools/adb wait-for-any-device
echo -n "Waiting for emulator to boot"
while [ "$($ANDROID_HOME/platform-tools/adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
echo -n "."
sleep 5
done
echo "Emulator has fully booted."
# Disable the notification about immersive mode
$ANDROID_HOME/platform-tools/adb shell settings put secure immersive_mode_confirmations confirmed
- name: Run tests
timeout-minutes: 10
run: |
export PATH=$ANDROID_HOME/platform-tools:$PATH
cd packages/icon-explorer
ln -s .owl/baseline baseline-${{ matrix.arch }}
yarn test:android:run
- name: Stop Emulator
if: always()
run: |
$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill || true
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.arch }}-${{ matrix.rn-version }}-android
path: packages/icon-explorer/.owl
include-hidden-files: true
- uses: dorny/test-reporter@v1
if: always()
with:
name: JEST Tests android - ${{ matrix.arch }} ${{ matrix.rn-version }}
path: packages/icon-explorer/.owl/report/*.xml
reporter: jest-junit
ios:
name: iOS
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
rn-version: ['0.75', '0.74', '0.73']
arch: ['new', 'old']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/setup-node@v4
- name: Setup yarn
run: |
xcrun simctl list || true
- name: Setup yarn
run: |
corepack enable
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --immutable
- name: Build
run: |
xcodebuild -version
yarn prepare
- name: Set up RN version
run: |
cd packages/icon-explorer
./set-rn-version.sh ${{ matrix.arch }} ${{ matrix.rn-version }}
- name: Build App
run: |
cd packages/icon-explorer
# Work around mono repo issues with owl
mkdir -p node_modules/@johnf
cd node_modules
cp -a ../../../node_modules/@johnf/react-native-owl @johnf/
ln -nfs ../../../node_modules/react-native react-native
cd -
# Due to react-native-test-app not bundling
yarn build:ios:owl
if [ "${{ matrix.arch }}" = "new" ]; then
NO_FLIPPER=1 RCT_NEW_ARCH_ENABLED=1 pod update --project-directory=ios
else
NO_FLIPPER=1 RCT_NEW_ARCH_ENABLED=0 pod update --project-directory=ios
fi
yarn test:ios:build
- name: Run simulator
id: simulator
uses: futureware-tech/simulator-action@v1
with:
os: 'iOS'
os_version: "=17.5"
model: 'iPhone 15'
- name: Run tests
timeout-minutes: 10
run: |
cd packages/icon-explorer
ln -s .owl/baseline baseline-${{ matrix.arch }}
tmp=$(mktemp)
jq '.ios.device = "{{ steps.simulator.outputs.udid }}"' owl.config.json > "$tmp" && mv "$tmp" owl.config.json
yarn test:ios:run
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.arch }}-${{ matrix.rn-version }}-ios
path: packages/icon-explorer/.owl
include-hidden-files: true
- uses: dorny/test-reporter@v1
if: always()
with:
name: JEST Tests ios - ${{ matrix.arch }} ${{ matrix.rn-version }}
path: packages/icon-explorer/.owl/report/*.xml
reporter: jest-junit