-
Notifications
You must be signed in to change notification settings - Fork 5
506 lines (435 loc) · 15.8 KB
/
ci.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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
name: Continuous Integration
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
- 'release/**'
permissions:
pull-requests: write
actions: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_ARTIFACT_NAME: 'lace-dev-${{ github.sha }}'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Collect Workflow Telemetry Build Packages
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Build common
uses: ./.github/actions/build/package
with:
DIR: packages/common
NAME: packages-common
- name: Build cardano
uses: ./.github/actions/build/package
with:
DIR: packages/cardano
NAME: packages-cardano
- name: Build translation
uses: ./.github/actions/build/package
with:
DIR: packages/translation
NAME: packages-translation
- name: Build core
uses: ./.github/actions/build/package
with:
DIR: packages/core
NAME: packages-core
- name: Build staking
uses: ./.github/actions/build/package
with:
DIR: packages/staking
NAME: packages-staking
- name: Build nami
uses: ./.github/actions/build/package
with:
DIR: packages/nami
NAME: packages-nami
unitTests:
name: Unit tests
runs-on: ubuntu-20.04
needs: prepare
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Download packages-staking
uses: actions/download-artifact@v4
with:
name: packages-staking
path: packages/staking/dist
- name: Download packages-nami
uses: actions/download-artifact@v4
with:
name: packages-nami
path: packages/nami/dist
- name: Collect Workflow Telemetry Unit Tests
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Execute unit tests
uses: ./.github/actions/test/unit
release-pkg:
name: Release package
runs-on: ubuntu-20.04
needs: prepare
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Download packages-staking
uses: actions/download-artifact@v4
with:
name: packages-staking
path: packages/staking/dist
- name: Download packages-nami
uses: actions/download-artifact@v4
with:
name: packages-nami
path: packages/nami/dist
- name: Collect Workflow Telemetry Smoke Tests
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false
- name: Build Lace browser extension
uses: ./.github/actions/build/app
with:
BLOCKFROST_PROJECT_ID_MAINNET: ${{ secrets.BLOCKFROST_PROJECT_ID_MAINNET }}
BLOCKFROST_PROJECT_ID_PREPROD: ${{ secrets.BLOCKFROST_PROJECT_ID_PREPROD }}
BLOCKFROST_PROJECT_ID_PREVIEW: ${{ secrets.BLOCKFROST_PROJECT_ID_PREVIEW }}
DIR: apps/browser-extension-wallet
NAME: lace-browser-extension
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
POSTHOG_PRODUCTION_TOKEN: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.POSTHOG_PRODUCTION_TOKEN || '' }}
PRODUCTION_MODE_TRACKING: ${{ startsWith(github.ref, 'refs/heads/release') && 'true' || 'false' }}
BANXA_LACE_URL: ${{ startsWith(github.ref, 'refs/heads/release') && 'https://lacewallet.banxa.com/' }}
SENTRY_AUTH_TOKEN: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.SENTRY_AUTH_TOKEN || '' }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_ORG: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_ORG || '' }}
SENTRY_PROJECT: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_PROJECT || ''}}
SENTRY_ENVIRONMENT: 'production'
build:
name: Build Lace
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Lace artifact
uses: ./.github/shared/build
with:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
LACE_EXTENSION_KEY: ${{ secrets.MANIFEST_PUBLIC_KEY }}
BLOCKFROST_PROJECT_ID_MAINNET: ${{ secrets.BLOCKFROST_PROJECT_ID_MAINNET }}
BLOCKFROST_PROJECT_ID_PREPROD: ${{ secrets.BLOCKFROST_PROJECT_ID_PREPROD }}
BLOCKFROST_PROJECT_ID_PREVIEW: ${{ secrets.BLOCKFROST_PROJECT_ID_PREVIEW }}
BLOCKFROST_PROJECT_ID_SANCHONET: ${{ secrets.BLOCKFROST_PROJECT_ID_SANCHONET }}
SENTRY_AUTH_TOKEN: ${{ startsWith(github.ref, 'refs/heads/release') && secrets.SENTRY_AUTH_TOKEN || '' }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_ORG: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_ORG || '' }}
SENTRY_PROJECT: ${{ startsWith(github.ref, 'refs/heads/release') && vars.SENTRY_PROJECT || ''}}
SENTRY_ENVIRONMENT: 'smoke-tests'
WALLET_POLLING_INTERVAL_IN_SEC: 5
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
path: ./apps/browser-extension-wallet/dist
smokeTests:
name: Smoke e2e tests
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
batch: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download Lace build artifact
uses: actions/download-artifact@v4
with:
name: '${{ env.BUILD_ARTIFACT_NAME }}'
path: ./apps/browser-extension-wallet/dist
- name: Execute E2E tests
uses: ./.github/actions/test/e2e
with:
BATCH: ${{ matrix.batch }}
SMOKE_ONLY: true
TEST_DAPP_URL: ${{ secrets.TEST_DAPP_URL }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
SERVICE_WORKER_LOGS: true
processReports:
name: Process smoke e2e test reports
runs-on: ubuntu-22.04
needs: smokeTests
if: always()
steps:
- name: Download all smoke tests artifacts
uses: actions/download-artifact@v4
with:
path: .
pattern: 'runner-artifacts-*'
merge-multiple: true
- name: Create allure properties
shell: bash
if: always()
working-directory: ./reports/allure/results
run: |
echo "
branch=${{ github.ref_name }}
browser= 'Chrome'
tags= '@Smoke'
platform=Linux
" > environment.properties
- name: Publish allure report to S3
uses: andrcuns/[email protected]
if: always()
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.E2E_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.E2E_AWS_SECRET_ACCESS_KEY }}
with:
storageType: s3
resultsGlob: './reports/allure/results'
bucket: lace-e2e-test-results
prefix: 'smoke/linux/chrome/${{ github.run_number }}'
copyLatest: true
ignoreMissingResults: true
updatePr: comment
baseUrl: 'https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASSWORD }}@${{ secrets.E2E_REPORTS_URL }}'
- name: Publish artifacts (logs, reports, screenshots)
uses: actions/upload-artifact@v4
if: always()
with:
name: test-artifacts
path: |
./packages/e2e-tests/screenshots
./packages/e2e-tests/logs
./packages/e2e-tests/reports
retention-days: 5
- run: |
if [[ ${{ needs.smokeTests.result }} == "success" ]]; then
exit 0
else
exit 1
fi
if-core-changed:
name: When core changed
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-20.04
outputs:
requireChromaticCheck: ${{ steps.diffcheck.outputs.requireChromaticCheck }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diffcheck
run: |
set +e
git diff --quiet ${{ github.event.pull_request.base.sha }}..${{ github.sha }} -- packages/core/**
echo "requireChromaticCheck=$?" >> "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
set -e
chromaticCore:
name: >
Run Chromatic check: Core
runs-on: ubuntu-20.04
needs:
- prepare
- if-core-changed
steps:
- name: Checkout repository
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js and install dependencies
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Chromatic packages-core
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/chromatic
with:
DIR: packages/core
NAME: packages-core
TOKEN: ${{ secrets.CHROMATIC_LACE_CORE_TOKEN }}
- name: Skip
if: ${{ needs.if-core-changed.outputs.requireChromaticCheck == 0 }}
run: echo "Chromatic check for packages/core not needed"
exit 0
if-staking-changed:
name: When staking change
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-20.04
outputs:
requireChromaticCheck: ${{ steps.diffcheck.outputs.requireChromaticCheck }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: diffcheck
run: |
set +e
git diff --quiet ${{ github.event.pull_request.base.sha }}..${{ github.sha }} -- packages/staking/**
echo "requireChromaticCheck=$?" >> "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
set -e
chromaticStaking:
name: >
Run Chromatic check: Staking
runs-on: ubuntu-20.04
needs:
- prepare
- if-staking-changed
steps:
- name: Checkout repository
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js and install dependencies
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/install
with:
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Download packages-common
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-common
path: packages/common/dist
- name: Download packages-cardano
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-cardano
path: packages/cardano/dist
- name: Download packages-translation
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-translation
path: packages/translation/dist
- name: Download packages-core
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-core
path: packages/core/dist
- name: Download packages-staking
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: actions/download-artifact@v4
with:
name: packages-staking
path: packages/staking/dist
- name: Chromatic packages-staking
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 1 }}
uses: ./.github/actions/chromatic
with:
DIR: packages/staking
NAME: packages-staking
TOKEN: ${{ secrets.CHROMATIC_LACE_STAKING_TOKEN }}
- name: Skip
if: ${{ needs.if-staking-changed.outputs.requireChromaticCheck == 0 }}
run: echo "Chromatic check for packages/staking not needed"
exit 0