Speed up e2e building process (#395)

This commit is contained in:
Kirill Fedoseev 2020-07-14 21:53:05 +07:00 committed by GitHub
parent 42953ffe30
commit ebd97dce5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 280 additions and 131 deletions

@ -36,20 +36,6 @@ orbs:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get -y install yarn sudo apt-get update && sudo apt-get -y install yarn
yarn-install-cached-on-machine:
steps:
- restore_cache:
name: Restore Machine Yarn Package Cache
keys:
- yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run:
name: Install npm dependencies using Yarn
command: nvm use default; yarn install --frozen-lockfile
- save_cache:
name: Save Machine Yarn Package Cache
key: yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
wait-for-oracle: wait-for-oracle:
parameters: parameters:
redis-key: redis-key:
@ -73,21 +59,30 @@ orbs:
echo "Sleeping..." echo "Sleeping..."
sleep 3 sleep 3
done done
init-repo:
steps:
- checkout
- run: git submodule update --init
executors: executors:
docker-node: docker-node:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
machine-with-docker-caching: machine-with-dlc:
machine:
image: ubuntu-1604:202007-01
docker_layer_caching: true
classic-machine-without-dlc:
machine: machine:
image: circleci/classic:latest image: circleci/classic:latest
docker_layer_caching: true machine-without-dlc:
machine:
image: ubuntu-1604:202007-01
jobs: jobs:
initialize: initialize:
executor: tokenbridge-orb/docker-node executor: tokenbridge-orb/docker-node
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- restore_cache: - restore_cache:
name: Restore Yarn Package Cache name: Restore Yarn Package Cache
keys: keys:
@ -140,29 +135,34 @@ jobs:
- restore_cache: - restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }} key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run test - run: yarn run test
build-e2e-images:
executor: tokenbridge-orb/machine-without-dlc
steps:
- tokenbridge-orb/init-repo
- run:
command: |
docker login -u ${DOCKER_LOGIN} -p ${DOCKER_PASSWORD}
cd e2e-commons
docker-compose build oracle monitor ui e2e molecule_runner
docker-compose push oracle monitor ui e2e molecule_runner
oracle-e2e: oracle-e2e:
executor: tokenbridge-orb/docker-node executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init - run: ./oracle-e2e/run-tests.sh
- setup_remote_docker:
docker_layer_caching: true
- run: yarn run oracle-e2e
ui-e2e: ui-e2e:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout
- tokenbridge-orb/install-node - tokenbridge-orb/install-node
- tokenbridge-orb/install-yarn - tokenbridge-orb/install-yarn
- tokenbridge-orb/install-chrome - tokenbridge-orb/install-chrome
- run: git submodule update --init - restore_cache:
- tokenbridge-orb/yarn-install-cached-on-machine key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run ui-e2e - run: yarn run ui-e2e
monitor-e2e: monitor-e2e:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- run: ./monitor-e2e/run-tests.sh - run: ./monitor-e2e/run-tests.sh
cover: cover:
executor: tokenbridge-orb/docker-node executor: tokenbridge-orb/docker-node
@ -172,55 +172,47 @@ jobs:
- run: yarn workspace ui run coverage - run: yarn workspace ui run coverage
- run: yarn workspace ui run coveralls - run: yarn workspace ui run coveralls
deployment-oracle: deployment-oracle:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- run: - run:
name: Run the scenario name: Run the scenario
command: deployment-e2e/molecule.sh oracle command: deployment-e2e/molecule.sh oracle
no_output_timeout: 40m no_output_timeout: 40m
deployment-ui: deployment-ui:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- run: - run:
name: Run the scenario name: Run the scenario
command: deployment-e2e/molecule.sh ui command: deployment-e2e/molecule.sh ui
no_output_timeout: 40m no_output_timeout: 40m
deployment-monitor: deployment-monitor:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- run: - run:
name: Run the scenario name: Run the scenario
command: deployment-e2e/molecule.sh monitor command: deployment-e2e/molecule.sh monitor
no_output_timeout: 40m no_output_timeout: 40m
deployment-repo: deployment-repo:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- tokenbridge-orb/install-node
- tokenbridge-orb/install-yarn
- tokenbridge-orb/yarn-install-cached-on-machine
- run: - run:
name: Run the scenario name: Run the scenario
command: deployment-e2e/molecule.sh repo command: deployment-e2e/molecule.sh repo
no_output_timeout: 40m no_output_timeout: 40m
deployment-multiple: deployment-multiple:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/machine-without-dlc
steps: steps:
- checkout - tokenbridge-orb/init-repo
- run: git submodule update --init
- run: - run:
name: Run the scenario name: Run the scenario
command: deployment-e2e/molecule.sh multiple command: deployment-e2e/molecule.sh multiple
no_output_timeout: 40m no_output_timeout: 40m
ultimate: ultimate:
executor: tokenbridge-orb/machine-with-docker-caching executor: tokenbridge-orb/classic-machine-without-dlc
parameters: parameters:
scenario-name: scenario-name:
description: "Molecule scenario name used to create the infrastructure" description: "Molecule scenario name used to create the infrastructure"
@ -237,12 +229,11 @@ jobs:
default: '' default: ''
type: string type: string
steps: steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/install-node - tokenbridge-orb/install-node
- tokenbridge-orb/install-chrome - tokenbridge-orb/install-chrome
- tokenbridge-orb/install-yarn - tokenbridge-orb/install-yarn
- tokenbridge-orb/yarn-install-cached-on-machine - restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: - run:
name: Prepare the infrastructure name: Prepare the infrastructure
command: e2e-commons/up.sh deploy << parameters.scenario-name >> blocks command: e2e-commons/up.sh deploy << parameters.scenario-name >> blocks
@ -286,35 +277,93 @@ workflows:
filters: filters:
branches: branches:
only: master only: master
- oracle-e2e - build-e2e-images
- ui-e2e - oracle-e2e:
- monitor-e2e requires:
- deployment-oracle - build-e2e-images
- deployment-ui - ui-e2e:
- deployment-monitor requires:
- deployment-repo - build-e2e-images
- deployment-multiple - initialize
- monitor-e2e:
requires:
- build-e2e-images
- deployment-oracle:
requires:
- build-e2e-images
- deployment-ui:
requires:
- build-e2e-images
- deployment-monitor:
requires:
- build-e2e-images
- deployment-repo:
requires:
- build-e2e-images
- deployment-multiple:
requires:
- build-e2e-images
- ultimate: - ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: native to erc" name: "ultimate: native to erc"
scenario-name: native-to-erc scenario-name: native-to-erc
redis-key: native-erc-collected-signatures:lastProcessedBlock redis-key: native-erc-collected-signatures:lastProcessedBlock
ui-e2e-grep: "NATIVE TO ERC" ui-e2e-grep: "NATIVE TO ERC"
- ultimate: - ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: erc to native" name: "ultimate: erc to native"
scenario-name: erc-to-native scenario-name: erc-to-native
redis-key: erc-native-collected-signatures:lastProcessedBlock redis-key: erc-native-collected-signatures:lastProcessedBlock
ui-e2e-grep: "ERC TO NATIVE" ui-e2e-grep: "ERC TO NATIVE"
- ultimate: - ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: erc to erc" name: "ultimate: erc to erc"
scenario-name: erc-to-erc scenario-name: erc-to-erc
redis-key: erc-erc-collected-signatures:lastProcessedBlock redis-key: erc-erc-collected-signatures:lastProcessedBlock
ui-e2e-grep: "ERC TO ERC" ui-e2e-grep: "ERC TO ERC"
- ultimate: - ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: amb" name: "ultimate: amb"
scenario-name: amb scenario-name: amb
redis-key: amb-collected-signatures:lastProcessedBlock redis-key: amb-collected-signatures:lastProcessedBlock
oracle-e2e-script: "amb" oracle-e2e-script: "amb"
- ultimate: - ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: amb stake erc to erc" name: "ultimate: amb stake erc to erc"
scenario-name: ultimate-amb-stake-erc-to-erc scenario-name: ultimate-amb-stake-erc-to-erc
redis-key: amb-collected-signatures:lastProcessedBlock redis-key: amb-collected-signatures:lastProcessedBlock

