mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-10 10:01:00 +00:00
chore(travis): use different port numbers per build
We can't establish multiple SSH tunnels for the same port (for BrowserStack). This makes it possible to run multiple parallel builds using BrowserStack.
This commit is contained in:
parent
5d6482bb3b
commit
84187b6d94
2 changed files with 21 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ var http = require('http');
|
|||
var BrowserStackTunnel = require('browserstacktunnel-wrapper');
|
||||
|
||||
var HOSTNAME = 'localhost';
|
||||
var PORTS = [9090, 9876];
|
||||
var PORTS = require('../grunt/utils').availablePorts;
|
||||
var ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY;
|
||||
var READY_FILE = process.env.SAUCE_CONNECT_READY_FILE;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,22 @@ var spawn = require('child_process').spawn;
|
|||
var version;
|
||||
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
|
||||
|
||||
var PORT_MIN = 8000;
|
||||
var PORT_MAX = 9999;
|
||||
var TRAVIS_BUILD_NUMBER = parseInt(process.env.TRAVIS_BUILD_NUMBER, 10);
|
||||
var getRandomPorts = function() {
|
||||
if (!process.env.TRAVIS) {
|
||||
return [9876, 9877];
|
||||
}
|
||||
|
||||
// Generate two numbers between PORT_MIN and PORT_MAX, based on TRAVIS_BUILD_NUMBER.
|
||||
return [
|
||||
PORT_MIN + (TRAVIS_BUILD_NUMBER % (PORT_MAX - PORT_MIN)),
|
||||
PORT_MIN + ((TRAVIS_BUILD_NUMBER + 100) % (PORT_MAX - PORT_MIN))
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
init: function() {
|
||||
|
|
@ -279,7 +295,7 @@ module.exports = {
|
|||
stream: options && options.stream
|
||||
};
|
||||
|
||||
args.push('--port=' + this.sauceLabsAvailablePorts.pop());
|
||||
args.push('--port=' + this.availablePorts.pop());
|
||||
|
||||
if (args.indexOf('test:e2e') !== -1 && grunt.option('e2e-browsers')) {
|
||||
args.push('--browsers=' + grunt.option('e2e-browsers'));
|
||||
|
|
@ -295,5 +311,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
// see http://saucelabs.com/docs/connect#localhost
|
||||
sauceLabsAvailablePorts: [9000, 9001, 9080, 9090, 9876]
|
||||
sauceLabsAvailablePorts: [9000, 9001, 9080, 9090, 9876],
|
||||
// pseudo-random port numbers for BrowserStack
|
||||
availablePorts: getRandomPorts()
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue