371 lines
12 KiB
YAML
371 lines
12 KiB
YAML
version: 2.1
|
|
|
|
orbs:
|
|
tokenbridge-orb:
|
|
commands:
|
|
install-chrome:
|
|
steps:
|
|
- run:
|
|
name: Update dpkg
|
|
command: |
|
|
sudo apt-get clean
|
|
sudo apt-get update
|
|
sudo apt-get install dpkg
|
|
- run:
|
|
name: Install Chrome
|
|
command: |
|
|
wget -O chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_77.0.3865.120-1_amd64.deb
|
|
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 10.16.3 && nvm alias default 10.16.3
|
|
|
|
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
|
|
wait-for-oracle:
|
|
parameters:
|
|
redis-key:
|
|
type: string
|
|
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
|
|
while [[ $(redis-cli GET << parameters.redis-key >> ) ]]; do
|
|
((i++))
|
|
if [ "$i" -gt 30 ]
|
|
then
|
|
exit -1
|
|
fi
|
|
|
|
echo "Sleeping..."
|
|
sleep 3
|
|
done
|
|
init-repo:
|
|
steps:
|
|
- checkout
|
|
- run: git submodule update --init
|
|
executors:
|
|
docker-node:
|
|
docker:
|
|
- image: circleci/node:10.15
|
|
machine-with-dlc:
|
|
machine:
|
|
image: ubuntu-1604:202007-01
|
|
docker_layer_caching: true
|
|
classic-machine-without-dlc:
|
|
machine:
|
|
image: circleci/classic:latest
|
|
machine-without-dlc:
|
|
machine:
|
|
image: ubuntu-1604:202007-01
|
|
|
|
jobs:
|
|
initialize:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- 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
|
|
initialize-root:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- checkout
|
|
- run: sudo su - -c 'export CI=true && cd /home/circleci/project && yarn initialize && yarn test'
|
|
build:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- run: yarn run build
|
|
lint:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- run: yarn run lint
|
|
test:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- 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:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run: ./oracle-e2e/run-tests.sh
|
|
ui-e2e:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/install-node
|
|
- tokenbridge-orb/install-yarn
|
|
- tokenbridge-orb/install-chrome
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- run: yarn run ui-e2e
|
|
monitor-e2e:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run: ./monitor-e2e/run-tests.sh
|
|
cover:
|
|
executor: tokenbridge-orb/docker-node
|
|
steps:
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- run: yarn workspace ui run coverage
|
|
- run: yarn workspace ui run coveralls
|
|
deployment-oracle:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run:
|
|
name: Run the scenario
|
|
command: deployment-e2e/molecule.sh oracle
|
|
no_output_timeout: 40m
|
|
deployment-ui:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run:
|
|
name: Run the scenario
|
|
command: deployment-e2e/molecule.sh ui
|
|
no_output_timeout: 40m
|
|
deployment-monitor:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run:
|
|
name: Run the scenario
|
|
command: deployment-e2e/molecule.sh monitor
|
|
no_output_timeout: 40m
|
|
deployment-repo:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run:
|
|
name: Run the scenario
|
|
command: deployment-e2e/molecule.sh repo
|
|
no_output_timeout: 40m
|
|
deployment-multiple:
|
|
executor: tokenbridge-orb/machine-without-dlc
|
|
steps:
|
|
- tokenbridge-orb/init-repo
|
|
- run:
|
|
name: Run the scenario
|
|
command: deployment-e2e/molecule.sh multiple
|
|
no_output_timeout: 40m
|
|
ultimate:
|
|
executor: tokenbridge-orb/classic-machine-without-dlc
|
|
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"
|
|
default: ''
|
|
type: string
|
|
oracle-e2e-script:
|
|
description: "Yarn script string used to run oracle-e2e tests specific to given type of bridge"
|
|
default: ''
|
|
type: string
|
|
steps:
|
|
- tokenbridge-orb/install-node
|
|
- tokenbridge-orb/install-chrome
|
|
- tokenbridge-orb/install-yarn
|
|
- restore_cache:
|
|
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
|
|
- run:
|
|
name: Prepare the infrastructure
|
|
command: e2e-commons/up.sh deploy << parameters.scenario-name >> blocks
|
|
no_output_timeout: 50m
|
|
- tokenbridge-orb/wait-for-oracle:
|
|
redis-key: << parameters.redis-key >>
|
|
- when:
|
|
condition: << parameters.ui-e2e-grep >>
|
|
steps:
|
|
- run:
|
|
name: Run the ui-e2e tests
|
|
command: |
|
|
nvm use default;
|
|
cd ui-e2e; yarn mocha -g "<< parameters.ui-e2e-grep >>" -b ./test.js
|
|
- when:
|
|
condition: << parameters.oracle-e2e-script >>
|
|
steps:
|
|
- run:
|
|
name: Run the oracle-e2e tests
|
|
command: cd e2e-commons && docker-compose run e2e yarn workspace oracle-e2e run << parameters.oracle-e2e-script >>
|
|
workflows:
|
|
tokenbridge:
|
|
jobs:
|
|
- initialize
|
|
- initialize-root:
|
|
filters:
|
|
branches:
|
|
only: master
|
|
- build:
|
|
requires:
|
|
- initialize
|
|
- lint:
|
|
requires:
|
|
- initialize
|
|
- test:
|
|
requires:
|
|
- initialize
|
|
- cover:
|
|
requires:
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only: master
|
|
- build-e2e-images
|
|
- oracle-e2e:
|
|
requires:
|
|
- build-e2e-images
|
|
- ui-e2e:
|
|
requires:
|
|
- build-e2e-images
|
|
- 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:
|
|
requires:
|
|
- build-e2e-images
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
name: "ultimate: native to erc"
|
|
scenario-name: native-to-erc
|
|
redis-key: native-erc-collected-signatures:lastProcessedBlock
|
|
ui-e2e-grep: "NATIVE TO ERC"
|
|
- ultimate:
|
|
requires:
|
|
- build-e2e-images
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
name: "ultimate: erc to native"
|
|
scenario-name: erc-to-native
|
|
redis-key: erc-native-collected-signatures:lastProcessedBlock
|
|
ui-e2e-grep: "ERC TO NATIVE"
|
|
- ultimate:
|
|
requires:
|
|
- build-e2e-images
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
name: "ultimate: erc to erc"
|
|
scenario-name: erc-to-erc
|
|
redis-key: erc-erc-collected-signatures:lastProcessedBlock
|
|
ui-e2e-grep: "ERC TO ERC"
|
|
- ultimate:
|
|
requires:
|
|
- build-e2e-images
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
name: "ultimate: amb"
|
|
scenario-name: amb
|
|
redis-key: amb-collected-signatures:lastProcessedBlock
|
|
oracle-e2e-script: "amb"
|
|
- ultimate:
|
|
requires:
|
|
- build-e2e-images
|
|
- initialize
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- develop
|
|
name: "ultimate: amb stake erc to erc"
|
|
scenario-name: ultimate-amb-stake-erc-to-erc
|
|
redis-key: amb-collected-signatures:lastProcessedBlock
|
|
ui-e2e-grep: "AMB-STAKE-ERC-TO-ERC"
|