@ -1,15 +1,31 @@
FROM node:10 FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY oracle-e2e/package.json ./oracle-e2e/ COPY oracle-e2e/package.json ./oracle-e2e/
COPY monitor-e2e/package.json ./monitor-e2e/ COPY monitor-e2e/package.json ./monitor-e2e/
COPY contracts/package.json ./contracts/
COPY yarn.lock . COPY yarn.lock .
RUN yarn install --frozen-lockfile RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn install:deploy
RUN yarn compile:contracts
COPY . . COPY ./contracts/deploy ./contracts/deploy
RUN yarn install:deploy
COPY commons/ ./commons/
COPY oracle-e2e/ ./oracle-e2e/
COPY monitor-e2e/ ./monitor-e2e/
COPY e2e-commons/ ./e2e-commons/

@ -1,20 +1,29 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:12 as alm-builder FROM node:12 as alm-builder
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
COPY contracts/package.json ./contracts/ COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/ COPY commons/package.json ./commons/
COPY alm/package.json ./alm/ COPY alm/package.json ./alm/
COPY yarn.lock . COPY yarn.lock .
RUN yarn install --production --frozen-lockfile RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
COPY ./commons ./commons COPY ./commons ./commons
COPY ./alm ./alm COPY ./alm ./alm
ARG DOT_ENV_PATH=./alm/.env ARG DOT_ENV_PATH=./alm/.env
COPY ${DOT_ENV_PATH} ./alm/.env COPY ${DOT_ENV_PATH} ./alm/.env

