-
-
Notifications
You must be signed in to change notification settings - Fork 521
236 lines (204 loc) · 6.25 KB
/
e2e_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
name: 'E2E Tests'
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'website/**'
pull_request:
branches:
- master
paths-ignore:
- 'README.md'
- 'website/**'
jobs:
build-android:
name: Build Android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('KeychainExample/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Downloading Gradle Dependencies
run: |
cd KeychainExample/android
chmod +x gradlew
./gradlew --max-workers 2 dependencies
- name: Build Android Release
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
working-directory: ./KeychainExample
run: |
yarn build:android
yarn test:android:build
- name: Upload Test APKs
uses: actions/upload-artifact@v4
with:
name: test-apk
path: KeychainExample/android/app/build/outputs/apk
retention-days: 1
test-android:
runs-on: ubuntu-latest
needs: build-android
strategy:
fail-fast: false
matrix:
api-level:
- 31
- 32
- 33
- 34
- 35
steps:
- 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
ls /dev/kvm
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/download-artifact@v4
with:
name: test-apk
path: KeychainExample/android/app/build/outputs/apk
- name: Display structure of downloaded files
run: ls -R KeychainExample/android/app/build/outputs/apk
- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
profile: pixel_6
disable-animations: true
avd-name: TestingAVD
script: |
echo "Starting the screen recording..."
adb shell "screenrecord --bugreport /data/local/tmp/screenrecord.mp4 & echo \$! > /data/local/tmp/screenrecord_pid.txt" &
adb shell settings put system pointer_location 1
adb shell locksettings set-pin 1111
adb shell am start -a android.settings.BIOMETRIC_ENROLL
adb shell input text 1111
adb shell input keyevent 66
sleep 3
adb shell input tap 900 2200
sleep 3
adb shell input tap 900 2200
sleep 3
adb -e emu finger touch 1
sleep 3
adb -e emu finger touch 1
sleep 3
adb -e emu finger touch 1
sleep 3
adb shell input keyevent KEYCODE_HOME
adb shell "kill -2 \$(cat /data/local/tmp/screenrecord_pid.txt)"
sleep 1
adb pull /data/local/tmp/screenrecord.mp4 .
cd KeychainExample
yarn test:android:run
- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: android-test-artifacts-${{ matrix.api-level }}
path: |
KeychainExample/artifacts
screenrecord.mp4
build-ios:
name: Build and Test iOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: setup-cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: KeychainExample/ios/Podfile.lock
- name: Cache cocoapods
id: cocoapods-cache
uses: actions/cache@v4
with:
path: |
**/ios/Pods
**/vendor/bundle
key: ${{ runner.os }}-cocoapods-${{ hashFiles('KeychainExample/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Install Bundle
if: steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd KeychainExample
bundle install
- name: Install Detox dependencies
run: |
cd KeychainExample
brew tap wix/brew
brew install applesimutils
yarn detox clean-framework-cache
yarn detox build-framework-cache
- name: Xcode Version
run: |
xcodebuild -version
xcrun simctl list
- name: Build iOS Release
working-directory: ./KeychainExample
run: |
yarn build:ios
cd ios && pod install && cd -
yarn test:ios:build
env:
RCT_NEW_ARCH_ENABLED: 0
USE_HERMES: 1
- name: Test iOS Release
run: |
cd KeychainExample
yarn test:ios:run
- name: Upload test artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ios-test-artifacts
path: KeychainExample/artifacts