Skip to content

Commit

Permalink
test(ci): trying to work around travis jobs problems in semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Dec 3, 2015
1 parent b473793 commit 8e9dfdf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ notifications:
email: false
node_js:
- '5'
- '4'
- '4.2.2'
- '0.12'
before_install:
- npm i -g npm@^2.0.0
- npm install -g grunt-cli
before_script:
- npm prune
after_success:
- 'curl -Lo travis_after_all.py https://git.io/travis_after_all'
- python travis_after_all.py
- 'export $(cat .to_export_back) &> /dev/null'
- npm run semantic-release
- npm run coveralls
branches:
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
],
"license": "MIT",
"main": "check-more-types.js",
"release": {
"verifyConditions": {
"path": "./test/publish-from-specific-node",
"node": "4.2.2"
}
},
"repository": {
"type": "git",
"url": "https://github.com/kensho/check-more-types.git"
Expand Down
35 changes: 35 additions & 0 deletions test/publish-from-specific-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function validTravis(pluginConfig, config) {
var env = config.env;
var options = config.options;
return env.TRAVIS === 'true' &&
!env.TRAVIS_TAG &&
options.branch === env.TRAVIS_BRANCH;
}

function publishFromSpecificNode(options, config, callback) {
console.log('plugin options', options);

function fail(message) {
return callback(new Error(message));
}

if (typeof options.node !== 'string') {
return fail('Missing node version in the config');
}

if (process.versions.node !== options.node) {
return fail('Only allowed to publish from Node ' +
options.node + ' not from ' + process.versions.node);
}

// check Travis environment for now
// maybe it will be not necessary in the future
// https://github.com/semantic-release/semantic-release/issues/141
if (!validTravis(options, config)) {
return fail('Travis is invalid');
}

callback(new Error('nope'), null);
}

module.exports = publishFromSpecificNode;

0 comments on commit 8e9dfdf

Please sign in to comment.