-
Notifications
You must be signed in to change notification settings - Fork 41
277 lines (272 loc) Β· 8.45 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
name: CI
on:
pull_request:
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@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.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@v3
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@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- uses: actions/checkout@v3
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: Graphql Setup
run: yarn graphql-setup
- name: Build the extension
run: yarn build:webpack
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: rainbowbx-${{ github.sha }}.zip
path: build/
# CHROME TESTS
chrome-e2e-parallel:
runs-on: beefy-runner-bx
timeout-minutes: 16
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 4
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e parallel (Chrome)
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:parallel --retry=5
chrome-e2e-swap:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e swap (Chrome)
uses: nick-fields/retry@v2
with:
timeout_minutes: 25
max_attempts: 2
command: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:swap
chrome-e2e-send:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e send (Chrome)
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:send --retry=5
chrome-e2e-dappInteractions:
runs-on: beefy-runner-bx
timeout-minutes: 25
needs: [build]
env:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/testSetup
with:
gh-access-token: ${{ secrets.DOTENV_GITHUB_ACCESS_TOKEN }}
- name: Run e2e dappInteractions (Chrome)
run: |
export BROWSER=chrome
export OS=linux
export CHROMIUM_BIN=$(which chrome)
yarn vitest:dappInteractions --retry=5
# BRAVE TESTS
# brave-e2e:
# needs: [build]
# runs-on: ubuntu-latest
# timeout-minutes: 20
# env:
# DISPLAY: :0
# VITEST_SEGFAULT_RETRY: 3
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: "16.20.0"
# - name: Download deps cache artifacts
# uses: actions/download-artifact@v3
# 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@v3
# with:
# name: rainbowbx-${{ github.sha }}.zip
# 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@v3
# 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)
# uses: nick-fields/retry@v2
# with:
# timeout_minutes: 18
# max_attempts: 3
# command: |
# 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@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Graphql Setup
run: yarn graphql-setup
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: actions/checkout@v3
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 unit tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: yarn test
# LINT, TYPECHECK, AUDIT
ci-checks:
runs-on: ubuntu-latest
needs: [install]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.0"
cache: 'yarn'
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
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: Graphql Setup
run: yarn graphql-setup
- 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, unit-tests, ci-checks]
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: node_modules.tar.gz