-
Notifications
You must be signed in to change notification settings - Fork 41
465 lines (460 loc) Β· 14.8 KB
/
build.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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
name: CI
on:
pull_request:
merge_group:
push:
branches: [master]
workflow_dispatch:
jobs:
# INSTALL DEPS
install:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.16.0"
cache: 'yarn'
- name: Install deps via Yarn
run: yarn setup
- name: Check for frozen lockfile
run: yarn check-lockfile
- name: Zip node_modules
run: tar czf node_modules.tar.gz node_modules/
- name: Upload deps artifacts
uses: actions/upload-artifact@v4
with:
name: node_modules.tar.gz
path: node_modules.tar.gz
# BUILD THE EXTENSION
build:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.16.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v4
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- uses: actions/checkout@v4
with:
repository: 'rainbow-me/browser-extension-env'
token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
path: tmp
- name: Copy dotenv
run: cat tmp/dotenv >> .env && rm -rf tmp
- name: Set IS_TESTING=true
run: |
sed -i 's/IS_TESTING.*/IS_TESTING=true/g' .env
- name: Fetch networks
run: yarn fetch:networks
- name: Build the extension
run: yarn build:webpack
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: rainbowbx-${{ github.sha }}
path: build/
- name: Remove old screenshots
run: rm -rf screenshots/*
# FIREFOX TESTS
# firefox-e2e-parallel:
# runs-on: ubuntu-latest
# timeout-minutes: 18
# needs: [build]
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 4
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/firefoxTestsSetup
# with:
# gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
# - name: Run e2e parallel (Firefox)
# id: FFE2eParallel
# continue-on-error: true
# run: |
# export BROWSER=firefox
# export OS=linux
# export FIREFOX_BIN="$(pwd)/firefox/firefox"
# yarn firefox:manifest && yarn firefox:zip
# yarn vitest:parallel
# - name: Upload deps artifacts
# if: steps.FFE2eParallel.outcome == 'failure'
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# path: screenshots/
# - name: Fail if any tests failed
# if: steps.FFE2eParallel.outcome == 'failure'
# run: exit 1
# firefox-e2e-swap:
# runs-on: swaps-runner-bx
# timeout-minutes: 25
# needs: [build]
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 4
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/firefoxTestsSetup
# with:
# gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
# - name: Run e2e Swap (Firefox)
# id: FFE2eSwap
# continue-on-error: true
# run: |
# export BROWSER=firefox
# export OS=linux
# export FIREFOX_BIN="$(pwd)/firefox/firefox"
# yarn firefox:manifest && yarn firefox:zip
# yarn vitest:swap
# - name: Upload deps artifacts
# if: steps.FFE2eSwap.outcome == 'failure'
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# path: screenshots/
# - name: Fail if any tests failed
# if: steps.FFE2eSwap.outcome == 'failure'
# run: exit 1
# firefox-e2e-send:
# runs-on: send-runner-bx
# timeout-minutes: 16
# needs: [build]
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 4
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/firefoxTestsSetup
# with:
# gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
# - name: Run e2e Send (Firefox)
# id: FFE2eSend
# continue-on-error: true
# run: |
# export BROWSER=firefox
# export OS=linux
# export FIREFOX_BIN="$(pwd)/firefox/firefox"
# yarn firefox:manifest && yarn firefox:zip
# yarn vitest:send
# - name: Upload deps artifacts
# if: steps.FFE2eSend.outcome == 'failure'
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# path: screenshots/
# - name: Fail if any tests failed
# if: steps.FFE2eSend.outcome == 'failure'
# run: exit 1
# firefox-e2e-dappInteractions:
# runs-on: dapp-interactions-runner-bx
# timeout-minutes: 25
# needs: [build]
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 4
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/firefoxTestsSetup
# with:
# gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
# - name: Run e2e Dapp Interactions (Firefox)
# id: FFE2eDappInteractions
# continue-on-error: true
# run: |
# export BROWSER=firefox
# export OS=linux
# export FIREFOX_BIN="$(pwd)/firefox/firefox"
# yarn firefox:manifest && yarn firefox:zip
# yarn vitest:dappInteractions
# - name: Upload deps artifacts
# if: steps.FFE2eDappInteractions.outcome == 'failure'
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# path: screenshots/
# - name: Fail if any tests failed
# if: steps.FFE2eDappInteractions.outcome == 'failure'
# run: exit 1
# CHROME TESTS
chrome-e2e-parallel:
runs-on: beefy-runner-bx
timeout-minutes: 18
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e parallel (Chrome)
id: ChromeE2EParallel
continue-on-error: true
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
yarn vitest:parallel
- name: Upload deps artifacts
if: steps.ChromeE2EParallel.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.ChromeE2EParallel.outcome == 'failure'
run: exit 1
chrome-e2e-swap:
runs-on: swaps-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e swap (Chrome)
id: ChromeE2ESwaps
continue-on-error: true
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
yarn vitest:swap
- name: Upload deps artifacts
if: steps.ChromeE2ESwaps.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.ChromeE2ESwaps.outcome == 'failure'
run: exit 1
chrome-e2e-send:
runs-on: send-runner-bx
timeout-minutes: 16
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e send (Chrome)
id: ChromeE2ESend
continue-on-error: true
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
yarn vitest:send
- name: Upload deps artifacts
if: steps.ChromeE2ESend.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.ChromeE2ESend.outcome == 'failure'
run: exit 1
chrome-optimism-e2e-send:
runs-on: send-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run Optimism e2e send (Chrome)
id: ChromeOpE2ESend
continue-on-error: true
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
yarn vitest:send:optimism
- name: Upload deps artifacts
if: steps.ChromeOpE2ESend.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.ChromeOpE2ESend.outcome == 'failure'
run: exit 1
chrome-e2e-dappInteractions:
runs-on: dapp-interactions-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/chromeTestsSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e dappInteractions (Chrome)
id: ChromeE2EDappInteractions
continue-on-error: true
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(find chrome -type f -name 'chrome')
yarn vitest:dappInteractions
- name: Upload deps artifacts
if: steps.ChromeE2EDappInteractions.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: screenshots
path: screenshots/
- name: Fail if any tests failed
if: steps.ChromeE2EDappInteractions.outcome == 'failure'
run: exit 1
# BRAVE TESTS
# brave-e2e:
# needs: [build]
# runs-on: ubuntu-latest
# timeout-minutes: 20
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 3
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: "20.16.0"
# - name: Download deps cache artifacts
# uses: actions/download-artifact@v4
# with:
# name: node_modules.tar.gz
# - name: Unzip node_modules
# run: tar xzvf node_modules.tar.gz
# - name: Download build artifacts
# uses: actions/download-artifact@v4
# with:
# name: rainbowbx-${{ github.sha }}
# path: build
# - name: Setup xvfb
# run: |
# sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# # start xvfb in the background
# sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
# - name: Setup Brave browser
# run: |
# sudo apt install apt-transport-https curl
# sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
# echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
# sudo apt update
# sudo apt install brave-browser
# - name: Install Anvil
# uses: foundry-rs/foundry-toolchain@v1
# with:
# version: nightly
# - uses: actions/checkout@v4
# with:
# repository: 'rainbow-me/browser-extension-env'
# token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
# path: tmp
# - name: Copy dotenv
# run: cat tmp/dotenv >> .env && rm -rf tmp
# - name: Run e2e (Brave)
# run: |
# export BROWSER=brave
# export OS=linux
# export BRAVE_BIN='/usr/bin/brave-browser-stable'
# yarn vitest:parallel && yarn vitest:serial
# UNIT TESTS
unit-tests:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.16.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v4
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- name: Install rust
uses: moonrepo/[email protected]
with:
channel: stable
profile: minimal
- name: Fetch networks
run: yarn fetch:networks
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: actions/checkout@v4
with:
repository: 'rainbow-me/browser-extension-env'
token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
path: tmp
- name: Copy dotenv
run: cat tmp/dotenv >> .env && rm -rf tmp
- name: Set IS_TESTING=true
run: |
sed -i 's/IS_TESTING.*/IS_TESTING=true/g' .env
- name: Run unit tests
run: yarn test
# LINT, TYPECHECK, AUDIT
ci-checks:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.16.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v4
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- name: DS Setup
run: yarn ds:install
- name: Fetch networks
run: yarn fetch:networks
- name: Lint
run: yarn lint
- name: Audit CI
run: yarn audit:ci
- name: Check types
run: yarn typecheck
cleanup:
runs-on: ubuntu-latest
needs: [chrome-e2e-parallel, chrome-e2e-swap, chrome-e2e-send, chrome-e2e-dappInteractions, chrome-optimism-e2e-send, unit-tests, ci-checks]
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: node_modules.tar.gz
- uses: geekyeggo/delete-artifact@v5
with:
name: screenshots