From d8547c1941c913d7c9886ae4c58d66dbfd61714c Mon Sep 17 00:00:00 2001 From: Alexander Soong Date: Sat, 14 Jul 2018 15:22:10 -0700 Subject: [PATCH 1/2] Update truffle.js, reduce runs --- truffle.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/truffle.js b/truffle.js index 85d50a805..02572c423 100644 --- a/truffle.js +++ b/truffle.js @@ -9,8 +9,7 @@ console.log("mnemonic", mnemonic); module.exports = { solc: { optimizer: { - enabled: true, - runs: 10000 + enabled: true } }, networks: { From 48ab2b3c05511f1b9fdbbb6fdb7396592a81285e Mon Sep 17 00:00:00 2001 From: Alexander Soong Date: Sat, 14 Jul 2018 15:47:48 -0700 Subject: [PATCH 2/2] Update circle config --- .circleci/config.yml | 74 +++++++++++++++++++++++++++++++++++++++----- package.json | 5 +-- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 244f4e80e..6132e8b04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,75 @@ version: 2 jobs: - build: + checkout_and_compile: docker: - image: circleci/node:9.6.1 + working_directory: ~/set-protocol-contracts steps: - - checkout - - run: yarn - - run: - name: testrpc + - checkout + - restore_cache: + key: module-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + - run: + name: Fetch Dependencies + command: yarn install + - run: + name: Transpile Contracts + command: yarn prepare-test + - save_cache: + key: module-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + paths: + - node_modules + - save_cache: + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/set-protocol-contracts + test: + docker: + - image: circleci/node:9.6.1 + working_directory: ~/set-protocol-contracts + parallelism: 2 + steps: + - restore_cache: + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} + - run: + name: Test RPC command: yarn chain background: true - - run: yarn test - - run: npm run coverage && cat coverage/lcov.info | ./node_modules/.bin/coveralls + - run: + name: Truffle Test + command: | + mkdir /tmp/test-results + TEST_FILES="$(circleci tests glob "./transpiled/**/*.spec.js" | circleci tests split --split-by=timings)" + yarn test-continuous ${TEST_FILES} + - store_test_results: + path: /tmp/test-results + - store_artifacts: + path: /tmp/test-results + + coverage: + docker: + - image: circleci/node:9.6.1 + working_directory: ~/set-protocol-contracts + steps: + - restore_cache: + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} + - run: + name: Test RPC + command: yarn chain + background: true + - run: + name: Coverage + command: npm run coverage && cat coverage/lcov.info | ./node_modules/.bin/coveralls + +workflows: + version: 2 + build-and-test: + jobs: + - checkout_and_compile + - test: + requires: + - checkout_and_compile + - coverage: + requires: + - checkout_and_compile + diff --git a/package.json b/package.json index 5fa3361c2..4e7bd8429 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "clean": "rm -rf build; rm -rf transpiled; rm -rf types/generated", "compile": "truffle compile", "prepare-test": "yarn clean && truffle compile --all && yarn run generate-typings && yarn run transpile", - "test": "yarn prepare-test && truffle test `find ./transpiled/test -name '*.spec.js'`", + "test": "yarn prepare-test && truffle test `find transpiled/test -name '*.spec.js'`", + "test-continuous": "truffle test", "transpile": "tsc", "generate-typings": "abi-gen --abis './build/contracts/*.json' --out './types/generated' --template './types/contract_templates/contract.mustache' --partials './types/contract_templates/partials/*.mustache' && yarn run rename-generated-abi", "rename-generated-abi": "mv types/generated/detailed_e_r_c20.ts types/generated/detailed_erc20.ts && mv types/generated/e_r_c20_basic.ts types/generated/erc20_basic.ts", @@ -34,7 +35,7 @@ "chain": "yarn clean-chain && ganache-cli --db blockchain --networkId 50 --accounts 20 -l 10000000 -e 1000000 -m 'concert load couple harbor equip island argue ramp clarify fence smart topic'", "coverage-setup": "cp -r transpiled/test/* test/. && cp -r transpiled/types/* types/.", "coverage-cleanup": "find test -name \\*.js* -type f -delete && find types -name \\*.js* -type f -delete", - "coverage": "yarn prepare-test && yarn coverage-setup && ./node_modules/.bin/solidity-coverage && yarn coverage-cleanup" + "coverage": "yarn coverage-setup && ./node_modules/.bin/solidity-coverage && yarn coverage-cleanup" }, "repository": "git@github.com:SetProtocol/set-protocol-contracts.git", "author": "Felix Feng ",