Use stages instead of travis-after-all

Also, parallelize tap tests
This commit is contained in:
Ray Schamp 2017-05-12 19:48:03 -04:00
parent b0fb4f0b55
commit 28dae39ddd
2 changed files with 27 additions and 25 deletions

View file

@ -2,6 +2,9 @@ language: node_js
node_js:
- 6
- node
env:
- NPM_SCRIPT=tap:unit -- --jobs=4
- NPM_SCRIPT=tap:integration -- --jobs=4
sudo: false
cache:
directories:
@ -9,27 +12,25 @@ cache:
install:
- npm install
- npm update
after_script:
- |
# RELEASE_BRANCHES and NPM_TOKEN defined in Travis settings panel
declare exitCode
$(npm bin)/travis-after-all
exitCode=$?
if [[
# Execute after all jobs finish successfully
$exitCode = 0 &&
# Only release on release branches
$RELEASE_BRANCHES =~ $TRAVIS_BRANCH &&
# Don't release on PR builds
$TRAVIS_PULL_REQUEST = "false"
]]; then
# Authenticate NPM
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
# Set version to timestamp
npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s)
npm publish
# Publish to gh-pages as most recent committer
git config --global user.email $(git log --pretty=format:"%ae" -n1)
git config --global user.name $(git log --pretty=format:"%an" -n1)
npm run --silent deploy -- -x -r $GH_PAGES_REPO
fi
script: npm run $NPM_SCRIPT
jobs:
include:
- env: NPM_SCRIPT=lint
node_js: 6
- stage: release
node_js: 6
script: true
before_deploy: npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s)
deploy:
- provider: script
on:
condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH
skip_cleanup: true
script:
- git config --global user.email $(git log --pretty=format:"%ae" -n1)
- git config --global user.name $(git log --pretty=format:"%an" -n1)
- npm run --silent deploy -- -x -r $GH_PAGES_REPO
- provider: npm
on:
condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH
api_key: $NPM_TOKEN

View file

@ -19,6 +19,8 @@
"prepublish-watch": "npm run watch",
"start": "./node_modules/.bin/webpack-dev-server",
"tap": "./node_modules/.bin/tap ./test/{unit,integration}/*.js",
"tap:unit": "./node_modules/.bin/tap ./test/unit/*.js",
"tap:integration": "./node_modules/.bin/tap ./test/integration/*.js",
"test": "npm run lint && npm run tap",
"watch": "./node_modules/.bin/webpack --progress --colors --watch",
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\""
@ -50,7 +52,6 @@
"socket.io-client": "1.7.3",
"stats.js": "^0.17.0",
"tap": "^10.2.0",
"travis-after-all": "^1.4.4",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.1"
}