forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
674 lines (634 loc) · 22.1 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
version: 2.1
orbs:
win: circleci/[email protected]
go: circleci/[email protected]
slack: circleci/[email protected]
parameters:
ubuntu_image:
type: string
default: "ubuntu-2004:202104-01"
build_dir:
type: string
default: "/opt/cibuild"
result_path:
type: string
default: "/tmp/build_test_results"
executors:
amd64_medium:
machine:
image: << pipeline.parameters.ubuntu_image >>
resource_class: medium
amd64_large:
machine:
image: << pipeline.parameters.ubuntu_image >>
resource_class: large
arm64_medium:
machine:
image: << pipeline.parameters.ubuntu_image >>
resource_class: arm.medium
arm64_large:
machine:
image: << pipeline.parameters.ubuntu_image >>
resource_class: arm.large
mac_amd64_medium:
macos:
xcode: 12.0.1
resource_class: medium
environment:
HOMEBREW_NO_AUTO_UPDATE: "true"
mac_amd64_large:
macos:
xcode: 12.0.1
resource_class: large
environment:
HOMEBREW_NO_AUTO_UPDATE: "true"
workflows:
version: 2
"circleci_build_and_test":
jobs:
- codegen_verification
- build:
name: << matrix.platform >>_build
matrix: &matrix-default
parameters:
platform: ["amd64", "arm64", "mac_amd64"]
- test:
name: << matrix.platform >>_test
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters: &filters-default
branches:
ignore:
- /rel\/.*/
- /hotfix\/.*/
- test_nightly:
name: << matrix.platform >>_test_nightly
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters: &filters-nightly
branches:
only:
- /rel\/.*/
- /hotfix\/.*/
context: slack-secrets
- integration:
name: << matrix.platform >>_integration
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default
- integration_nightly:
name: << matrix.platform >>_integration_nightly
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-nightly
context: slack-secrets
- e2e_expect:
name: << matrix.platform >>_e2e_expect
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default
- e2e_expect_nightly:
name: << matrix.platform >>_e2e_expect_nightly
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-nightly
context: slack-secrets
- e2e_subs:
name: << matrix.platform >>_e2e_subs
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default
- e2e_subs_nightly:
name: << matrix.platform >>_e2e_subs_nightly
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-nightly
context:
- slack-secrets
- aws-secrets
- tests_verification_job:
name: << matrix.platform >>_<< matrix.job_type >>_verification
matrix:
parameters:
platform: ["amd64", "arm64", "mac_amd64"]
job_type: ["test", "test_nightly", "integration", "integration_nightly", "e2e_expect", "e2e_expect_nightly"]
requires:
- << matrix.platform >>_<< matrix.job_type >>
- upload_binaries:
name: << matrix.platform >>_upload_binaries
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_test_nightly_verification
- << matrix.platform >>_integration_nightly_verification
- << matrix.platform >>_e2e_expect_nightly_verification
- << matrix.platform >>_e2e_subs_nightly
- codegen_verification
filters:
branches:
only:
- /rel\/.*/
context:
- slack-secrets
- aws-secrets
#- windows_x64_build
commands:
prepare_go:
description: Clean out existing Go so we can use our preferred version
steps:
- run: |
sudo rm -rf ${HOME}/.go_workspace /usr/local/go
prepare_build_dir:
description: Set up build directory
parameters:
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
steps:
- run:
working_directory: /tmp
command: |
sudo mkdir -p << parameters.build_dir >>
sudo chown -R $USER:$GROUP << parameters.build_dir >>
prepare_windows:
description: Prepare windows image
steps:
- run:
name: install deps
shell: bash.exe
command: |
choco install -y msys2 pacman make wget --force
choco install -y golang --version=1.17.9 --force
choco install -y python3 --version=3.7.3 --force
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-libtool unzip autoconf automake
generic_build:
description: Run basic build and store in workspace for re-use by different architectures
parameters:
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
steps:
- restore_libsodium
- restore_cache:
keys:
- 'go-mod-1-14-7-v2-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
- restore_cache:
keys:
- 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-'
- run:
name: scripts/travis/build.sh --make_debug
command: |
export PATH=$(echo "$PATH" | sed -e "s|:${HOME}/\.go_workspace/bin||g" | sed -e 's|:/usr/local/go/bin||g')
export GOPATH="<< parameters.build_dir >>/go"
export ALGORAND_DEADLOCK=enable
export GIMME_INSTALL_DIR=<< parameters.build_dir >>
export GIMME_ENV_PREFIX=<< parameters.build_dir >>/.gimme/envs
export GIMME_VERSION_PREFIX=<< parameters.build_dir >>/.gimme/versions
scripts/travis/build.sh --make_debug
- cache_libsodium
- save_cache:
key: 'go-mod-1-14-7-v2-{{ arch }}-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}'
paths:
- << parameters.build_dir >>/go/pkg/mod
- save_cache:
key: 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-{{ .Environment.CIRCLE_BUILD_NUM }}'
paths:
- tmp/go-cache
- persist_to_workspace:
root: << parameters.build_dir >>
paths:
- project
- go
- gimme
- .gimme
cache_libsodium:
description: Cache libsodium for build
steps:
- run:
name: Get libsodium md5
command: |
mkdir -p tmp
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
- save_cache:
key: 'libsodium-fork-v2-{{ .Environment.CIRCLE_STAGE }}-{{ checksum "tmp/libsodium.md5" }}'
paths:
- crypto/libs
restore_libsodium:
description: Restore libsodium for build
steps:
- run:
name: Get libsodium md5
command: |
mkdir -p tmp
find crypto/libsodium-fork -type f -exec openssl md5 "{}" + > tmp/libsodium.md5
- restore_cache:
keys:
- 'libsodium-fork-v2-{{ .Environment.CIRCLE_STAGE }}-{{ checksum "tmp/libsodium.md5" }}'
generic_test:
description: Run build tests from build workspace, for re-use by diferent architectures
parameters:
platform:
type: string
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
result_subdir:
type: string
no_output_timeout:
type: string
default: 30m
short_test_flag:
type: string
default: ""
result_path:
type: string
default: << pipeline.parameters.result_path >>
steps:
- attach_workspace:
at: << parameters.build_dir >>
- run: |
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
- restore_cache:
keys:
- 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-'
- run:
name: Run build tests
no_output_timeout: << parameters.no_output_timeout >>
command: |
set -e
set -x
export PATH=$(echo "$PATH" | sed -e "s|:${HOME}/\.go_workspace/bin||g" | sed -e 's|:/usr/local/go/bin||g')
export KMD_NOUSB=True
export GOPATH="<< parameters.build_dir >>/go"
export PATH="${PATH}:${GOPATH}/bin"
export ALGORAND_DEADLOCK=enable
export GIMME_ENV_PREFIX=<< parameters.build_dir >>/.gimme/envs
export GIMME_VERSION_PREFIX=<< parameters.build_dir >>/.gimme/versions
GOLANG_VERSION=$(./scripts/get_golang_version.sh)
eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")"
scripts/configure_dev.sh
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
PACKAGES="$(go list ./... | grep -v /go-algorand/test/)"
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
export PARTITION_ID=${CIRCLE_NODE_INDEX}
gotestsum --format standard-verbose --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES
- store_artifacts:
path: << parameters.result_path >>
destination: test-results
- store_test_results:
path: << parameters.result_path >>
- persist_to_workspace:
root: << parameters.result_path >>
paths:
- << parameters.result_subdir >>
- save_cache:
key: 'go-cache-v2-{{ .Environment.CIRCLE_STAGE }}-{{ .Environment.CIRCLE_BUILD_NUM }}'
paths:
- tmp/go-cache
upload_coverage:
description: Collect coverage reports and upload them
steps:
- run:
name: Upload Coverage Reports
no_output_timeout: 10m
command: |
scripts/travis/upload_coverage.sh || true
generic_integration:
description: Run integration tests from build workspace, for re-use by diferent architectures
parameters:
platform:
type: string
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
result_subdir:
type: string
no_output_timeout:
type: string
default: 30m
short_test_flag:
type: string
default: ""
result_path:
type: string
default: << pipeline.parameters.result_path >>
steps:
- attach_workspace:
at: << parameters.build_dir >>
- run: |
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
- run:
name: Run integration tests
no_output_timeout: << parameters.no_output_timeout >>
command: |
set -x
export PATH=$(echo "$PATH" | sed -e "s|:${HOME}/\.go_workspace/bin||g" | sed -e 's|:/usr/local/go/bin||g')
export KMD_NOUSB=True
export GOPATH="<< parameters.build_dir >>/go"
export PATH="${PATH}:${GOPATH}/bin"
export ALGORAND_DEADLOCK=enable
export BUILD_TYPE=integration
export GIMME_ENV_PREFIX=<< parameters.build_dir >>/.gimme/envs
export GIMME_VERSION_PREFIX=<< parameters.build_dir >>/.gimme/versions
GOLANG_VERSION=$(./scripts/get_golang_version.sh)
eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")"
scripts/configure_dev.sh
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
export ALGOTEST=1
export SHORTTEST=<< parameters.short_test_flag >>
export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
export PARTITION_ID=${CIRCLE_NODE_INDEX}
export PARALLEL_FLAG="-p 1"
test/scripts/run_integration_tests.sh
- store_artifacts:
path: << parameters.result_path >>
destination: test-results
- store_test_results:
path: << parameters.result_path >>
- persist_to_workspace:
root: << parameters.result_path >>
paths:
- << parameters.result_subdir >>
tests_verification_command:
description: Check if all tests were run at least once and only once across all parallel runs
parameters:
result_path:
type: string
default: << pipeline.parameters.result_path >>
result_subdir:
type: string
steps:
- attach_workspace:
at: << parameters.result_path >>
- run:
name: Check if all tests were run
command: |
cat << parameters.result_path >>/<< parameters.result_subdir >>/**/testresults.json > << parameters.result_path >>/<< parameters.result_subdir >>/combined_testresults.json
python3 scripts/buildtools/check_tests.py << parameters.result_path >>/<< parameters.result_subdir >>/combined_testresults.json
- store_artifacts:
path: << parameters.result_path >>/<< parameters.result_subdir >>
destination: << parameters.result_subdir >>/combined-test-results
upload_binaries_command:
description: save build artifacts for potential deployments
parameters:
platform:
type: string
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
steps:
- attach_workspace:
at: << parameters.build_dir >>
- run:
name: Upload Binaries << parameters.platform >>
command: |
if [ "${CIRCLE_BRANCH}" = "rel/nightly" ]
then
export NO_BUILD="true"
fi
export PATH=$(echo "$PATH" | sed -e "s|:${HOME}/\.go_workspace/bin||g" | sed -e 's|:/usr/local/go/bin||g')
export GOPATH="<< parameters.build_dir >>/go"
export TRAVIS_BRANCH=${CIRCLE_BRANCH}
scripts/travis/deploy_packages.sh
- when:
condition:
equal: [ "amd64", << parameters.platform >> ]
steps:
- run:
name: test_release.sh
command: |
export TRAVIS_BRANCH=${CIRCLE_BRANCH}
scripts/travis/test_release.sh
jobs:
codegen_verification:
executor: amd64_medium
steps:
- checkout
- prepare_go
- run: |
export PATH=$(echo "$PATH" | sed -e 's|:/home/circleci/\.go_workspace/bin||g' | sed -e 's|:/usr/local/go/bin||g')
export GOPATH="/home/circleci/go"
scripts/travis/codegen_verification.sh
build:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
steps:
- prepare_build_dir
- checkout
- prepare_go
- generic_build
test:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 4
steps:
- prepare_build_dir
- prepare_go
- generic_test:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_test
short_test_flag: "-short"
- upload_coverage
test_nightly:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 4
steps:
- prepare_build_dir
- prepare_go
- generic_test:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_test_nightly
no_output_timeout: 45m
- upload_coverage
- slack/notify: &slack-fail-event
event: fail
template: basic_fail_1
integration:
parameters:
platform:
type: string
executor: << parameters.platform >>_large
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 2
environment:
E2E_TEST_FILTER: "GO"
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_integration
short_test_flag: "-short"
integration_nightly:
parameters:
platform:
type: string
executor: << parameters.platform >>_large
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 4
environment:
E2E_TEST_FILTER: "GO"
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_integration_nightly
no_output_timeout: 45m
- slack/notify:
<<: *slack-fail-event
e2e_expect:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 2
environment:
E2E_TEST_FILTER: "EXPECT"
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_expect
short_test_flag: "-short"
e2e_expect_nightly:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 2
environment:
E2E_TEST_FILTER: "EXPECT"
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform>>_e2e_expect_nightly
no_output_timeout: 45m
- slack/notify:
<<: *slack-fail-event
e2e_subs:
parameters:
platform:
type: string
executor: << parameters.platform >>_large
working_directory: << pipeline.parameters.build_dir >>/project
environment:
E2E_TEST_FILTER: "SCRIPTS"
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_subs
short_test_flag: "-short"
e2e_subs_nightly:
parameters:
platform:
type: string
executor: << parameters.platform >>_large
working_directory: << pipeline.parameters.build_dir >>/project
environment:
E2E_TEST_FILTER: "SCRIPTS"
E2E_PLATFORM: << parameters.platform >>
steps:
- prepare_build_dir
- prepare_go
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_subs_nightly
no_output_timeout: 45m
- slack/notify:
<<: *slack-fail-event
windows_x64_build:
executor:
name: win/default
size: large
steps:
- checkout
- prepare_windows
- run:
no_output_timeout: 45m
command: |
#export PATH=$(echo "$PATH" | sed -e 's|:/home/circleci/\.go_workspace/bin||g' | sed -e 's|:/usr/local/go/bin||g')
export GOPATH="/home/circleci/go"
export ALGORAND_DEADLOCK=enable
export SKIP_GO_INSTALLATION=True
export PATH=/mingw64/bin:/C/tools/msys64/mingw64/bin:/usr/bin:$PATH
export MAKE=mingw32-make
$msys2 scripts/travis/build_test.sh
shell: bash.exe
tests_verification_job:
docker:
- image: python:3.9.6-alpine
resource_class: small
working_directory: << pipeline.parameters.build_dir >>/project
parameters:
platform: # platform: ["amd64", "arm64", "mac_amd64"]
type: string
job_type: # job_type: ["test", "test_nightly", "integration", "integration_nightly", "e2e_expect", "e2e_expect_nightly"]
type: string
steps:
- checkout
- tests_verification_command:
result_subdir: << parameters.platform >>_<< parameters.job_type >>
upload_binaries:
working_directory: << pipeline.parameters.build_dir >>/project
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
steps:
- prepare_build_dir
- prepare_go
- upload_binaries_command:
platform: << parameters.platform >>
- slack/notify:
<<: *slack-fail-event