forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 20
789 lines (715 loc) · 29.9 KB
/
config.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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
name: Blockscout
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
MIX_ENV: test
OTP_VERSION: '25.1.1'
ELIXIR_VERSION: '1.14.1'
ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
ACCOUNT_AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout'
ACCOUNT_AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout'
CACHE_VERSION: 20
jobs:
build-and-cache:
name: Build and Cache deps
runs-on: [self-hosted, blockscout]
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: "ELIXIR_VERSION.lock"
run: echo "${ELIXIR_VERSION}" > ELIXIR_VERSION.lock
- name: "OTP_VERSION.lock"
run: echo "${OTP_VERSION}" > OTP_VERSION.lock
- name: Restore Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-
- name: Conditionally build Mix deps cache
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
mix deps.compile
cd deps/libsecp256k1
make
- name: Restore Explorer NPM Cache
uses: actions/cache@v3
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Conditionally build Explorer NPM Cache
if: steps.explorer-npm-cache.outputs.cache-hit != 'true'
run: npm install
working-directory: apps/explorer
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v3
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- name: Conditionally build Blockscout Web NPM Cache
if: steps.blockscoutweb-npm-cache.outputs.cache-hit != 'true'
run: npm install
working-directory: apps/block_scout_web/assets
- name: Restore EventStream NPM Cache
uses: actions/cache@v3
id: eventstream-npm-cache
with:
path: apps/event_stream/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-eventstream-npm-${{ hashFiles('apps/event_stream/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-eventstream-npm-
- name: Conditionally build Event Stream NPM Cache
if: steps.eventstream-npm-cache.outputs.cache-hit != 'true'
run: npm install
working-directory: apps/event_stream/assets
credo:
name: Credo
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: mix credo
check_formatted:
name: Code formatting checks
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: mix format --check-formatted
dialyzer:
name: Dialyzer static analysis
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/[email protected]
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Dialyzer Cache
uses: actions/cache@v3
id: dialyzer-cache
with:
path: priv/plts
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-"
- name: Conditionally build Dialyzer Cache
if: steps.dialyzer-cache.output.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix dialyzer --plt
- name: Run Dialyzer
run: mix dialyzer
gettext:
name: Missing translation keys check
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: |
mix gettext.extract --merge | tee stdout.txt
! grep "Wrote " stdout.txt
working-directory: "apps/block_scout_web"
sobelow:
name: Sobelow security analysis
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Scan explorer for vulnerabilities
run: mix sobelow --config
working-directory: "apps/explorer"
- name: Scan block_scout_web for vulnerabilities
run: mix sobelow --config
working-directory: "apps/block_scout_web"
eslint:
name: ESLint
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v3
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v3
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./node_modules/.bin/eslint --format=junit --output-file="test/eslint/junit.xml" js/**
working-directory: apps/block_scout_web/assets
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: ESLint Test Results
path: apps/block_scout_web/assets/test/eslint/*.xml
jest:
name: JS Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v3
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./node_modules/.bin/jest --reporters="jest-junit"
working-directory: apps/block_scout_web/assets
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Jest JUnit Test Results
path: apps/block_scout_web/assets/junit.xml
test_nethermind_mox_ethereum_jsonrpc:
name: EthereumJSONRPC Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
services:
postgres:
image: postgres
env:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: ./bin/install_chrome_headless.sh
- run: echo 'export PATH=/usr/local/bin:$PATH' >> $GITHUB_ENV
- name: mix test --exclude no_nethermind
run: |
cd apps/ethereum_jsonrpc
mix compile --warnings-as-errors
mix test --no-start --exclude no_nethermind
env:
MIX_ENV: "test"
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: EthereumJSONRPC Test Results
path: _build/test/junit/ethereum_jsonrpc/*.xml
test_nethermind_mox_explorer:
name: Explorer Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
services:
postgres:
image: postgres
env:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v3
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm
- run: ./bin/install_chrome_headless.sh
- run: echo 'export PATH=/usr/local/bin:$PATH' >> $GITHUB_ENV
- name: mix test --exclude no_nethermind --exclude smart_contract_compiler
run: |
cd apps/explorer
mix compile --warnings-as-errors
cd ../..
mix ecto.create --quiet
mix ecto.migrate
cd apps/explorer
mix test --no-start --exclude no_nethermind --exclude smart_contract_compiler
env:
MIX_ENV: "test"
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Explorer Test Results
path: _build/test/junit/explorer/*.xml
test_nethermind_mox_indexer:
name: Indexer Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
services:
postgres:
image: postgres
env:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: mix test --exclude no_nethermind
run: |
cd apps/indexer
mix compile --warnings-as-errors
cd ../..
mix ecto.create --quiet
mix ecto.migrate
cd apps/indexer
mix test --no-start --exclude no_nethermind --exclude celo_exclude
env:
MIX_ENV: "test"
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Indexer Test Results
path: _build/test/junit/indexer/*.xml
test_nethermind_mox_block_scout_web:
name: Blockscout Web Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
services:
redis_db:
image: 'redis:alpine'
ports:
- 6379:6379
postgres:
image: postgres
env:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v3
id: explorer-npm-cache
with:
path: apps/explorer/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-explorer-npm-
- name: Restore Blockscout Web NPM Cache
uses: actions/cache@v3
id: blockscoutweb-npm-cache
with:
path: apps/block_scout_web/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-${{ hashFiles('apps/block_scout_web/assets/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-blockscoutweb-npm-
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./bin/install_chrome_headless.sh
- run: echo 'export PATH=/usr/local/bin:$PATH' >> $GITHUB_ENV
- name: mix test --exclude no_nethermind
run: |
cd apps/block_scout_web
mix compile --warnings-as-errors
cd ../..
mix ecto.create --quiet
mix ecto.migrate
cd apps/block_scout_web
mix test --no-start --exclude no_nethermind
env:
# match POSTGRES_PASSWORD for postgres image below
MIX_ENV: "test"
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_ID: "77"
COIN: "CELO"
ADMIN_PANEL_ENABLED: "true"
ACCOUNT_ENABLED: "true"
ACCOUNT_REDIS_URL: "redis://localhost:6379"
API_V2_ENABLED: "true"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Blockscout Web Test Results
path: _build/test/junit/block_scout_web/*.xml
- name: Upload Wallaby screenshots
if: always()
uses: actions/upload-artifact@v2
with:
name: Wallaby screenshots
path: apps/block_scout_web/screenshots/*.png
test_event_stream:
name: Event Stream Tests
runs-on: [self-hosted, blockscout]
needs: build-and-cache
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run: echo 'export PATH=~/.cargo/bin/:$PATH' >> $GITHUB_ENV
- name: Mix Deps Cache
uses: actions/cache@v3
id: deps-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-mixlockhash_${{ env.CACHE_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Event Stream NPM Cache
uses: actions/cache@v3
id: eventstream-npm-cache
with:
path: apps/event_stream/assets/node_modules
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-eventstream-npm-${{ hashFiles('apps/explorer/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-eventstream-npm-
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/event_stream/assets"
- name: mix test
run: |
cd apps/event_stream
mix compile --warnings-as-errors
mix test
env:
MIX_ENV: "test"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Event Stream Test Results
path: _build/test/junit/event_stream/*.xml
publish-test-results:
name: "Publish Unit Tests Results"
runs-on: [self-hosted, blockscout]
needs:
- test_nethermind_mox_ethereum_jsonrpc
- test_nethermind_mox_explorer
- test_nethermind_mox_indexer
- test_nethermind_mox_block_scout_web
- test_event_stream
- jest
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
set-docker-vars:
runs-on: [self-hosted, blockscout]
needs: [credo, check_formatted, dialyzer, gettext, sobelow, eslint, jest, test_nethermind_mox_ethereum_jsonrpc, test_nethermind_mox_explorer, test_nethermind_mox_indexer, test_nethermind_mox_block_scout_web, test_event_stream]
outputs:
workload-id-provider: ${{ steps.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ steps.set-docker-vars.outputs.service-account }}
artifact-registry: ${{ steps.set-docker-vars.outputs.artifact-registry }}
tag: ${{ steps.set-docker-vars.outputs.tag }}
sha: ${{ steps.set-docker-vars.outputs.sha }}
steps:
- name: Print inputs passed to the reusable workflow
id: set-docker-vars
run: |
echo "workload-id-provider=${{ github.ref != 'ref/heads/main' && 'projects/1094498259535/locations/global/workloadIdentityPools/gh-blockscout/providers/github-by-repos' || 'projects/1094498259535/locations/global/workloadIdentityPools/gh-blockscout-main/providers/github-by-repos' }}" >> $GITHUB_OUTPUT
echo "service-account=${{ github.ref != 'ref/heads/main' && '[email protected]' || '[email protected]' }}" >> $GITHUB_OUTPUT
echo "artifact-registry=${{ github.ref != 'ref/heads/main' && vars.DEV_IMAGE_REPO || 'us-west1-docker.pkg.dev/devopsre/blockscout' }}" >> $GITHUB_OUTPUT
echo "tag=${{ github.ref != 'ref/heads/main' && 'testing' || 'latest' }}" >> $GITHUB_OUTPUT
echo "sha=${{ github.ref != 'ref/heads/main' && github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_OUTPUT
Build-Blockscout:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
needs: [set-docker-vars]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
artifact-registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout"
tag: ${{ needs.set-docker-vars.outputs.tag }}
context: .
file: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
trivy: true
trivy-timeout: 20m
Build-Blockscout-api:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
needs: [set-docker-vars]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
artifact-registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout-api"
tag: ${{ needs.set-docker-vars.outputs.tag }}
context: .
file: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
"DISABLE_WRITE_API=true",
"DISABLE_INDEXER=true",
"DISABLE_WEBAPP=true",
trivy: true
trivy-timeout: 20m
#