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 version: 2
jobs: jobs:
build: initialize:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
steps: steps:
- checkout - checkout
- run: git submodule update --init - 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 - run: yarn run build
lint: lint:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
steps: steps:
- checkout - restore_cache:
- run: git submodule update --init key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn
- run: yarn compile:contracts
- run: yarn run lint - run: yarn run lint
ansible-lint: ansible-lint:
docker: docker:
@ -30,10 +62,8 @@ jobs:
HOME_RPC_URL: http://example.com HOME_RPC_URL: http://example.com
FOREIGN_RPC_URL: http://example.com FOREIGN_RPC_URL: http://example.com
steps: steps:
- checkout - restore_cache:
- run: git submodule update --init key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn
- run: yarn compile:contracts
- run: yarn run test - run: yarn run test
oracle-e2e: oracle-e2e:
docker: docker:
@ -41,12 +71,13 @@ jobs:
steps: steps:
- checkout - checkout
- run: git submodule update --init - run: git submodule update --init
- run: yarn - setup_remote_docker:
- setup_remote_docker docker_layer_caching: true
- run: yarn run oracle-e2e - run: yarn run oracle-e2e
ui-e2e: ui-e2e:
machine: machine:
image: circleci/classic:latest image: circleci/classic:latest
docker_layer_caching: true
steps: steps:
- checkout - checkout
- run: | - run: |
@ -59,30 +90,45 @@ jobs:
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - 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: sudo dpkg -i google-chrome-stable_current_amd64.deb
- run: git submodule update --init - 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 - run: yarn run ui-e2e
cover: cover:
docker: docker:
- image: circleci/node:10.15 - image: circleci/node:10.15
steps: steps:
- checkout - restore_cache:
- run: git submodule update --init key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn
- run: yarn workspace ui run coverage - run: yarn workspace ui run coverage
- run: yarn workspace ui run coveralls - run: yarn workspace ui run coveralls
workflows: workflows:
version: 2 version: 2
coverage: tokenbridge:
jobs: jobs:
- initialize
- build:
requires:
- initialize
- lint:
requires:
- initialize
- test:
requires:
- initialize
- cover: - cover:
requires:
- initialize
filters: filters:
branches: branches:
only: master only: master
tokenbridge:
jobs:
- build
- lint
- ansible-lint - ansible-lint
- test
- oracle-e2e - oracle-e2e
- ui-e2e - ui-e2e

@ -31,9 +31,9 @@
"contracts" "contracts"
], ],
"scripts": { "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", "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", "ansible-lint": "./deployment/lint.sh",
"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",

@ -3,7 +3,9 @@
"version": "0.0.1", "version": "0.0.1",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"devDependencies": {}, "devDependencies": {
"selenium-webdriver": "3.6.0"
},
"scripts": { "scripts": {
"deploy": "node ./scripts/deploy.js" "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 yarn mocha -b ./test.js
rc=$? rc=$?
if [ $CI ]; then exit $rc; fi
if [ $CI ]
then
exit $rc
fi
ps | grep node | grep -v grep | awk '{print "kill " $1}' | sh ps | grep node | grep -v grep | awk '{print "kill " $1}' | sh
docker-compose down docker-compose down

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