CI performance impovements (#82)

* Moved selenium to ui-e2e dev dependencies

* Cosmetics

* Removed compiling contracts from build and from test

* Introduced initialize job; Moved cover job to the main workflow

* Build, lint, test and cover jobs using initialize cache

* Yarn install not needed for oracle-e2e. Enable docker caching. Frozen lockfile

* Use docker layer caching and yarn cache for ui-e2e

* Trying to save npm install log as artifact

* More caching.
This commit is contained in:
Przemyslaw Rzad 2019-06-04 09:09:18 +02:00 committed by GitHub
parent 563fbe5773
commit 1013f69a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 31 deletions

@ -1,21 +1,53 @@
version: 2
jobs:
build:
initialize:
docker:
- image: circleci/node:10.15
steps:
- checkout
- run: git submodule update --init
- run: yarn
- 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
build:
docker:
- image: circleci/node:10.15
steps:
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run build
lint:
docker:
- image: circleci/node:10.15
steps:
- checkout
- run: git submodule update --init
- run: yarn
- run: yarn compile:contracts
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run lint
ansible-lint:
docker:
@ -30,10 +62,8 @@ jobs:
HOME_RPC_URL: http://example.com
FOREIGN_RPC_URL: http://example.com
steps:
- checkout
- run: git submodule update --init
- run: yarn
- run: yarn compile:contracts
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run test
oracle-e2e:
docker:
@ -41,12 +71,13 @@ jobs:
steps:
- checkout
- run: git submodule update --init
- run: yarn
- setup_remote_docker
- setup_remote_docker:
docker_layer_caching: true
- run: yarn run oracle-e2e
ui-e2e:
machine:
image: circleci/classic:latest
docker_layer_caching: true
steps:
- checkout
- run: |
@ -59,30 +90,45 @@ jobs:
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- run: sudo dpkg -i google-chrome-stable_current_amd64.deb
- run: git submodule update --init
- run: yarn
- restore_cache:
name: Restore Machine Yarn Package Cache
keys:
- yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- save_cache:
name: Save Machine Yarn Package Cache
key: yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run: yarn run ui-e2e
cover:
docker:
- image: circleci/node:10.15
steps:
- checkout
- run: git submodule update --init
- run: yarn
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn workspace ui run coverage
- run: yarn workspace ui run coveralls
workflows:
version: 2
coverage:
tokenbridge:
jobs:
- initialize
- build:
requires:
- initialize
- lint:
requires:
- initialize
- test:
requires:
- initialize
- cover:
requires:
- initialize
filters:
branches:
only: master
tokenbridge:
jobs:
- build
- lint
- ansible-lint
- test
- oracle-e2e
- ui-e2e

@ -31,9 +31,9 @@
"contracts"
],
"scripts": {
"build": "yarn run compile:contracts && yarn workspace ui run build",
"build": "yarn workspace ui run build",
"lint": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude poa-parity-bridge-contracts lint",
"test": "yarn run compile:contracts && yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test",
"test": "yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test",
"ansible-lint": "./deployment/lint.sh",
"oracle-e2e": "./oracle-e2e/run-tests.sh",
"ui-e2e": "./ui-e2e/run-tests.sh",

@ -3,7 +3,9 @@
"version": "0.0.1",
"license": "MIT",
"private": true,
"devDependencies": {},
"devDependencies": {
"selenium-webdriver": "3.6.0"
},
"scripts": {
"deploy": "node ./scripts/deploy.js"
}

@ -23,11 +23,7 @@ docker-compose run -d -p 3002:3000 ui-erc20-native yarn workspace ui run start
yarn mocha -b ./test.js
rc=$?
if [ $CI ]
then
exit $rc
fi
if [ $CI ]; then exit $rc; fi
ps | grep node | grep -v grep | awk '{print "kill " $1}' | sh
docker-compose down

@ -23,7 +23,6 @@
"react-router-dom": "^4.2.2",
"react-scripts": "3.0.1",
"react-transition-group": "^2.2.1",
"selenium-webdriver": "^3.6.0",
"sweetalert": "^2.1.0",
"web3": "1.0.0-beta.30",
"web3-utils": "1.0.0-beta.30"