@@ -55,6 +55,43 @@ commands:
55
55
name : Attach workspace
56
56
at : .
57
57
58
+ make_docker_images :
59
+ description : Builds docker images
60
+ steps :
61
+ - run : make docker-child_chain
62
+ - run : make docker-watcher
63
+ - run : make docker-watcher_info
64
+
65
+ install_elixir_and_check_docker_status :
66
+ description : Installs elixir and checks if docker is healthy
67
+ steps :
68
+ - run :
69
+ name : Print docker states
70
+ command : |
71
+ docker image ls
72
+ docker-compose ps
73
+ - restore_cache :
74
+ key : v2-asdf-install
75
+ - run :
76
+ name : Install Erlang and Elixir
77
+ command : |
78
+ [ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
79
+ echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
80
+ source $BASH_ENV
81
+ asdf plugin-add erlang || asdf plugin-update erlang
82
+ asdf plugin-add elixir || asdf plugin-update elixir
83
+ asdf install
84
+ no_output_timeout : 2400
85
+ - save_cache :
86
+ key : v2-asdf-install
87
+ paths :
88
+ - ~/.asdf
89
+ - ~/.asdf-vm
90
+ - run : make install-hex-rebar
91
+ - run : sh .circleci/status.sh
92
+ - restore_cache :
93
+ key : v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
94
+
58
95
jobs :
59
96
barebuild :
60
97
executor : metal
@@ -446,40 +483,13 @@ jobs:
446
483
name : Setup data dir
447
484
command : |
448
485
[ -d data ] || mkdir data && chmod 777 data
449
- - run : make docker-child_chain
450
- - run : make docker-watcher
451
- - run : make docker-watcher_info
486
+ - make_docker_images
452
487
- run :
453
488
name : Start daemon services
454
489
command : |
455
490
cd priv/cabbage
456
491
make start_daemon_services-2 || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
457
- - run :
458
- name : Print docker states
459
- command : |
460
- docker image ls
461
- docker-compose ps
462
- - restore_cache :
463
- key : v2-asdf-install
464
- - run :
465
- name : Install Erlang and Elixir
466
- command : |
467
- [ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
468
- echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
469
- source $BASH_ENV
470
- asdf plugin-add erlang || asdf plugin-update erlang
471
- asdf plugin-add elixir || asdf plugin-update elixir
472
- asdf install
473
- no_output_timeout : 2400
474
- - save_cache :
475
- key : v2-asdf-install
476
- paths :
477
- - ~/.asdf
478
- - ~/.asdf-vm
479
- - run : make install-hex-rebar
480
- - run : sh .circleci/status.sh
481
- - restore_cache :
482
- key : v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
492
+ - install_elixir_and_check_docker_status
483
493
- run :
484
494
name : Run specs
485
495
command : |
@@ -488,12 +498,6 @@ jobs:
488
498
make generate_api_code
489
499
mix deps.get
490
500
mix test
491
- - run :
492
- name : Run load test
493
- command : |
494
- cd priv/perf
495
- make init
496
- make test
497
501
- run :
498
502
name : (Cabbage) Format generated code and check for warnings
499
503
command : |
@@ -504,9 +508,42 @@ jobs:
504
508
mix format apps/watcher_info_api/lib/watcher_info_api/model/*.ex
505
509
mix format apps/watcher_security_critical_api/lib/watcher_security_critical_api/model/*.ex
506
510
MIX_ENV=test mix do compile --warnings-as-errors --ignore-module-conflict --force, test --exclude test
511
+ - save_cache :
512
+ key : v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
513
+ paths :
514
+ - " priv/cabbage/deps"
515
+ - run :
516
+ name : (Cabbage) Credo and formatting
517
+ command : |
518
+ cd priv/cabbage
519
+ mix do credo, format --check-formatted --dry-run
520
+
521
+ test_docker_compose_performance :
522
+ machine :
523
+ image : ubuntu-1604:201903-01
524
+ steps :
525
+ - checkout
526
+ - run :
527
+ name : Setup data dir
528
+ command : |
529
+ [ -d data ] || mkdir data && chmod 777 data
530
+ - make_docker_images
531
+ - run :
532
+ name : Start daemon services
533
+ command : |
534
+ SNAPSHOT=SNAPSHOT_MIX_EXIT_PERIOD_SECONDS_120 make init_test && docker-compose -f ./docker-compose.yml up -d || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
535
+ - install_elixir_and_check_docker_status
536
+ - run :
537
+ name : Run load test
538
+ command : |
539
+ export $(cat ./localchain_contract_addresses.env | xargs)
540
+ cd priv/perf
541
+ make init
542
+ make test
507
543
- run :
508
544
name : (Perf) Format generated code and check for warnings
509
545
command : |
546
+ export $(cat ./localchain_contract_addresses.env | xargs)
510
547
cd priv/perf
511
548
# run format ONLY on formatted code so that it cleans up quoted atoms because
512
549
# we cannot exclude folders to --warnings-as-errors
@@ -515,13 +552,8 @@ jobs:
515
552
- save_cache :
516
553
key : v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
517
554
paths :
518
- - " priv/cabbage/deps"
519
555
- " priv/perf/deps"
520
- - run :
521
- name : (Cabbage) Credo and formatting
522
- command : |
523
- cd priv/cabbage
524
- mix do credo, format --check-formatted --dry-run
556
+
525
557
- run :
526
558
name : (Perf) Credo and formatting
527
559
command : |
@@ -546,40 +578,13 @@ jobs:
546
578
[ -d data1 ] || mkdir data1 && chmod 777 data1
547
579
[ -d data2 ] || mkdir data2 && chmod 777 data2
548
580
[ -d data ] || mkdir data && chmod 777 data
549
- - run : make docker-child_chain
550
- - run : make docker-watcher
551
- - run : make docker-watcher_info
581
+ - make_docker_images
552
582
- run :
553
583
name : Start daemon services
554
584
command : |
555
585
cd priv/cabbage
556
586
make start_daemon_services_reorg-2 || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
557
- - run :
558
- name : Print docker states
559
- command : |
560
- docker image ls
561
- docker-compose ps
562
- - restore_cache :
563
- key : v2-asdf-install
564
- - run :
565
- name : Install Erlang and Elixir
566
- command : |
567
- [ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
568
- echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
569
- source $BASH_ENV
570
- asdf plugin-add erlang || asdf plugin-update erlang
571
- asdf plugin-add elixir || asdf plugin-update elixir
572
- asdf install
573
- no_output_timeout : 2400
574
- - save_cache :
575
- key : v2-asdf-install
576
- paths :
577
- - ~/.asdf
578
- - ~/.asdf-vm
579
- - run : make install-hex-rebar
580
- - run : sh .circleci/status.sh
581
- - restore_cache :
582
- key : v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
587
+ - install_elixir_and_check_docker_status
583
588
- run :
584
589
name : Print watcher logs
585
590
command : make cabbage-reorg-watcher-logs
@@ -714,12 +719,6 @@ jobs:
714
719
command : |
715
720
cd priv/cabbage
716
721
mix test
717
- - run :
718
- name : Run load test
719
- command : |
720
- cd priv/perf
721
- make init
722
- make test
723
722
724
723
publish_child_chain :
725
724
machine :
@@ -920,6 +919,9 @@ workflows:
920
919
- test_docker_compose_release :
921
920
requires : [build]
922
921
filters : *all_branches_and_tags
922
+ - test_docker_compose_performance :
923
+ requires : [build]
924
+ filters : *all_branches_and_tags
923
925
- test_docker_compose_reorg :
924
926
requires : [build]
925
927
filters : *all_branches_and_tags
0 commit comments