From 28dae39ddd7034bbdd4f27a34962deacc01b990e Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Fri, 12 May 2017 19:48:03 -0400 Subject: [PATCH 1/4] Use stages instead of travis-after-all Also, parallelize tap tests --- .travis.yml | 49 +++++++++++++++++++++++++------------------------ package.json | 3 ++- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29c45a807..0e68449f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/package.json b/package.json index d51b27e2e..fe7347371 100644 --- a/package.json +++ b/package.json @@ -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" } From 3431fb39c8461e5bffc23b67f9a1c3278b65d6df Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sat, 13 May 2017 20:25:34 -0400 Subject: [PATCH 2/4] Don't run prepublish on install --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fe7347371..d20b86728 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,7 @@ "coverage": "./node_modules/.bin/tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov", "deploy": "touch playground/.nojekyll && ./node_modules/.bin/gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"", "lint": "./node_modules/.bin/eslint .", - "prepublish": "npm run build", - "prepublish-watch": "npm run watch", + "prepublish": "in-publish && npm run build || not-in-publish", "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", @@ -40,6 +39,7 @@ "highlightjs": "^9.8.0", "htmlparser2": "3.9.2", "immutable": "3.8.1", + "in-publish": "^2.0.0", "json": "^9.0.4", "lodash.defaultsdeep": "4.6.0", "minilog": "3.1.0", From 3f53c3fd5c7d3a93146d9cecfcaa7661c4735e40 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sun, 14 May 2017 15:48:21 -0400 Subject: [PATCH 3/4] Allow condition alone to control release --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0e68449f0..e4be6aad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ jobs: deploy: - provider: script on: + all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH skip_cleanup: true script: @@ -32,5 +33,6 @@ jobs: - npm run --silent deploy -- -x -r $GH_PAGES_REPO - provider: npm on: + all_branches: true condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH api_key: $NPM_TOKEN From e173a0ae2cc59884831b9a19c8241ef6ea1c9720 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Sun, 14 May 2017 15:56:06 -0400 Subject: [PATCH 4/4] Fix NPM_SCRIPT vars --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e4be6aad9..fab21efd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ node_js: - 6 - node env: - - NPM_SCRIPT=tap:unit -- --jobs=4 - - NPM_SCRIPT=tap:integration -- --jobs=4 + - NPM_SCRIPT="tap:unit -- --jobs=4" + - NPM_SCRIPT="tap:integration -- --jobs=4" sudo: false cache: directories: