-
Notifications
You must be signed in to change notification settings - Fork 376
823 lines (814 loc) · 34.2 KB
/
circleci.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
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
name: celo-monorepo
run-name: celo-monorepo tests
# Dockefile for the self-hosted runner:
# https://github.com/celo-org/infrastructure/blob/master/terraform/root-modules/gcp/integration-tests-gke/files/github-arc/Dockerfile-monorepo
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: circle-ci-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash --login -eo pipefail {0}
env:
# Increment these to force cache rebuilding
NODE_MODULE_CACHE_VERSION: 3
NODE_OPTIONS: '--max-old-space-size=4096'
TERM: dumb
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"'
# Git Tag for contract release to use
RELEASE_TAG: ganache-v7-core-contracts.v9
# RELEASE_TAG: core-contracts.v9
# CELO_BLOCKCHAIN_BRANCH_TO_TEST: master
CELO_BLOCKCHAIN_BRANCH_TO_TEST: release/1.7.x
jobs:
install-dependencies:
name: Install dependencies
outputs:
package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }}
# Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs
# Adding a initial comma so ',<path>' matches also for the first file
all_modified_files: ',${{ steps.changed-files.outputs.all_modified_files }}'
# runs-on: ubuntu-latest
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
steps:
- name: Restore .git cache
uses: actions/cache@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
restore-keys: |
git-
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify setup for incremental testing
run: |
set -euo pipefail
set -v
# To get the "master" branch mapping
git checkout master
git checkout ${GITHUB_SHA}
# Verify that following commands work, they are later called in the incremental testing script
# Their output does not matter here, the fact that they finish successfully does.
git rev-parse --abbrev-ref HEAD
git fetch --all --tags
- name: Calculate node cache keys
id: node-checksums
run: |
find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/package.checksum
find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat >> $RUNNER_TEMP/package.checksum
echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')"
echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')" >> "$GITHUB_OUTPUT"
- name: Restore node cache
uses: actions/cache@v3
id: cache_node
with:
# We need to cache all the artifacts generated by yarn install+build
# Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list
path: |
node_modules
packages/**/node_modules
key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }}
restore-keys: |
node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-
# We use cache to share the build artifacts between jobs (gh artifacts are too slow...)
# For more context check https://github.com/actions/upload-artifact/issues/199
- name: Restore build artifacts cache
uses: actions/cache@v3
id: cache_build_artifacts
with:
# We need to cache all the artifacts generated by yarn install+build
# Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list
path: |
packages/**/lib
packages/**/dist
packages/**/build
packages/protocol/*.js
packages/protocol/*.js.map
packages/protocol/**/*.js
packages/protocol/**/*.js.map
packages/sdk/contractkit/src/generated
key: code-${{ github.sha }}
restore-keys: |
code-${{ github.sha }}
- name: Install yarn dependencies
run: git config --global url."https://".insteadOf ssh:// && yarn install
if: steps.cache_node.outputs.cache-hit != 'true'
- name: Run yarn postinstall if cache hitted
run: yarn run postinstall
if: steps.cache_node.outputs.cache-hit == 'true'
- name: Fail if generated dependency graph doesn't match committed
run: ./scripts/ci_check_dependency_graph_changed.sh
- name: Fail if any file changed on git
run: |
# This fails if there is any change
if ! git diff-index HEAD --; then
echo "Git changes detected while building. If this is unexpected, bump NODE_MODULE_CACHE_VERSION in .github/workflows/circleci.yml"
exit 1
fi
- name: Build packages
run: yarn build --ignore docs --include-dependencies
- name: Check licenses
if: steps.cache_node.outputs.cache-hit != 'true'
run: |
yarn check-licenses
- name: Detect files changed in PR, and expose as output
id: changed-files
uses: tj-actions/changed-files@v37
with:
# Using comma as separator to be able to easily match full paths (using ,<path>)
separator: ','
# Checking if changed in the last 100 commits in PRs
fetch_depth: '150'
- run: echo ",${{ steps.changed-files.outputs.all_modified_files }}"
lint-checks:
name: Lint code
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: install-dependencies
steps:
# Restore .git cache as we need to checkout the local composite action to run it:
# https://github.com/orgs/community/discussions/11771
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- run: yarn run prettify:diff
- run: yarn run lint
general_test:
name: General jest test
runs-on: ['self-hosted', 'monorepo-node18']
needs: install-dependencies
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Run Jest Tests
run: |
mkdir -p test-results/jest
# Skipping packages that are tested in a specific job below
yarn run lerna \
--ignore @celo/contractkit \
--ignore @celo/protocol \
--ignore @celo/celotool \
--ignore @celo/celocli \
--ignore @celo/env-tests \
--ignore @celo/identity \
--ignore @celo/transactions-uri \
--ignore '@celo/wallet-*' \
run test
- name: Upload Jest Test Results
uses: actions/upload-artifact@v3
with:
name: Jest Test Results
path: test-results/jest
wallet-test:
name: Wallet test
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: install-dependencies
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Run Wallet tests
run: |
yarn run lerna --scope '@celo/wallet-*' run test
pre-protocol-test-release:
name: Protocol Tests Prepare
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
# Comment lint-checks dependency to speed up (as this is a dependency for many other jobs)
# needs: [install-dependencies, lint-checks]
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
outputs:
protocol-test-must-run: ${{ steps.protocol-test-must-run.outputs.PROTOCOL_TEST_MUST_RUN }}
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Cache protocol devchain
uses: actions/cache@v3
id: cache_protocol
with:
path: packages/protocol/.tmp/released_chain
key: protocol-${{ github.sha }}
restore-keys: |
protocol-${{ github.sha }}
- name: Opcode tests
run: |
yarn --cwd packages/protocol check-opcodes
- uses: actions/setup-node@v3
with:
node-version: 12.22.11
- name: Generate devchain of previous release
run: |
echo "Comparing against $RELEASE_TAG"
# Github has phased out the git protocol so we ensure that we use
# https for all git operations that yarn may perform.
git config --global url."https://github.com".insteadOf git://github.com
yarn --cwd packages/protocol test:generate-old-devchain-and-build -b $RELEASE_TAG -d .tmp/released_chain -l /dev/stdout -g scripts/truffle/releaseGoldExampleConfigs.json
protocol-test-release:
name: Protocol Test Release
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies, lint-checks, pre-protocol-test-release]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/protocol-sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Copy DevChain and Build generated from released tag
run: |
BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g'))
(cp -r packages/protocol/.tmp/released_chain packages/protocol/$BUILD_AND_DEVCHAIN_DIR)
- name: Test against current release
run: |
echo "Comparing against $RELEASE_TAG"
BUILD_AND_DEVCHAIN_DIR=$(echo build/$(echo $RELEASE_TAG | sed -e 's/\//_/g'))
yarn --cwd packages/protocol test:devchain-release -b $RELEASE_TAG -d $BUILD_AND_DEVCHAIN_DIR -l /dev/stdout
protocol-test-matrix:
# Keeping name short because GitHub UI does not handle long names well
name: ${{ matrix.name }}
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 60
needs: [install-dependencies, lint-checks]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
strategy:
fail-fast: false
matrix:
include:
- name: Protocol Reslease Snapshots
command: |
yarn --cwd packages/protocol test:release-snapshots
if [[ $(git status packages/protocol/releaseData/versionReports --porcelain) ]]; then
git --no-pager diff packages/protocol/releaseData/versionReports
echo "There are git differences after generating release version report snapshots"
echo "If these changes are intended, update the 'releaseData/versionReports' accordingly"
exit 1
fi
- name: Protocol Common tests
command: |
yarn --cwd packages/protocol test common/
- name: Protocol Compatibility
command: |
yarn --cwd packages/protocol test compatibility/
- name: Protocol Governance Network
command: |
yarn --cwd packages/protocol test governance/network/
- name: Protocol Governance Validators
command: |
yarn --cwd packages/protocol test governance/validators/
- name: Protocol Governance Voting
command: |
yarn --cwd packages/protocol test governance/voting/
- name: Protocol Identity
command: |
yarn --cwd packages/protocol test identity/
- name: Protocol Stability
command: |
yarn --cwd packages/protocol test stability/
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
rebuild-package: 'true'
- name: Build protocol
run: |
yarn --cwd packages/protocol build
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20
if: contains(matrix.command, 'common/') && false
with:
limit-access-to-actor: true
- name: Execute matrix command for test
uses: nick-fields/retry@v2
with:
timeout_minutes: 40
max_attempts: 3
command: |
${{ matrix.command }}
contractkit-tests:
name: ContractKit Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Generate DevChain
run: |
cd packages/sdk/contractkit
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/sdk/contractkit test
identity-tests:
name: Identity Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies, contractkit-tests]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy/common') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Generate DevChain
run: |
cd packages/sdk/identity
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/sdk/identity test
transactions-uri-tests:
name: Transaction URI Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies, contractkit-tests]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
with:
fetch_depth: '150'
- name: Generate DevChain
run: |
cd packages/sdk/identity
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/sdk/identity test
cli-tests:
name: CeloCli Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/cli') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy/common') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Generate DevChain
run: |
cd packages/cli
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/cli test
- name: Fail if someone forgot to commit CLI docs
run: |
yarn --cwd=packages/cli docs
if [[ $(git status packages/docs/command-line-interface --porcelain) ]]; then
git --no-pager diff packages/docs/command-line-interface
echo "There are git differences after generating CLI docs"
exit 1
fi
- name: Verify that a new account can be created
run: |
yarn --cwd=packages/cli run celocli account:new
typescript-tests:
name: Typescript package Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Install and test the npm package
run: |
set -euo pipefail
cd packages/typescript
yarn pack
cd $RUNNER_TEMP
npm install $RUNNER_WORKSPACE/celo-monorepo/packages/typescript/*.tgz
base-test:
name: SDK Base package Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20
if: false
with:
limit-access-to-actor: true
- name: Install and test the npm package
run: |
set -euo pipefail
cd packages/sdk/base
yarn pack
cd $RUNNER_TEMP
npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/base/*.tgz
utils-test:
name: SDK Utils package Tests
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Install and test the npm package
run: |
set -euo pipefail
cd packages/sdk/base
yarn pack
cd ../utils
yarn pack
cd $RUNNER_TEMP
npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/base/*.tgz
npm install $RUNNER_WORKSPACE/celo-monorepo/packages/sdk/utils/*.tgz
end-to-end-geth-matrix:
# Keeping name short because GitHub UI does not handle long names well
name: e2e ${{ matrix.name }}
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 60
needs: [install-dependencies, lint-checks, contractkit-tests]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/celotool') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy/common') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
strategy:
fail-fast: false
matrix:
include:
- name: Transfer test
command: |
set -e
# Forcing to load go and rust paths
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_transfers.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Blockchain Parameters test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_blockchain_parameters.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Slashing test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_slashing.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Governance test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_governance.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Replica test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_replicas.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Sync test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_sync.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: Validator order test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_validator_order.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
- name: CIP35 eth compatibility test
command: |
set -e
export PATH="/usr/local/go/bin:$HOME/.cargo/bin:${PATH}"
cd packages/celotool
./ci_test_cip35.sh checkout ${CELO_BLOCKCHAIN_BRANCH_TO_TEST}
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
rebuild-package: 'true'
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20
if: contains(matrix.command, 'ci_test_transfers.sh') && false
with:
limit-access-to-actor: true
- name: Execute matrix command for test
uses: nick-fields/retry@v2
with:
timeout_minutes: 30
max_attempts: 3
command: |
${{ matrix.command }}
odis-test:
name: ODIS test
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies, lint-checks]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Run Tests for common package
run: |
yarn --cwd=packages/phone-number-privacy/common test:coverage
- name: Run Tests for combiner
run: |
yarn --cwd=packages/phone-number-privacy/combiner test:coverage
- name: Run Tests for signer
run: |
yarn --cwd=packages/phone-number-privacy/signer test:coverage
# NOTE: This has not been fully tested as we don't have a license for certora
certora-test:
name: Certora test ${{ matrix.name }}
runs-on: ['self-hosted', 'monorepo-node18']
timeout-minutes: 30
needs: [install-dependencies, lint-checks]
# Disable as certora license is not active
if: |
false && (
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock')
)
env:
CERTORAKEY: NOT_ACTIVE
strategy:
fail-fast: false
matrix:
include:
- name: Locked Gold
command: |
cd packages/protocol
./specs/scripts/lockedgold.sh
- name: Accounts
command: |
cd packages/protocol
./specs/scripts/accounts.sh
- name: Accounts
command: |
cd packages/protocol
./specs/scripts/accountsPrivileged.sh
- name: Accounts
command: |
cd packages/protocol
./specs/scripts/applyHarness.sh
./specs/scripts/governance.sh
- name: Accounts
command: |
cd packages/protocol
./specs/scripts/reserve.sh
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20
if: contains(matrix.command, '/lockedgold.sh') && false
with:
limit-access-to-actor: true
- name: Certora dependencies
run: |
echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc
sudo apt-get update
sudo apt-get install -y software-properties-common python3-pip
pip3 install certora-cli
wget https://github.com/ethereum/solidity/releases/download/v0.5.13/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/bin/solc
- name: Build and run command
run: |
${{ matrix.command }}