diff --git a/.travis.yml b/.travis.yml index 0fdc5c312..3ed321655 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,24 +4,41 @@ group: beta language: node_js node_js: - "8" + cache: directories: - node_modules -env: - - - - SOLIDITY_COVERAGE=true - - SOLC_NIGHTLY=true -matrix: + +jobs: + # XXX fast_finish doesn't work with stages yet. See + # https://github.com/travis-ci/travis-ci/issues/8425 + # --elopio - 20180531 fast_finish: true allow_failures: - env: SOLIDITY_COVERAGE=true - env: SOLC_NIGHTLY=true -before_script: - - truffle version -script: - - npm run lint - - npm run lint:sol - - npm run test + include: + # Run the unit test suite three times in parallel. + # The first one gets results faster and is the only one required to pass. + # The second one generates the coverage report. + # The third one is to keep us informed about possible issues with the + # upcoming solidity release. + - stage: tests + name: "unit tests" + script: npm run test + - stage: tests + name: "unit tests with coverage" + script: npm run test + env: SOLIDITY_COVERAGE=true + - stage: tests + name: "unit tests with solc nightly" + script: npm run test + env: SOLC_NIGHTLY=true + # solidity and javascript style tests. + - stage: tests + name: "static tests" + script: npm run lint + notifications: slack: rooms: diff --git a/package.json b/package.json index d584942f1..791a0a910 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ ], "scripts": { "test": "scripts/test.sh", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint:js": "eslint .", + "lint:js:fix": "eslint . --fix", "lint:sol": "solium -d .", "lint:sol:fix": "solium -d . --fix", - "lint:all": "npm run lint && npm run lint:sol", - "lint:all:fix": "npm run lint:fix && npm run lint:sol:fix", + "lint": "npm run lint:js && npm run lint:sol", + "lint:fix": "npm run lint:js:fix && npm run lint:sol:fix", "console": "truffle console", "coverage": "scripts/coverage.sh", "version": "scripts/version.js" diff --git a/scripts/test.sh b/scripts/test.sh index 14bad1adc..1d81379f4 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -59,6 +59,8 @@ if [ "$SOLC_NIGHTLY" = true ]; then wget -q https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/soljson-nightly.js -O /tmp/soljson.js && find . -name soljson.js -exec cp /tmp/soljson.js {} \; fi +truffle version + if [ "$SOLIDITY_COVERAGE" = true ]; then node_modules/.bin/solidity-coverage