forked from rainbow-me/rainbow
-
Notifications
You must be signed in to change notification settings - Fork 0
277 lines (247 loc) Β· 9.87 KB
/
android-e2e.yml
File metadata and controls
277 lines (247 loc) Β· 9.87 KB
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
name: Android
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [develop]
issue_comment:
types: [created]
env:
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
jobs:
build:
name: Test Build
if: |
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
github.event_name == 'push' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
(
startsWith(github.event.comment.body, '/e2e') ||
startsWith(github.event.comment.body, '/perf')
) &&
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 30
concurrency:
group: e2e-android-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
outputs:
artifact-id: ${{ steps.rock-remote-build-android.outputs.artifact-id }}
steps:
- name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: Install secret tools
run: sudo apt install libsecret-tools
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup scripts key
uses: ./.github/actions/ssh/
with:
name: scripts
key: ${{ secrets.DEPLOY_PKEY_SCRIPTS_REPO }}
- name: Setup sandbox key
uses: ./.github/actions/ssh/
with:
name: sandbox
key: ${{ secrets.DEPLOY_PKEY_SANDBOX_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone git@github.com:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
mv rainbow-env/android/app/google-services.json android/app/google-services.json
rm -rf rainbow-env
sed -i "s/IS_TESTING=false/IS_TESTING=true/" .env
echo "1" > is_testing
- name: Setup scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
SSH_AUTH_SOCK: /tmp/ssh_agent_scripts.sock
run: |
eval $CI_SCRIPTS
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
key: ${{ runner.os }}-${{ runner.arch }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_sandbox.sock
run: |
yarn install && yarn setup
- name: Check for frozen lockfile
run: ./scripts/check-lockfile.sh
- name: Audit CI
run: yarn audit-ci --config audit-ci.jsonc
- name: Rock Remote Build - Android
id: rock-remote-build-android
uses: callstackincubator/android@8c2cb70c209cc7f832130b6e49bcbcaa7ad62613
env:
# This is a debug keystore for now.
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
variant: release
sign: true
keystore-base64: ${{ env.KEYSTORE_BASE64 }}
keystore-store-file: ${{ env.KEYSTORE_FILE }}
keystore-store-password: ${{ env.KEYSTORE_PASSWORD }}
keystore-key-alias: ${{ env.KEYSTORE_KEY_ALIAS }}
keystore-key-password: ${{ env.KEYSTORE_KEY_PASSWORD }}
re-sign: true
github-token: ${{ secrets.GITHUB_TOKEN }}
validate-gradle-wrapper: false
rock-build-extra-params: '--extra-params="--no-daemon --build-cache --no-scan"'
comment-bot: false
e2e-tests:
name: E2E Tests (Shard ${{ matrix.shard-index }})
if: |
github.event_name != 'issue_comment' ||
startsWith(github.event.comment.body, '/e2e')
strategy:
fail-fast: false
matrix:
shard-index: [1, 2, 3, 4]
runs-on: app-e2e-runner
needs: build
timeout-minutes: 30
concurrency:
group: e2e-android-${{ github.workflow }}-${{ github.ref }}-shard-${{ matrix.shard-index }}
cancel-in-progress: false
env:
SHARD_TOTAL: 4
SHARD_INDEX: ${{ matrix.shard-index }}
ANDROID_EMULATOR_API_LEVEL: 31
ANDROID_EMULATOR_PROFILE: pixel_6
ANDROID_EMULATOR_CORES: 4
ANDROID_EMULATOR_RAM_SIZE: 8192
ARTIFACTS_FOLDER: e2e-artifacts
ARCH: x86_64
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60
steps:
- name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone git@github.com:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
rm -rf rainbow-env
- name: Install Maestro
run: export MAESTRO_VERSION=2.0.10; curl -fsSL "https://get.maestro.mobile.dev" | bash
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de
with:
version: stable
- name: Download and Unpack APK artifact
run: |
curl -L -H "Authorization: token ${{ github.token }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build.outputs.artifact-id }}/zip"
unzip artifact.zip -d downloaded-artifacts
ls -l downloaded-artifacts
APK_PATH=$(find downloaded-artifacts -name "*.apk" -print -quit)
echo "ARTIFACT_PATH_FOR_E2E=$APK_PATH" >> $GITHUB_ENV
shell: bash
- name: Setup Android Emulator
id: android-emulator
uses: ./.github/actions/android-emulator/
with:
api-level: ${{ env.ANDROID_EMULATOR_API_LEVEL }}
profile: ${{ env.ANDROID_EMULATOR_PROFILE }}
cores: ${{ env.ANDROID_EMULATOR_CORES }}
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
arch: ${{ env.ARCH }}
- name: Run tests
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed
id: e2e_test
with:
api-level: ${{ env.ANDROID_EMULATOR_API_LEVEL }}
target: google_apis_playstore
arch: ${{ env.ARCH }}
force-avd-creation: false
emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
profile: ${{ env.ANDROID_EMULATOR_PROFILE }}
cores: ${{ env.ANDROID_EMULATOR_CORES }}
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
script: ./scripts/e2e-android-ci.sh
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: artifacts-${{ matrix.shard-index }}
path: ${{ env.ARTIFACTS_FOLDER }}
perf-tests:
name: Perf Tests
if: |
github.event_name != 'issue_comment' ||
startsWith(github.event.comment.body, '/perf')
runs-on: blacksmith-2vcpu-ubuntu-2404
needs: build
timeout-minutes: 30
concurrency:
group: e2e-android-${{ github.workflow }}-${{ github.ref }}-perf
cancel-in-progress: true
env:
ARTIFACTS_FOLDER: e2e-artifacts
steps:
- name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: Download and Unpack APK artifact
run: |
curl -L -H "Authorization: token ${{ github.token }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build.outputs.artifact-id }}/zip"
unzip artifact.zip -d downloaded-artifacts
ls -l downloaded-artifacts
APK_PATH=$(find downloaded-artifacts -name "*.apk" -print -quit)
echo "ARTIFACT_PATH_FOR_E2E=$APK_PATH" >> $GITHUB_ENV
shell: bash
- name: Run tests
run: ./scripts/e2e-android-perf-ci-aws.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEVICE_FARM_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEVICE_FARM_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
PROJECT_ARN: ${{ secrets.AWS_DEVICE_FARM_PROJECT_ARN }}
DEVICE_POOL_ARN: ${{ secrets.AWS_DEVICE_FARM_DEVICE_POOL_ARN }}
ARTIFACT_PATH_FOR_E2E: ${{ env.ARTIFACT_PATH_FOR_E2E }}
GITHUB_PR_NUMBER: ${{ env.PR_NUMBER }}
- name: Install Flashlight
if: github.event_name == 'pull_request'
run: |
curl https://get.flashlight.dev | bash
- name: Generate Report
if: github.event_name == 'pull_request'
run: ./scripts/e2e-android-perf-ci-report.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_PR_NUMBER: ${{ env.PR_NUMBER }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_COMMIT: ${{ github.sha }}
- name: Upload Current Perf JSON
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: perf-results-${{ env.PR_NUMBER || github.ref_name }}
path: ${{ env.ARTIFACTS_FOLDER }}/perf