Skip to content

Commit 7c5492a

Browse files
committed
add saucelabs ci
1 parent 863c145 commit 7c5492a

File tree

4 files changed

+96
-3
lines changed

4 files changed

+96
-3
lines changed

grunt/sauce.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
var sauceConfig = {
2+
testName: 'Vue.js unit tests',
3+
recordScreenshots: false,
4+
build: process.env.TRAVIS_JOB_ID || Date.now(),
5+
}
6+
7+
/**
8+
* Having too many tests running concurrently on saucelabs
9+
* causes timeouts and errors, so we have to run them in
10+
* smaller batches.
11+
*/
12+
13+
var batches = [
14+
// the cool kids
15+
{
16+
sl_chrome: {
17+
base: 'SauceLabs',
18+
browserName: 'chrome',
19+
platform: 'Windows 7',
20+
version: '37'
21+
},
22+
sl_firefox: {
23+
base: 'SauceLabs',
24+
browserName: 'firefox',
25+
version: '32'
26+
},
27+
sl_mac_safari: {
28+
base: 'SauceLabs',
29+
browserName: "safari",
30+
platform: "OS X 10.9",
31+
version: "7"
32+
}
33+
},
34+
// ie family
35+
{
36+
sl_ie_9: {
37+
base: 'SauceLabs',
38+
browserName: "internet explorer",
39+
platform: "Windows 7",
40+
version: "9"
41+
},
42+
sl_ie_10: {
43+
base: 'SauceLabs',
44+
browserName: "internet explorer",
45+
platform: "Windows 8",
46+
version: "10"
47+
},
48+
sl_ie_11: {
49+
base: 'SauceLabs',
50+
browserName: 'internet explorer',
51+
platform: 'Windows 8.1',
52+
version: '11'
53+
}
54+
},
55+
// mobile
56+
{
57+
sl_ios_safari: {
58+
base: 'SauceLabs',
59+
browserName: 'iphone',
60+
platform: 'OS X 10.9',
61+
version: '7.1'
62+
},
63+
sl_android: {
64+
base: 'SauceLabs',
65+
browserName: 'android',
66+
platform: 'Linux',
67+
version: '4.4'
68+
}
69+
}
70+
]
71+
72+
for (var i = 0; i < 3; i++) {
73+
exports['batch' + (i+1)] = {
74+
sauceLabs: sauceConfig,
75+
captureTimeout: 600000,
76+
customLaunchers: batches[i],
77+
browsers: Object.keys(batches[i]),
78+
reporters: ['progress', 'saucelabs']
79+
}
80+
}

grunt/shared-build.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Shared build function
33
*/
44

5-
var fs = require('fs')
65
var resolve = require('component-resolver')
76
var build = require('component-builder')
87

gruntfile.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
var sauceConfig = require('./grunt/sauce')
2+
13
module.exports = function (grunt) {
24

35
var version = grunt.file.readJSON('package.json').version
@@ -61,7 +63,7 @@ module.exports = function (grunt) {
6163
reporters: ['progress']
6264
}
6365
},
64-
phantom: {
66+
coverage: {
6567
options: {
6668
browsers: ['PhantomJS'],
6769
reporters: ['progress', 'coverage'],
@@ -76,6 +78,15 @@ module.exports = function (grunt) {
7678
]
7779
}
7880
}
81+
},
82+
sauce1: {
83+
options: sauceConfig.batch1
84+
},
85+
sauce2: {
86+
options: sauceConfig.batch2
87+
},
88+
sauce3: {
89+
options: sauceConfig.batch3
7990
}
8091
}
8192

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

94105
grunt.registerTask('unit', ['karma:browsers'])
95-
grunt.registerTask('cover', ['karma:phantom'])
106+
grunt.registerTask('cover', ['karma:coverage'])
96107
grunt.registerTask('test', ['unit', 'cover', 'casper'])
108+
grunt.registerTask('sauce', ['karma:sauce1', 'karma:sauce2', 'karma:sauce3'])
109+
grunt.registerTask('ci', ['jshint', 'test', 'sauce'])
97110
grunt.registerTask('default', ['jshint', 'test', 'build'])
98111

99112
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"karma-firefox-launcher": "^0.1.3",
3636
"karma-jasmine": "^0.2.2",
3737
"karma-phantomjs-launcher": "^0.1.4",
38+
"karma-sauce-launcher": "^0.2.10",
3839
"uglify-js": "^2.4.15"
3940
}
4041
}

0 commit comments

Comments
 (0)