mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-12 08:53:10 +00:00
chore(travis): speed up the build
- parallelize the tasks - cache requests (e2e tests) This reduces the time from ~18min to ~12min. It makes the output little messy. We could buffer output of each task and display it once it's fully finished, nicely. I think giving instant feedback is better.
This commit is contained in:
parent
6e1b64176f
commit
2c2adbcab5
5 changed files with 61 additions and 6 deletions
|
|
@ -13,8 +13,7 @@ before_script:
|
||||||
- ./lib/sauce/sauce_connect_setup.sh
|
- ./lib/sauce/sauce_connect_setup.sh
|
||||||
- npm install -g grunt-cli
|
- npm install -g grunt-cli
|
||||||
- grunt package
|
- grunt package
|
||||||
- grunt webserver > /dev/null &
|
|
||||||
- ./lib/sauce/sauce_connect_block.sh
|
- ./lib/sauce/sauce_connect_block.sh
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- grunt test --reporters dots --browsers SL_Chrome
|
- grunt parallel:travis --reporters dots --browsers SL_Chrome
|
||||||
|
|
|
||||||
35
Gruntfile.js
35
Gruntfile.js
|
|
@ -9,6 +9,7 @@ module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-contrib-compress');
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
||||||
grunt.loadNpmTasks('grunt-contrib-jasmine-node');
|
grunt.loadNpmTasks('grunt-contrib-jasmine-node');
|
||||||
grunt.loadNpmTasks('grunt-shell');
|
grunt.loadNpmTasks('grunt-shell');
|
||||||
|
grunt.loadNpmTasks('grunt-parallel');
|
||||||
grunt.loadTasks('lib/grunt');
|
grunt.loadTasks('lib/grunt');
|
||||||
|
|
||||||
var NG_VERSION = util.getVersion();
|
var NG_VERSION = util.getVersion();
|
||||||
|
|
@ -23,6 +24,21 @@ module.exports = function(grunt) {
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
NG_VERSION: NG_VERSION,
|
NG_VERSION: NG_VERSION,
|
||||||
|
|
||||||
|
parallel: {
|
||||||
|
travis: {
|
||||||
|
options: {
|
||||||
|
stream: true,
|
||||||
|
},
|
||||||
|
tasks: [
|
||||||
|
util.parallelTask('test:docs'),
|
||||||
|
util.parallelTask('test:modules'),
|
||||||
|
util.parallelTask('test:jquery'),
|
||||||
|
util.parallelTask('test:jqlite'),
|
||||||
|
util.parallelTask('test:e2e')
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
connect: {
|
connect: {
|
||||||
devserver: {
|
devserver: {
|
||||||
options: {
|
options: {
|
||||||
|
|
@ -42,7 +58,24 @@ module.exports = function(grunt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
testserver: {}
|
testserver: {
|
||||||
|
options: {
|
||||||
|
middleware: function(connect, options){
|
||||||
|
return [
|
||||||
|
function(req, resp, next) {
|
||||||
|
// cache get requests to speed up tests on travis
|
||||||
|
if (req.method === 'GET') {
|
||||||
|
resp.setHeader('Cache-control', 'public, max-age=3600');
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
},
|
||||||
|
connect.favicon('images/favicon.ico'),
|
||||||
|
connect.static(options.base)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ module.exports = function(config) {
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
logColors: true,
|
logColors: true,
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
|
runnerPort: 0,
|
||||||
|
|
||||||
// config for Travis CI
|
// config for Travis CI
|
||||||
sauceLabs: {
|
sauceLabs: {
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,13 @@ module.exports = {
|
||||||
var browsers = grunt.option('browsers');
|
var browsers = grunt.option('browsers');
|
||||||
var reporters = grunt.option('reporters');
|
var reporters = grunt.option('reporters');
|
||||||
var noColor = grunt.option('no-colors');
|
var noColor = grunt.option('no-colors');
|
||||||
|
var port = grunt.option('port');
|
||||||
var p = spawn('node', ['node_modules/karma/bin/karma', 'start', config,
|
var p = spawn('node', ['node_modules/karma/bin/karma', 'start', config,
|
||||||
singleRun ? '--single-run=true' : '',
|
singleRun ? '--single-run=true' : '',
|
||||||
reporters ? '--reporters=' + reporters : '',
|
reporters ? '--reporters=' + reporters : '',
|
||||||
browsers ? '--browsers=' + browsers : '',
|
browsers ? '--browsers=' + browsers : '',
|
||||||
noColor ? '--no-colors' : ''
|
noColor ? '--no-colors' : '',
|
||||||
|
port ? '--port=' + port : ''
|
||||||
]);
|
]);
|
||||||
p.stdout.pipe(process.stdout);
|
p.stdout.pipe(process.stdout);
|
||||||
p.stderr.pipe(process.stderr);
|
p.stderr.pipe(process.stderr);
|
||||||
|
|
@ -235,5 +237,24 @@ module.exports = {
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
parallelTask: function(name) {
|
||||||
|
var args = [name, '--port=' + this.lastParallelTaskPort];
|
||||||
|
|
||||||
|
if (grunt.option('browsers')) {
|
||||||
|
args.push('--browsers=' + grunt.option('browsers'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grunt.option('reporters')) {
|
||||||
|
args.push('--reporters=' + grunt.option('reporters'));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastParallelTaskPort++;
|
||||||
|
|
||||||
|
|
||||||
|
return {grunt: true, args: args};
|
||||||
|
},
|
||||||
|
|
||||||
|
lastParallelTaskPort: 9876
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@
|
||||||
"yaml-js": "0.0.5",
|
"yaml-js": "0.0.5",
|
||||||
"showdown": "0.3.1",
|
"showdown": "0.3.1",
|
||||||
"rewire": "1.1.3",
|
"rewire": "1.1.3",
|
||||||
"grunt-contrib-jasmine-node": "~0.1.1"
|
"grunt-contrib-jasmine-node": "~0.1.1",
|
||||||
|
"grunt-parallel": "~0.2.0"
|
||||||
},
|
},
|
||||||
"licenses": [
|
"licenses": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue