Skip to content

Commit

Permalink
Merge branch 'k1rill-fedoseev-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev committed Nov 26, 2019
2 parents 5610c0e + fa93069 commit 80e5706
Show file tree
Hide file tree
Showing 152 changed files with 4,909 additions and 35,781 deletions.
172 changes: 172 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
version: 2.1
orbs:
bridge:
executors:
node-dev:
docker:
- image: circleci/node:10.15
environment:
TARGET_NETWORK: development
commands:
fetch_repo:
description: "Checkout and init submodules"
steps:
- checkout
- run:
name: "Initialize submodules"
command: git submodule update --init
setup_docker:
description: "Set up remote docker engine"
steps:
- setup_remote_docker:
version: 18.09.3
docker_layer_caching: true
restore_tss_image:
description: "Restores tss image from cache"
steps:
- restore_cache:
name: "Restore tss image from cache"
key: "tss-v1-{{ .Branch }}"
- load_tss
save_tss:
description: "Save tss image to workspace"
steps:
- run:
name: "Save tss image to archive"
command: |
mkdir -p ./workspace
docker save tss | gzip > ./workspace/tss.tar.gz
- persist_to_workspace:
name: "Save tss image to workspace"
root: ./workspace
paths:
- tss.tar.gz
- save_cache:
name: "Save tss image to cache"
paths:
- ./workspace/tss.tar.gz
key: "tss-v1-{{ .Branch }}"
load_tss:
description: "Load tss image from workspace"
steps:
- run:
name: "Load tss image from archive"
command: docker load -i ./workspace/tss.tar.gz || true
save_docker_logs:
description: "Save docker logs"
parameters:
validator:
type: integer
default: 1
steps:
- run:
name: "Saving validator<< parameters.validator >> logs"
command: |
mkdir -p ./artifacts/logs/validator<< parameters.validator >>
docker logs validator<< parameters.validator >>_rabbitmq_1 > ./artifacts/logs/validator<< parameters.validator >>/rabbitmq.log
docker logs validator<< parameters.validator >>_redis_1 > ./artifacts/logs/validator<< parameters.validator >>/redis.log
docker logs validator<< parameters.validator >>_proxy_1 > ./artifacts/logs/validator<< parameters.validator >>/proxy.log
docker logs validator<< parameters.validator >>_eth-watcher_1 > ./artifacts/logs/validator<< parameters.validator >>/eth-watcher.log
docker logs validator<< parameters.validator >>_bnc-watcher_1 > ./artifacts/logs/validator<< parameters.validator >>/bnc-watcher.log
docker logs validator<< parameters.validator >>_signer_1 > ./artifacts/logs/validator<< parameters.validator >>/signer.log
docker logs validator<< parameters.validator >>_keygen_1 > ./artifacts/logs/validator<< parameters.validator >>/keygen.log
when: always
save_artifacts:
description: "Save and upload tests results, save validator logs to artifacts"
steps:
- run:
name: "Save tests results"
command: |
mkdir -p ./artifacts/test_results/mocha
docker cp "tests:/tests/results.xml" "./artifacts/test_results/mocha/results.xml"
when: always
- store_test_results:
path: ./artifacts/test_results/mocha
when: always
- save_docker_logs:
validator: 1
- save_docker_logs:
validator: 2
- save_docker_logs:
validator: 3
- run:
name: "Save ethereum logs"
command: |
mkdir -p ./artifacts/logs/ethereum
docker logs ethereum-testnet_side-oracle_1 > ./artifacts/logs/ethereum/side-oracle.log
docker logs ethereum-testnet_ganache_home_1 > ./artifacts/logs/ethereum/ganache_home.log
docker logs ethereum-testnet_ganache_side_1 > ./artifacts/logs/ethereum/ganache_side.log
when: always
- run:
name: "Save binance logs"
command: |
mkdir -p ./artifacts/logs/binance
docker logs binance-testnet_node_1 > ./artifacts/logs/binance/node.log
docker logs binance-testnet_api-server_1 > ./artifacts/logs/binance/api-server.log
docker logs binance-testnet_http-api_1 > ./artifacts/logs/binance/http-api.log
when: always
- store_artifacts:
path: ./artifacts
destination: artifacts
when: always
jobs:
init_tss:
executor: bridge/node-dev
steps:
- bridge/fetch_repo
- bridge/setup_docker
- bridge/restore_tss_image
- run:
name: "Build tss image"
command: docker build --cache-from tss -t tss ./src/tss || docker build -t tss ./src/tss
- bridge/save_tss
run_tests:
executor: bridge/node-dev
steps:
- bridge/fetch_repo
- bridge/setup_docker
- attach_workspace:
at: ./workspace
- bridge/load_tss
- run:
name: "Init tests environment"
command: |
BLOCK_TIME=3 ./demo/start-ethereum-environment.sh
./demo/start-binance-environment.sh
N=1 ./demo/validator-demo.sh -d
N=2 ./demo/validator-demo.sh -d
N=3 ./demo/validator-demo.sh -d
- run:
name: "Wait until validator nodes are ready"
command: |
docker run --network validator1_test_network --entrypoint ash appropriate/curl:latest -c "until curl -X GET http://proxy:8002/info > /dev/null 2>&1; do sleep 1; done"
docker run --network validator2_test_network --entrypoint ash appropriate/curl:latest -c "until curl -X GET http://proxy:8002/info > /dev/null 2>&1; do sleep 1; done"
docker run --network validator3_test_network --entrypoint ash appropriate/curl:latest -c "until curl -X GET http://proxy:8002/info > /dev/null 2>&1; do sleep 1; done"
no_output_timeout: 3m
- run:
name: "Build and prepare tests container"
command: |
docker build -t tests ./tests
docker create --env-file ./tests/.env --name tests tests
docker network connect binance_net tests
docker network connect ethereum_side_rpc_net tests
docker network connect ethereum_home_rpc_net tests
docker network connect validator1_test_network tests
docker network connect validator2_test_network tests
docker network connect validator3_test_network tests
- run:
name: "Run tests"
command: docker start -a tests
- run:
name: "Check alive docker containers"
command: docker ps
when: always
- bridge/save_artifacts
workflows:
version: 2
main:
jobs:
- init_tss
- run_tests:
requires:
- init_tss
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
data/
demo/validator*/development
demo/validator*/staging
src/deploy/deploy/*/build
src/deploy/deploy-home/contracts/openzeppelin-solidity
src/deploy/deploy-test/contracts/openzeppelin-solidity
src/tss/multi-party-ecdsa
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"plugin:node/recommended",
"airbnb-base"
],
"plugins": [
"node"
],
"rules": {
"semi": [1, "never"],
"comma-dangle": [1, "never"],
"node/no-missing-require": 0,
"import/no-unresolved": 0,
"no-return-await": 0,
"no-await-in-loop": 0,
"no-constant-condition": 0
}
}
15 changes: 4 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
.idea/
node_modules/
.DS_Store
**/keys*.store
**/signature
**/params
data/
demo/validator*/development
demo/validator*/staging
demo/validator*/.keys.staging
demo/ganache_home_db/
demo/ganache_side_db/
demo/*.zip
src/deploy/deploy-home/build/
src/deploy/deploy-side/build/
src/deploy/deploy-test/build/
src/deploy/deploy*/build/
src/deploy/.keys.staging
src/test-services/.keys.staging
src/test-services/.keys.development
test.js
src/test.js
tests/results.xml
package-lock.json
Loading

0 comments on commit 80e5706

Please sign in to comment.