@ -1,12 +0,0 @@
---
version: '3.0'
services:
molecule_runner:
build:
context: ..
dockerfile: deployment-e2e/Dockerfile
restart: 'no'
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ..:/mono

@ -1,9 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd $(dirname $0) cd ./e2e-commons
set -e # exit when any command fails set -e # exit when any command fails
docker-compose pull molecule_runner
docker network create --driver bridge ultimate || true
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
docker-compose build && docker-compose run molecule_runner /bin/bash -c "molecule test --scenario-name $1" docker-compose run molecule_runner /bin/bash -c "molecule test --scenario-name $1"
shift # Shift all the parameters down by one shift # Shift all the parameters down by one
done done

@ -0,0 +1,7 @@
ARG DOCKER_LOGIN
ARG CIRCLE_BRANCH
FROM ${DOCKER_LOGIN}/tokenbridge-e2e-ui:${CIRCLE_BRANCH}
ARG DOT_ENV_PATH
COPY ${DOT_ENV_PATH} ./.env

@ -22,9 +22,16 @@ Shut down and cleans up containers, networks, services, running scripts:
| --- | --- | | --- | --- |
| deploy | Deploys the Smart Contracts | | deploy | Deploys the Smart Contracts |
| oracle | Launches Oracle containers | | oracle | Launches Oracle containers |
| oracle-validator-2 | Launches Oracle containers for second validator |
| oracle-validator-3 | Launches Oracle containers for third validator |
| ui | Launches UI containers | | ui | Launches UI containers |
| blocks | Auto mines blocks | | blocks | Auto mines blocks |
| monitor | Launches Monitor containers |
| native-to-erc | Creates infrastructure for ultimate e2e testing, for native-to-erc type of bridge | | native-to-erc | Creates infrastructure for ultimate e2e testing, for native-to-erc type of bridge |
| erc-to-native | Creates infrastructure for ultimate e2e testing, for erc-to-native type of bridge |
| erc-to-erc | Creates infrastructure for ultimate e2e testing, for erc-to-erc type of bridge |
| amb | Creates infrastructure for ultimate e2e testing, for arbitrary message type of bridge |
| ultimate-amb-stake-erc-to-erc | Creates infrastructure for ultimate e2e testing, for stake token bridge |
#### Ultimate e2e testing #### Ultimate e2e testing

@ -15,13 +15,13 @@ It runs the e2e tests on components deployed using the deployment playbooks.
Run the Parity nodes, deploy the bridge contracts, deploy Oracle using the deployment playbook. Run the Parity nodes, deploy the bridge contracts, deploy Oracle using the deployment playbook.
```bash ```bash
./up.sh deploy native-to-erc ./up.sh deploy native-to-erc blocks
``` ```
### 2. Run the E2E tests ### 2. Run the E2E tests
``` ```
docker-compose run e2e yarn workspace oracle-e2e run native-to-erc cd ui-e2e; yarn mocha -g "NATIVE_TO_ERC" -b ./test.js
``` ```
## Diagram ## Diagram

