mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Moved sauce connect management to saucelabs.js, for manual control
This commit is contained in:
13
.travis.yml
13
.travis.yml
@@ -5,7 +5,12 @@ node_js:
|
|||||||
- "0.10"
|
- "0.10"
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- BIN="node" BUILD=false MAKE=false OPTION="" SAUCELABS_BROWSER=false
|
- BIN="node" BUILD=false MAKE=false OPTION="" SAUCELABS=false
|
||||||
|
|
||||||
|
# SauceLabs credentials:
|
||||||
|
- SAUCE_USERNAME="pimterry"
|
||||||
|
- secure: "KBETrs7sRrU3V8itVgLzBUVkzP9XXpAEZVjbd8icoNL9eVW3h4Kk5g/bOa06IAml0ThnMZztIwMKkplCIam6W/Cv+eIOiQT2kkG32lHFwbVXEkbq+rKj8XmpRmXBf/Th63V+u5GMVmQlYrIfdXju6cFfSEZ2uG8SHVg9hFyyf8c="
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD="compat"
|
- BUILD="compat"
|
||||||
- BUILD="modern"
|
- BUILD="modern"
|
||||||
@@ -14,7 +19,7 @@ env:
|
|||||||
- BIN="phantomjs" BUILD="compat"
|
- BIN="phantomjs" BUILD="compat"
|
||||||
- BIN="phantomjs" BUILD="legacy"
|
- BIN="phantomjs" BUILD="legacy"
|
||||||
- BIN="phantomjs" BUILD="mobile"
|
- BIN="phantomjs" BUILD="mobile"
|
||||||
- SAUCELABS_BROWSER="['Windows 7', 'firefox', '20']"
|
- SAUCELABS=true
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- node_js: "0.10"
|
- node_js: "0.10"
|
||||||
@@ -48,7 +53,7 @@ before_install:
|
|||||||
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
- "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true"
|
||||||
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
- "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true"
|
||||||
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
- "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true"
|
||||||
- "[ '$SAUCELABS_BROWSER' != false ] && npm install connect request || true"
|
- "[ $SAUCELABS != false ] && npm install connect request sauce-tunnel || true"
|
||||||
script:
|
script:
|
||||||
- "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true"
|
- "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true"
|
||||||
- "[ $BUILD != false ] && [ $BUILD != 'compat' ] && MAKE=true || true"
|
- "[ $BUILD != false ] && [ $BUILD != 'compat' ] && MAKE=true || true"
|
||||||
@@ -58,4 +63,4 @@ script:
|
|||||||
- "[ $BUILD != false ] && cd ./test || true"
|
- "[ $BUILD != false ] && cd ./test || true"
|
||||||
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js"
|
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js"
|
||||||
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js"
|
- "[ $BUILD == false ] && true || $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js"
|
||||||
- "[ '$SAUCELABS_BROWSER' != false ] && node ./saucelabs.js || true"
|
- "[ $SAUCELABS == false ] && true || node ./saucelabs.js"
|
||||||
|
|||||||
77
saucelabs.js
77
saucelabs.js
@@ -1,38 +1,61 @@
|
|||||||
|
var connect = require('connect');
|
||||||
|
var SauceTunnel = require('sauce-tunnel');
|
||||||
|
var request = require('request');
|
||||||
|
|
||||||
var port = 8081;
|
var port = 8081;
|
||||||
|
var username = process.env['SAUCE_USERNAME'];
|
||||||
|
var accessKey = process.env['SAUCE_ACCESS_KEY'];
|
||||||
|
var platforms = [
|
||||||
|
["Windows 7", "chrome", ""],
|
||||||
|
["Windows 7", "firefox", "24"],
|
||||||
|
["Windows 7", "internet explorer", "9"]
|
||||||
|
];
|
||||||
|
|
||||||
// Create a web server for the local dir
|
// Create a web server for the local dir
|
||||||
var connect = require('connect');
|
|
||||||
var server = connect.createServer(
|
var server = connect.createServer(
|
||||||
connect.static(__dirname)
|
connect.static(__dirname)
|
||||||
).listen(port);
|
).listen(port);
|
||||||
|
|
||||||
// Tell saucelabs to run some tests
|
// Set up sauce connect so we can use this server from saucelabs
|
||||||
var browser = JSON.parse(process.env['SAUCE_BROWSER']);
|
var tunnelTimeout = 10000;
|
||||||
var username = process.env['SAUCE_USERNAME'];
|
var tunnel = new SauceTunnel(username, accessKey, null, true, tunnelTimeout);
|
||||||
var accessKey = process.env['SAUCE_ACCESS_KEY'];
|
console.log("Opening sauce connect tunnel...");
|
||||||
|
tunnel.start(function (success) {
|
||||||
var request = require('request');
|
if (success) {
|
||||||
|
console.log("Sauce connect tunnel opened");
|
||||||
request.post(
|
runTests();
|
||||||
'https://saucelabs.com/rest/v1/' + username + '/js-tests',
|
} else {
|
||||||
{
|
console.error("Failed to open sauce connect tunnel")
|
||||||
auth: { user: username, pass: accessKey },
|
process.exit(2);
|
||||||
json: {
|
|
||||||
platforms: [ browser ],
|
|
||||||
url: "http://localhost:" + port + "/test/index.html",
|
|
||||||
framework: "qunit"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function (error, response, body) {
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
var testIdentifier = body;
|
|
||||||
waitForTestCompletion(testIdentifier);
|
|
||||||
} else {
|
|
||||||
console.error("Failed to submit test to SauceLabs, status " + response.statusCode + ", body:\n" + JSON.stringify(body));
|
|
||||||
process.exit(3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
|
function runTests() {
|
||||||
|
var testDefinition = {
|
||||||
|
platforms: platforms,
|
||||||
|
url: "http://localhost:" + port + "/test/index.html",
|
||||||
|
framework: "qunit"
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("Starting saucelabs tests: " + JSON.stringify(testDefinition));
|
||||||
|
|
||||||
|
request.post(
|
||||||
|
'https://saucelabs.com/rest/v1/' + username + '/js-tests',
|
||||||
|
{
|
||||||
|
auth: { user: username, pass: accessKey },
|
||||||
|
json: testDefinition
|
||||||
|
},
|
||||||
|
function (error, response, body) {
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
var testIdentifier = body;
|
||||||
|
waitForTestCompletion(testIdentifier);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to submit test to SauceLabs, status " + response.statusCode + ", body:\n" + JSON.stringify(body));
|
||||||
|
process.exit(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function waitForTestCompletion(testIdentifier) {
|
function waitForTestCompletion(testIdentifier) {
|
||||||
request.post(
|
request.post(
|
||||||
|
|||||||
Reference in New Issue
Block a user