2019-08-05 10:48:21 +03:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
orbs:
|
|
|
|
tokenbridge-orb:
|
|
|
|
commands:
|
|
|
|
install-chrome:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install Chrome
|
|
|
|
command: |
|
2019-08-12 10:22:27 +03:00
|
|
|
wget -O chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
2019-08-05 10:48:21 +03:00
|
|
|
sudo dpkg -i chrome.deb
|
|
|
|
install-node:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install Node
|
|
|
|
command: |
|
|
|
|
export NVM_DIR="/opt/circleci/.nvm"
|
|
|
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
|
|
|
|
|
|
nvm install 11.4.0 && nvm alias default 11.4.0
|
|
|
|
|
|
|
|
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
|
|
|
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
|
|
|
|
install-yarn:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install Yarn
|
|
|
|
command: |
|
|
|
|
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
|
|
|
|
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:
|
2019-08-08 17:09:24 +03:00
|
|
|
parameters:
|
|
|
|
redis-key:
|
|
|
|
type: string
|
2019-08-05 10:48:21 +03:00
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install redis tools
|
|
|
|
command: sudo apt-get install -y redis-tools
|
|
|
|
- run:
|
|
|
|
name: Wait for the Oracle to start
|
|
|
|
command: |
|
|
|
|
set +e
|
|
|
|
i=0
|
2019-08-08 17:09:24 +03:00
|
|
|
while [[ $(redis-cli GET << parameters.redis-key >> ) ]]; do
|
2019-08-05 10:48:21 +03:00
|
|
|
((i++))
|
|
|
|
if [ "$i" -gt 30 ]
|
|
|
|
then
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Sleeping..."
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
executors:
|
|
|
|
docker-node:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:10.15
|
|
|
|
machine-with-docker-caching:
|
|
|
|
machine:
|
|
|
|
image: circleci/classic:latest
|
|
|
|
docker_layer_caching: true
|
|
|
|
|
2019-05-06 16:18:40 +03:00
|
|
|
jobs:
|
2019-06-04 10:09:18 +03:00
|
|
|
initialize:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-05-15 15:23:29 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: git submodule update --init
|
2019-06-04 10:09:18 +03:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore Yarn Package Cache
|
|
|
|
keys:
|
|
|
|
- yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
|
|
|
- run: git submodule status > submodule.status
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore contracts submodule with compiled contracts
|
|
|
|
keys:
|
|
|
|
- contracts-{{ checksum "submodule.status" }}
|
|
|
|
- run: yarn install --frozen-lockfile
|
|
|
|
- save_cache:
|
|
|
|
name: Save Yarn Package Cache
|
|
|
|
key: yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- ~/.cache/yarn
|
|
|
|
- run: touch install_deploy.log; test -d contracts/build/contracts || yarn install:deploy &> install_deploy.log
|
|
|
|
- store_artifacts:
|
|
|
|
path: install_deploy.log
|
|
|
|
- run: test -d contracts/build/contracts || yarn compile:contracts
|
|
|
|
- save_cache:
|
|
|
|
name: Save contracts submodule with compiled contracts
|
|
|
|
key: contracts-{{ checksum "submodule.status" }}
|
|
|
|
paths:
|
|
|
|
- contracts
|
|
|
|
- save_cache:
|
|
|
|
name: Save initialized project for subsequent jobs
|
|
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
|
|
paths:
|
|
|
|
- ~/project
|
2019-06-13 17:17:24 +03:00
|
|
|
initialize-root:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-06-13 17:17:24 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: sudo su - -c 'export CI=true && cd /home/circleci/project && yarn initialize && yarn test'
|
2019-06-04 10:09:18 +03:00
|
|
|
build:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-06-04 10:09:18 +03:00
|
|
|
steps:
|
|
|
|
- restore_cache:
|
|
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
2019-05-15 15:23:29 +03:00
|
|
|
- run: yarn run build
|
2019-05-06 16:18:40 +03:00
|
|
|
lint:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-05-06 16:18:40 +03:00
|
|
|
steps:
|
2019-06-04 10:09:18 +03:00
|
|
|
- restore_cache:
|
|
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
2019-05-06 16:18:40 +03:00
|
|
|
- run: yarn run lint
|
|
|
|
test:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-05-06 16:18:40 +03:00
|
|
|
steps:
|
2019-06-04 10:09:18 +03:00
|
|
|
- restore_cache:
|
|
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
2019-05-06 16:18:40 +03:00
|
|
|
- run: yarn run test
|
2019-05-15 14:51:21 +03:00
|
|
|
oracle-e2e:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-05-15 14:51:21 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-05-21 10:38:41 +03:00
|
|
|
- run: git submodule update --init
|
2019-06-04 10:09:18 +03:00
|
|
|
- setup_remote_docker:
|
|
|
|
docker_layer_caching: true
|
2019-05-15 14:51:21 +03:00
|
|
|
- run: yarn run oracle-e2e
|
2019-05-21 10:41:52 +03:00
|
|
|
ui-e2e:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-05-21 10:41:52 +03:00
|
|
|
steps:
|
2019-05-20 10:56:18 +03:00
|
|
|
- checkout
|
2019-08-05 10:48:21 +03:00
|
|
|
- tokenbridge-orb/install-node
|
|
|
|
- tokenbridge-orb/install-yarn
|
|
|
|
- tokenbridge-orb/install-chrome
|
2019-05-20 10:56:18 +03:00
|
|
|
- run: git submodule update --init
|
2019-08-05 10:48:21 +03:00
|
|
|
- tokenbridge-orb/yarn-install-cached-on-machine
|
2019-05-20 10:56:18 +03:00
|
|
|
- run: yarn run ui-e2e
|
2019-06-27 10:57:45 +03:00
|
|
|
monitor-e2e:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-06-27 10:57:45 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: git submodule update --init
|
|
|
|
- run: ./monitor-e2e/run-tests.sh
|
2019-05-22 17:09:02 +03:00
|
|
|
cover:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/docker-node
|
2019-05-22 17:09:02 +03:00
|
|
|
steps:
|
2019-06-04 10:09:18 +03:00
|
|
|
- restore_cache:
|
|
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
2019-05-22 17:09:02 +03:00
|
|
|
- run: yarn workspace ui run coverage
|
|
|
|
- run: yarn workspace ui run coveralls
|
2019-07-12 15:51:06 +03:00
|
|
|
deployment-oracle:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-07-02 14:10:46 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-29 10:20:55 +03:00
|
|
|
- run: git submodule update --init
|
2019-07-12 15:51:06 +03:00
|
|
|
- run: deployment/molecule/molecule.sh oracle
|
|
|
|
deployment-ui:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-07-12 15:51:06 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-29 10:20:55 +03:00
|
|
|
- run: git submodule update --init
|
2019-07-12 15:51:06 +03:00
|
|
|
- run: deployment/molecule/molecule.sh ui
|
2019-08-02 11:34:53 +03:00
|
|
|
deployment-monitor:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-08-02 11:34:53 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-29 10:20:55 +03:00
|
|
|
- run: git submodule update --init
|
2019-08-02 11:34:53 +03:00
|
|
|
- run: deployment/molecule/molecule.sh monitor
|
2019-08-08 17:09:24 +03:00
|
|
|
ultimate:
|
2019-08-05 10:48:21 +03:00
|
|
|
executor: tokenbridge-orb/machine-with-docker-caching
|
2019-08-08 17:09:24 +03:00
|
|
|
parameters:
|
|
|
|
scenario-name:
|
|
|
|
description: "Molecule scenario name used to create the infrastructure"
|
|
|
|
type: string
|
|
|
|
redis-key:
|
|
|
|
description: "Redis key checked for non-emptiness to assert if Oracle is running"
|
|
|
|
type: string
|
|
|
|
ui-e2e-grep:
|
|
|
|
description: "Mocha grep string used to run ui-e2e tests specific to given type of bridge"
|
|
|
|
type: string
|
2019-07-17 11:14:58 +03:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-08-01 10:57:58 +03:00
|
|
|
- run: git submodule update --init
|
2019-08-05 10:48:21 +03:00
|
|
|
- tokenbridge-orb/install-node
|
|
|
|
- tokenbridge-orb/install-chrome
|
|
|
|
- tokenbridge-orb/install-yarn
|
|
|
|
- tokenbridge-orb/yarn-install-cached-on-machine
|
2019-07-17 11:14:58 +03:00
|
|
|
- run:
|
|
|
|
name: Prepare the infrastructure
|
2019-08-08 17:09:24 +03:00
|
|
|
command: e2e-commons/up.sh deploy << parameters.scenario-name >>
|
2019-07-26 11:14:25 +03:00
|
|
|
no_output_timeout: 30m
|
2019-08-08 17:09:24 +03:00
|
|
|
- tokenbridge-orb/wait-for-oracle:
|
|
|
|
redis-key: << parameters.redis-key >>
|
2019-07-26 11:14:25 +03:00
|
|
|
- run:
|
2019-08-01 10:57:58 +03:00
|
|
|
name: Run the ui-e2e tests
|
|
|
|
command: |
|
|
|
|
nvm use default;
|
|
|
|
node ./e2e-commons/scripts/blocks.js &
|
2019-08-08 17:09:24 +03:00
|
|
|
cd ui-e2e; yarn mocha -g "<< parameters.ui-e2e-grep >>" -b ./test.js
|
2019-05-06 16:18:40 +03:00
|
|
|
workflows:
|
2019-06-04 10:09:18 +03:00
|
|
|
tokenbridge:
|
2019-05-22 17:09:02 +03:00
|
|
|
jobs:
|
2019-06-04 10:09:18 +03:00
|
|
|
- initialize
|
2019-06-13 17:17:24 +03:00
|
|
|
- initialize-root:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
2019-06-04 10:09:18 +03:00
|
|
|
- build:
|
|
|
|
requires:
|
|
|
|
- initialize
|
|
|
|
- lint:
|
|
|
|
requires:
|
|
|
|
- initialize
|
|
|
|
- test:
|
|
|
|
requires:
|
|
|
|
- initialize
|
2019-05-22 17:09:02 +03:00
|
|
|
- cover:
|
2019-06-04 10:09:18 +03:00
|
|
|
requires:
|
|
|
|
- initialize
|
2019-05-22 17:09:02 +03:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
2019-05-20 16:52:02 +03:00
|
|
|
- oracle-e2e
|
2019-05-20 10:56:18 +03:00
|
|
|
- ui-e2e
|
2019-06-27 10:57:45 +03:00
|
|
|
- monitor-e2e
|
2019-07-12 15:51:06 +03:00
|
|
|
- deployment-oracle
|
|
|
|
- deployment-ui
|
2019-08-02 11:34:53 +03:00
|
|
|
- deployment-monitor
|
2019-08-08 17:09:24 +03:00
|
|
|
- ultimate:
|
|
|
|
name: "ultimate: native to erc"
|
|
|
|
scenario-name: native-to-erc
|
|
|
|
redis-key: native-erc-collected-signatures:lastProcessedBlock
|
|
|
|
ui-e2e-grep: "NATIVE TO ERC"
|
|
|
|
- ultimate:
|
|
|
|
name: "ultimate: erc to native"
|
|
|
|
scenario-name: erc-to-native
|
|
|
|
redis-key: erc-native-collected-signatures:lastProcessedBlock
|
|
|
|
ui-e2e-grep: "ERC TO NATIVE"
|
2019-08-20 11:19:42 +03:00
|
|
|
- ultimate:
|
|
|
|
name: "ultimate: erc to erc"
|
|
|
|
scenario-name: erc-to-erc
|
|
|
|
redis-key: erc-erc-collected-signatures:lastProcessedBlock
|
|
|
|
ui-e2e-grep: "ERC TO ERC"
|