Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Misc: parallelizing build on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
qfox committed Apr 30, 2016
1 parent e878832 commit be0734f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
33 changes: 25 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
git:
depth: 1

sudo: false

language: node_js
node_js:
- "5"
- "4"
- "0.12"
- "0.10"

script: "npm run $TEST_SUITE"

script: "npm run travis"
env:
- TEST_SUITE=test
- TEST_SUITE=integration TEST_PRESET=airbnb,google,jquery

matrix:
fast_finish: true
include:
- node_js: "0.10"
env: TEST_SUITE=integration TEST_PRESET=./test/scripts/forgotten-rules.json
- node_js: "0.12"
env: TEST_SUITE=integration TEST_PRESET=node-style-guide,wordpress
- node_js: "4"
env: TEST_SUITE=integration TEST_PRESET=crockford,idiomatic
- node_js: "5"
env: TEST_SUITE=integration TEST_PRESET=grunt,mdcs
- node_js: "5"
env: TEST_SUITE=coveralls

cache:
directories:
- node_modules

node_js:
- "0.10"
- "0.12"
- "4"
- "5"
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@
"pretest": "npm run lint",
"test": "mocha --color",
"watch": "mocha --color --watch",
"autofix-tests": "node test/scripts/integration.js",
"integration": "node test/scripts/integration.js",
"coverage": "unit-coverage run -p common",
"coverage-html": "unit-coverage run -p common -r html -o coverage.html",
"coveralls": "unit-coverage run -p common -r lcov -o out.lcov && cat out.lcov | coveralls",
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'",
"release": "node publish/prepublish && npm test && npm publish",
"travis": "npm run test && npm run autofix-tests && npm run coveralls"
"release": "node publish/prepublish && npm test && npm publish"
},
"files": [
"bin",
Expand Down
16 changes: 13 additions & 3 deletions test/scripts/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ var SOURCES = ['lib', 'test/specs'];
var MOCHA = 'node_modules/.bin/mocha';

/**
* Applying every available preset to JSCS sources and tests, then executing tests.
* Applying passed presets to JSCS sources and tests, then executing tests.
* So we can make sure nothing breaks during these reformatting actions.
*/
vowFs.listDir('./presets')
var presets = process.env.TEST_PRESET && vow.resolve(process.env.TEST_PRESET.split(','));

/**
* Or applying every available preset if nothing passed and do the same.
*/
presets = presets || vowFs.listDir('./presets')
.then(function(presetFilenames) {
var presets = presetFilenames.map(function(presetFilename) {
return presetFilename.replace('.json', '');
Expand All @@ -19,7 +24,12 @@ vowFs.listDir('./presets')
// List of rules that are not used in any of the default presets
presets.unshift('./test/scripts/forgotten-rules.json');

console.log('\n' + chalk.green('> ') + 'Autofix integration tests');
return presets;
});

presets
.then(function(presets) {
console.log('\n' + chalk.green('> ') + 'Autofix integration tests: ' + chalk.green(presets.join(', ')));

return promiseQueue(presets, function(presetName) {
console.log('\nPreset "' + chalk.green(presetName) + '"');
Expand Down

0 comments on commit be0734f

Please sign in to comment.