Skip to content

Commit

Permalink
Merge pull request #470 from PolymathNetwork/circle-ci
Browse files Browse the repository at this point in the history
Adding Circle CI to dev-2.2.0
  • Loading branch information
pabloruiz55 authored Dec 14, 2018
2 parents 1f5f42b + 115f3b1 commit 68a43bb
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 42 deletions.
100 changes: 100 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
version: 2
jobs:
build:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- run: sudo npm i truffle -g
- run: node --version
- run: truffle version
- run: truffle compile
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
test:
docker:
- image: circleci/node:8
parallelism: 2
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- run: sudo npm i truffle -g
- run: node --version
- run: truffle version
- run: npm run test
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- store_test_results:
path: test-results
- store_artifacts:
path: ./test-results/mocha/results.xml
coverage:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- run: sudo npm i truffle -g
- run: node --version
- run: truffle version
- run:
command: npm run coverage
no_output_timeout: 1h
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- store_artifacts:
path: ./coverage/lcov.info
docs:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: yarn install
- run: sudo npm i truffle -g
- run: node --version
- run: truffle version
- run: npm run docs
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
workflows:
version: 2
commit:
jobs:
- coverage
daily-builds:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
- dev-2.1.0
- dev-2.2.0
- dev-3.0.0
jobs:
- coverage
docs:
jobs:
- docs:
filters:
branches:
only:
- master
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ bridge.log
allFiredEvents
extract/
extract.py
extract.zip
extract.zip
/test-results
15 changes: 1 addition & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@ node_js:
cache:
directories:
- node_modules
matrix:
fast_finish: true
allow_failures:
- env: 'TASK=docs'
jobs:
include:
- stage: Tests and Coverage
after_install: wget -O node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
- stage: test
before_script: truffle version
script: npm run test
- stage: Docs
env: 'TASK=docs'
before_install:
- echo -ne '\n' | sudo apt-add-repository -y ppa:hvr/z3
- sudo apt-get -y update
- sudo apt-get -y install libz3-dev
before_script: wget -O node_modules/solidity-docgen/lib/index.js https://raw.githubusercontent.com/maxsam4/solidity-docgen/buffer-size/lib/index.js
script: npm run docs
notifications:
slack:
secure: W4FZSabLrzF74f317hutolEHnlq2GBlQxU6b85L5XymrjgLEhlgE16c5Qz7Emoyt6le6PXL+sfG2ujJc3XYys/6hppgrHSAasuJnKCdQNpmMZ9BNyMs6WGkmB3enIf3K/FLXb26AQdwpQdIXuOeJUTf879u+YoiZV0eZH8d3+fsIOyovq9N6X5pKOpDM9iT8gGB4t7fie7xf51s+iUaHxyO9G7jDginZ4rBXHcU7mxCub9z+Z1H8+kCTnPWaF+KKVEXx4Z0nI3+urboD7E4OIP02LwrThQls2CppA3X0EoesTcdvj/HLErY/JvsXIFiFEEHZzB1Wi+k2TiOeLcYwEuHIVij+HPxxlJNX/j8uy01Uk8s4rd+0EhvfdKHJqUKqxH4YN2npcKfHEss7bU3y7dUinXQfYShW5ZewHdvc7pnnxBTfhvmdi64HdNrXAPq+s1rhciH7MmnU+tsm4lhrpr+FBuHzUMA9fOCr7b0SQytZEgWpiUls88gdbh3yG8TjyZxmZJGx09cwEP0q7VoH0UwFh7mIu5XmYdd5tWUhavTiO7YV8cUPn7MvwMsTltB3YBpF/fB26L7ka8zBhCsjm9prW6SVYU/dyO3m91VeZtO/zJFHRDA6Q58JGVW2rgzO39z193qC1EGRXqTie96VwAAtNg8+hRb+bI/CWDVzSPc=
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ethereum-bridge": "^0.6.1",
"ethereumjs-abi": "^0.6.5",
"ganache-cli": "^6.1.8",
"mocha-junit-reporter": "^1.18.0",
"prettier": "^1.14.3",
"sol-merger": "^0.1.2",
"solidity-coverage": "^0.5.11",
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

rm -rf flat

TRAVIS_PULL_REQUEST=true scripts/test.sh
COVERAGE=true scripts/test.sh
35 changes: 19 additions & 16 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ cleanup() {
fi
}

if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
testrpc_port=8545
else
testrpc_port=8545
fi
testrpc_port=8545

testrpc_running() {
nc -z localhost "$testrpc_port"
Expand Down Expand Up @@ -60,20 +56,19 @@ start_testrpc() {
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,1000000000000000000000000"
)

if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
if [ "$COVERAGE" = true ]; then
node_modules/.bin/testrpc-sc --gasLimit 0xfffffffffff --port "$testrpc_port" "${accounts[@]}" > /dev/null &
else
node_modules/.bin/ganache-cli --gasLimit 8000000 "${accounts[@]}" > /dev/null &
fi


testrpc_pid=$!
}

if testrpc_running; then
echo "Using existing testrpc instance"
# Do not start ethereum bridge unless it is a cron job from travis
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
# Do not start ethereum bridge unless it is a cron job
if [ "$CIRCLE_CI_CRON" = true ]; then
bridge_running
if bridge_running; then
echo "Using existing ethereum-bridge instance"
Expand All @@ -85,24 +80,32 @@ if testrpc_running; then
else
echo "Starting our own testrpc instance"
start_testrpc
# Do not start ethereum bridge unless it is a cron job from travis
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
# Do not start ethereum bridge unless it is a cron job
if [ "$CIRCLE_CI_CRON" = true ]; then
echo "Starting our own ethereum-bridge instance"
sleep 10
start_bridge
fi
fi

if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
if [ "$COVERAGE" = true ]; then
curl -o node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
node_modules/.bin/solidity-coverage
if [ "$CONTINUOUS_INTEGRATION" = true ]; then
if [ "$CIRCLECI" = true ]; then
cat coverage/lcov.info | node_modules/.bin/coveralls
fi
else
# Do not run a_poly_oracle,js tests unless it is a cron job from travis
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
node_modules/.bin/truffle test `ls test/*.js`
if [ "$CIRCLECI" = true ]; then # using mocha junit reporter for parallelism in CircleCI
mkdir test-results
mkdir test-results/mocha
rm truffle-config.js
mv truffle-ci.js truffle-config.js
# only run poly oracle and upgrade tests if cron job by CI
if [ "$CIRCLE_CI_CRON" = true ]; then
node_modules/.bin/truffle test `ls test/*.js | circleci tests split --split-by=timings`
else
node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js | circleci tests split --split-by=timings`
fi
else
node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js`
fi
Expand Down
33 changes: 33 additions & 0 deletions truffle-ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require('babel-register');
require('babel-polyfill');

module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // Match any network id
gas: 7900000,
},
coverage: {
host: "localhost",
network_id: "*",
port: 8545, // <-- If you change this, also set the port option in .solcover.js.
gas: 0xfffffffffff, // <-- Use this high gas value
gasPrice: 0x01 // <-- Use this low gas price
}
},
solc: {
optimizer: {
enabled: true,
runs: 200,
},
},
mocha: {
enableTimeouts: false,
reporter: "mocha-junit-reporter",
reporterOptions: {
mochaFile: './test-results/mocha/results.xml'
}
}
};
47 changes: 37 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,11 @@ chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"

charenc@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=

checkpoint-store@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06"
Expand Down Expand Up @@ -1694,14 +1699,11 @@ cron-parser@^2.4.0:
is-nan "^1.2.1"
moment-timezone "^0.5.0"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
dependencies:
lru-cache "^4.0.1"
shebang-command "^1.2.0"
which "^1.2.9"

crypt@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=

cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
Expand Down Expand Up @@ -3557,7 +3559,7 @@ is-binary-path@^1.0.0:
dependencies:
binary-extensions "^1.0.0"

is-buffer@^1.1.5:
is-buffer@^1.1.5, is-buffer@~1.1.1:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"

Expand Down Expand Up @@ -4219,6 +4221,15 @@ md5.js@^1.3.4:
inherits "^2.0.1"
safe-buffer "^5.1.2"

md5@^2.1.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9"
integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=
dependencies:
charenc "~0.0.1"
crypt "~0.0.1"
is-buffer "~1.1.1"

media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
Expand Down Expand Up @@ -4418,12 +4429,23 @@ mkdirp-promise@^5.0.1:
dependencies:
mkdirp "*"

mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"

mocha-junit-reporter@^1.18.0:
version "1.18.0"
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.18.0.tgz#9209a3fba30025ae3ae5e6bfe7f9c5bc3c2e8ee2"
integrity sha512-y3XuqKa2+HRYtg0wYyhW/XsLm2Ps+pqf9HaTAt7+MVUAKFJaNAHOrNseTZo9KCxjfIbxUWwckP5qCDDPUmjSWA==
dependencies:
debug "^2.2.0"
md5 "^2.1.0"
mkdirp "~0.5.1"
strip-ansi "^4.0.0"
xml "^1.0.0"

mocha@^4.0.1, mocha@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.1.0.tgz#7d86cfbcf35cb829e2754c32e17355ec05338794"
Expand Down Expand Up @@ -7192,6 +7214,11 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3:
parse-headers "^2.0.0"
xtend "^4.0.0"

xml@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=

xmlhttprequest@*, xmlhttprequest@1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"
Expand Down

0 comments on commit 68a43bb

Please sign in to comment.