Skip to content

Commit

Permalink
add saucelabs ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 26, 2014
1 parent 863c145 commit 7c5492a
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 3 deletions.
80 changes: 80 additions & 0 deletions grunt/sauce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var sauceConfig = {
testName: 'Vue.js unit tests',
recordScreenshots: false,
build: process.env.TRAVIS_JOB_ID || Date.now(),
}

/**
* Having too many tests running concurrently on saucelabs
* causes timeouts and errors, so we have to run them in
* smaller batches.
*/

var batches = [
// the cool kids
{
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 7',
version: '37'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '32'
},
sl_mac_safari: {
base: 'SauceLabs',
browserName: "safari",
platform: "OS X 10.9",
version: "7"
}
},
// ie family
{
sl_ie_9: {
base: 'SauceLabs',
browserName: "internet explorer",
platform: "Windows 7",
version: "9"
},
sl_ie_10: {
base: 'SauceLabs',
browserName: "internet explorer",
platform: "Windows 8",
version: "10"
},
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
}
},
// mobile
{
sl_ios_safari: {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.9',
version: '7.1'
},
sl_android: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4'
}
}
]

for (var i = 0; i < 3; i++) {
exports['batch' + (i+1)] = {
sauceLabs: sauceConfig,
captureTimeout: 600000,
customLaunchers: batches[i],
browsers: Object.keys(batches[i]),
reporters: ['progress', 'saucelabs']
}
}
1 change: 0 additions & 1 deletion grunt/shared-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Shared build function
*/

var fs = require('fs')
var resolve = require('component-resolver')
var build = require('component-builder')

Expand Down
17 changes: 15 additions & 2 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var sauceConfig = require('./grunt/sauce')

module.exports = function (grunt) {

var version = grunt.file.readJSON('package.json').version
Expand Down Expand Up @@ -61,7 +63,7 @@ module.exports = function (grunt) {
reporters: ['progress']
}
},
phantom: {
coverage: {
options: {
browsers: ['PhantomJS'],
reporters: ['progress', 'coverage'],
Expand All @@ -76,6 +78,15 @@ module.exports = function (grunt) {
]
}
}
},
sauce1: {
options: sauceConfig.batch1
},
sauce2: {
options: sauceConfig.batch2
},
sauce3: {
options: sauceConfig.batch3
}
}

Expand All @@ -92,8 +103,10 @@ module.exports = function (grunt) {
})

grunt.registerTask('unit', ['karma:browsers'])
grunt.registerTask('cover', ['karma:phantom'])
grunt.registerTask('cover', ['karma:coverage'])
grunt.registerTask('test', ['unit', 'cover', 'casper'])
grunt.registerTask('sauce', ['karma:sauce1', 'karma:sauce2', 'karma:sauce3'])
grunt.registerTask('ci', ['jshint', 'test', 'sauce'])
grunt.registerTask('default', ['jshint', 'test', 'build'])

}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.2.2",
"karma-phantomjs-launcher": "^0.1.4",
"karma-sauce-launcher": "^0.2.10",
"uglify-js": "^2.4.15"
}
}

0 comments on commit 7c5492a

Please sign in to comment.