diff --git a/.circleci/config.yml b/.circleci/config.yml index 0caa7cf6..ba8b065d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/package.json b/package.json index 615beb49..f01d502e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/ui-e2e/package.json b/ui-e2e/package.json index 12fedfdc..b49b95ba 100644 --- a/ui-e2e/package.json +++ b/ui-e2e/package.json @@ -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" } diff --git a/ui-e2e/run-tests.sh b/ui-e2e/run-tests.sh index a93a810d..fb470b50 100755 --- a/ui-e2e/run-tests.sh +++ b/ui-e2e/run-tests.sh @@ -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 diff --git a/ui/package.json b/ui/package.json index 5611a68e..d6eef51d 100644 --- a/ui/package.json +++ b/ui/package.json @@ -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"