-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
CircleCI: run jobs in parallel #3634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
b38e4a8
830d0a9
609cdf8
b99672b
be33648
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
var fs = require('fs'); | ||
var minimist = require('minimist'); | ||
|
||
var common = require('../../tasks/util/common'); | ||
var getMockList = require('./assets/get_mock_list'); | ||
|
@@ -48,37 +49,51 @@ var QUEUE_WAIT = 10; | |
* npm run test-image -- gl3d_* --queue | ||
*/ | ||
|
||
var pattern = process.argv[2]; | ||
var mockList = getMockList(pattern); | ||
var isInQueue = (process.argv[3] === '--queue'); | ||
var argv = minimist(process.argv.slice(2), {boolean: ['queue', 'filter' ]}); | ||
var isInQueue = argv.queue; | ||
var filter = argv.filter; | ||
|
||
if(mockList.length === 0) { | ||
throw new Error('No mocks found with pattern ' + pattern); | ||
var allMock = false; | ||
// If no pattern is provided, all mocks are compared | ||
if(argv._.length === 0) { | ||
allMock = true; | ||
argv._.push(''); | ||
} | ||
|
||
// filter out untestable mocks if no pattern is specified | ||
if(!pattern) { | ||
console.log('Filtering out untestable mocks:'); | ||
mockList = mockList.filter(untestableFilter); | ||
console.log('\n'); | ||
} | ||
// Build list of mocks to compare | ||
var allMockList = []; | ||
argv._.forEach(function(pattern) { | ||
var mockList = getMockList(pattern); | ||
|
||
// gl2d have limited image-test support | ||
if(pattern === 'gl2d_*') { | ||
if(!isInQueue) { | ||
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n'); | ||
if(mockList.length === 0) { | ||
throw new Error('No mocks found with pattern ' + pattern); | ||
} | ||
console.log('\nSorting gl2d mocks to avoid gl-shader conflicts'); | ||
sortGl2dMockList(mockList); | ||
console.log(''); | ||
|
||
allMockList = allMockList.concat(mockList); | ||
}); | ||
|
||
// To get rid of duplicates | ||
Array.prototype.unique = function() { | ||
return this.filter(function(value, index, self) { | ||
return self.indexOf(value) === index; | ||
}); | ||
}; | ||
allMockList = allMockList.unique(); | ||
etpinard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// filter out untestable mocks if no pattern is specified (ie. we're testing all mocks) | ||
// or if flag '--filter' is provided | ||
if(allMock || filter) { | ||
console.log('Filtering out untestable mocks:'); | ||
allMockList = allMockList.filter(untestableFilter); | ||
console.log('\n'); | ||
} | ||
|
||
// main | ||
if(isInQueue) { | ||
runInQueue(mockList); | ||
runInQueue(allMockList); | ||
} | ||
else { | ||
runInBatch(mockList); | ||
runInBatch(allMockList); | ||
} | ||
|
||
/* Test cases: | ||
|
@@ -95,7 +110,7 @@ else { | |
function untestableFilter(mockName) { | ||
var cond = !( | ||
mockName === 'font-wishlist' || | ||
mockName.indexOf('gl2d_') !== -1 || | ||
// mockName.indexOf('gl2d_') !== -1 || | ||
etpinard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mockName.indexOf('mapbox_') !== -1 | ||
); | ||
|
||
|
@@ -104,34 +119,6 @@ function untestableFilter(mockName) { | |
return cond; | ||
} | ||
|
||
/* gl2d pointcloud and other non-regl gl2d mock(s) | ||
* must be tested first on in order to work; | ||
* sort them here. | ||
* | ||
* gl-shader appears to conflict with regl. | ||
* We suspect that the lone gl context on CircleCI is | ||
* having issues with dealing with the two different | ||
* program binding algorithm. | ||
* | ||
* The problem will be solved by switching all our | ||
* WebGL-based trace types to regl. | ||
* | ||
* More info here: | ||
* https://github.com/plotly/plotly.js/pull/1037 | ||
*/ | ||
function sortGl2dMockList(mockList) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could reproduce this issue locally! Nice catch 👀 With be33648, I reintroduced There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
var mockNames = ['gl2d_pointcloud-basic', 'gl2d_heatmapgl']; | ||
var pos = 0; | ||
|
||
mockNames.forEach(function(m) { | ||
var ind = mockList.indexOf(m); | ||
var tmp = mockList[pos]; | ||
mockList[pos] = m; | ||
mockList[ind] = tmp; | ||
pos++; | ||
}); | ||
} | ||
|
||
function runInBatch(mockList) { | ||
var running = 0; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚡ - no need to set the timezone in containers that run image tests (they have their own timezone in their docker container).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etpinard would you please provide a pointer to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what else can I say.