@ -27,6 +27,7 @@ services:
networks: networks:
- ultimate - ultimate
oracle: oracle:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
@ -37,6 +38,7 @@ services:
networks: networks:
- ultimate - ultimate
oracle-erc20: oracle-erc20:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
@ -47,6 +49,7 @@ services:
networks: networks:
- ultimate - ultimate
oracle-erc20-native: oracle-erc20-native:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
@ -57,6 +60,7 @@ services:
networks: networks:
- ultimate - ultimate
oracle-amb: oracle-amb:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: oracle/Dockerfile dockerfile: oracle/Dockerfile
@ -67,6 +71,7 @@ services:
networks: networks:
- ultimate - ultimate
ui: ui:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-ui:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: ui/Dockerfile
@ -78,8 +83,10 @@ services:
ui-erc20: ui-erc20:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: e2e-commons/Dockerfile.ui
args: args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20.env DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20.env
command: "true" command: "true"
networks: networks:
@ -87,8 +94,10 @@ services:
ui-erc20-native: ui-erc20-native:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: e2e-commons/Dockerfile.ui
args: args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20-native.env DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20-native.env
command: "true" command: "true"
networks: networks:
@ -96,13 +105,16 @@ services:
ui-amb-stake-erc20-erc20: ui-amb-stake-erc20-erc20:
build: build:
context: .. context: ..
dockerfile: ui/Dockerfile dockerfile: e2e-commons/Dockerfile.ui
args: args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env DOT_ENV_PATH: e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env
command: "true" command: "true"
networks: networks:
- ultimate - ultimate
monitor: monitor:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
@ -113,6 +125,7 @@ services:
networks: networks:
- ultimate - ultimate
monitor-erc20: monitor-erc20:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
@ -123,6 +136,7 @@ services:
networks: networks:
- ultimate - ultimate
monitor-erc20-native: monitor-erc20-native:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
@ -133,6 +147,7 @@ services:
networks: networks:
- ultimate - ultimate
monitor-amb: monitor-amb:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: monitor/Dockerfile dockerfile: monitor/Dockerfile
@ -143,6 +158,7 @@ services:
networks: networks:
- ultimate - ultimate
e2e: e2e:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-e2e:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: Dockerfile.e2e dockerfile: Dockerfile.e2e
@ -150,9 +166,20 @@ services:
networks: networks:
- ultimate - ultimate
blocks: blocks:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-e2e:${CIRCLE_BRANCH}
build: build:
context: .. context: ..
dockerfile: Dockerfile.e2e dockerfile: Dockerfile.e2e
entrypoint: node e2e-commons/scripts/blocks.js entrypoint: node e2e-commons/scripts/blocks.js
networks: networks:
- ultimate - ultimate
molecule_runner:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-molecule_runner:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: deployment-e2e/Dockerfile
restart: 'no'
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ..:/mono

15
e2e-commons/pull.sh Executable file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
cd $(dirname $0)
set -e # exit when any command fails
docker-compose pull e2e
while [ "$1" != "" ]; do
if [ "$1" == "oracle" ]; then
docker-compose pull oracle
elif [ "$1" == "monitor" ]; then
docker-compose pull monitor
elif [ "$1" == "ui" ]; then
docker-compose pull ui
fi
shift
done

@ -23,10 +23,10 @@ function main() {
setTimeout(async () => { setTimeout(async () => {
try { try {
generateNewBlock(homeWeb3, blockGenerator.address) generateNewBlock(homeWeb3, blockGenerator.address)
} catch {} // in case of Transaction with the same hash was already imported. } catch (_) {} // in case of Transaction with the same hash was already imported.
try { try {
generateNewBlock(foreignWeb3, blockGenerator.address) generateNewBlock(foreignWeb3, blockGenerator.address)
} catch {} // in case of Transaction with the same hash was already imported. } catch (_) {} // in case of Transaction with the same hash was already imported.
main() main()
}, 1000) }, 1000)
} }

@ -3,14 +3,12 @@ cd $(dirname $0)
set -e # exit when any command fails set -e # exit when any command fails
./down.sh ./down.sh
docker-compose build docker-compose build parity1 parity2
test -n "$NODOCKERPULL" || ./pull.sh $@
docker network create --driver bridge ultimate || true docker network create --driver bridge ultimate || true
docker-compose up -d parity1 parity2 e2e docker-compose up -d parity1 parity2 e2e
startValidator () { startValidator () {
# make sure that old image tags are not cached
docker-compose $1 build
docker-compose $1 run -d --name $4 redis docker-compose $1 run -d --name $4 redis
docker-compose $1 run -d --name $5 rabbit docker-compose $1 run -d --name $5 rabbit
docker-compose $1 run $2 $3 -d oracle yarn watcher:signature-request docker-compose $1 run $2 $3 -d oracle yarn watcher:signature-request
@ -36,7 +34,7 @@ startValidator () {
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
if [ "$1" == "oracle" ]; then if [ "$1" == "oracle" ]; then
docker-compose up -d redis rabbit oracle oracle-erc20 oracle-erc20-native oracle-amb docker-compose up -d redis rabbit
docker-compose run -d oracle yarn watcher:signature-request docker-compose run -d oracle yarn watcher:signature-request
docker-compose run -d oracle yarn watcher:collected-signatures docker-compose run -d oracle yarn watcher:collected-signatures
@ -74,6 +72,9 @@ while [ "$1" != "" ]; do
fi fi
if [ "$1" == "ui" ]; then if [ "$1" == "ui" ]; then
# this should only rebuild last 3 steps from ui/Dockerfile
docker-compose build ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20
docker-compose up -d ui ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20 docker-compose up -d ui ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20
docker-compose run -d -p 3000:3000 ui yarn start docker-compose run -d -p 3000:3000 ui yarn start

@ -9,11 +9,12 @@
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": {}, "dependencies": {
"mocha": "^5.2.0",
"axios": "0.19.0"
},
"engines": { "engines": {
"node": ">= 8.9" "node": ">= 8.9"
}, },
"devDependencies": { "devDependencies": {}
"axios": "0.19.0"
}
} }

@ -1,7 +1,7 @@
while true; do while true; do
sleep 3 sleep 3
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor yarn check-all COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 yarn check-all COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native yarn check-all COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-amb yarn check-all COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-amb yarn check-all
done done

@ -1,19 +1,27 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8 FROM node:8
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
COPY contracts/package.json ./contracts/ COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/ COPY commons/package.json ./commons/
COPY monitor/package.json ./monitor/ COPY monitor/package.json ./monitor/
COPY yarn.lock . COPY yarn.lock .
RUN yarn install --frozen-lockfile --production RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
COPY ./commons ./commons COPY ./commons ./commons
COPY ./monitor ./monitor COPY ./monitor ./monitor
WORKDIR /mono/monitor WORKDIR /mono/monitor

@ -11,6 +11,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"mocha": "^5.2.0",
"chalk": "^2.4.1", "chalk": "^2.4.1",
"dotenv": "^6.0.0", "dotenv": "^6.0.0",
"promise-retry": "^1.1.1", "promise-retry": "^1.1.1",

@ -1,3 +1,16 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8 FROM node:8
RUN apt-get update RUN apt-get update
@ -9,18 +22,13 @@ RUN apt-get clean
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
COPY contracts/package.json ./contracts/ COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/ COPY commons/package.json ./commons/
COPY oracle/package.json ./oracle/ COPY oracle/package.json ./oracle/
COPY yarn.lock . COPY yarn.lock .
RUN yarn install --production --frozen-lockfile RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
COPY ./commons ./commons COPY ./commons ./commons
COPY ./oracle ./oracle COPY ./oracle ./oracle
WORKDIR /mono/oracle WORKDIR /mono/oracle

@ -42,9 +42,10 @@
"test": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude monitor-e2e test", "test": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude monitor-e2e test",
"oracle-e2e": "./oracle-e2e/run-tests.sh", "oracle-e2e": "./oracle-e2e/run-tests.sh",
"ui-e2e": "./ui-e2e/run-tests.sh", "ui-e2e": "./ui-e2e/run-tests.sh",
"monitor-e2e": "./monitor-e2e/run-tests.sh",
"clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build ./**/**/dist", "clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build ./**/**/dist",
"compile:contracts": "yarn workspace token-bridge-contracts run compile", "compile:contracts": "yarn workspace token-bridge-contracts run compile",
"install:deploy": "cd contracts/deploy && npm install --unsafe-perm --silent", "install:deploy": "cd contracts/deploy && npm install --unsafe-perm --silent",
"postinstall": "ln -sf $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity" "postinstall": "test -n \"$NOYARNPOSTINSTALL\" || ln -sf $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity"
} }
} }

@ -1,21 +1,30 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8 FROM node:8
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
COPY contracts/package.json ./contracts/ COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/ COPY commons/package.json ./commons/
COPY ui/package.json ./ui/ COPY ui/package.json ./ui/
COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js
COPY yarn.lock . COPY yarn.lock .
RUN yarn install --production --frozen-lockfile RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
COPY ./commons ./commons COPY ./commons ./commons
COPY ./ui ./ui COPY ./ui ./ui
ARG DOT_ENV_PATH=./ui/.env ARG DOT_ENV_PATH=./ui/.env
COPY ${DOT_ENV_PATH} ./ui/.env COPY ${DOT_ENV_PATH} ./ui/.env