Skip to content

Commit 682eb66

Browse files
authored
Merge pull request #3634 from plotly/circleci-parallel
CircleCI: run jobs in parallel
2 parents 577f831 + be33648 commit 682eb66

File tree

6 files changed

+70
-34
lines changed

6 files changed

+70
-34
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
docker:
4141
# need '-browsers' version to test in real (xvfb-wrapped) browsers
4242
- image: circleci/node:10.9.0-browsers
43+
parallelism: 2
4344
working_directory: ~/plotly.js
4445
steps:
4546
- attach_workspace:
@@ -52,6 +53,7 @@ jobs:
5253
docker:
5354
# need '-browsers' version to test in real (xvfb-wrapped) browsers
5455
- image: circleci/node:10.9.0-browsers
56+
parallelism: 2
5557
working_directory: ~/plotly.js
5658
steps:
5759
- attach_workspace:
@@ -75,6 +77,7 @@ jobs:
7577
test-image:
7678
docker:
7779
- image: plotly/testbed:latest
80+
parallelism: 4
7881
working_directory: /var/www/streambed/image_server/plotly.js/
7982
steps:
8083
- attach_workspace:
@@ -121,6 +124,18 @@ jobs:
121124
name: Run syntax tests
122125
command: ./.circleci/test.sh syntax
123126

127+
test-bundle:
128+
docker:
129+
# need '-browsers' version to test in real (xvfb-wrapped) browsers
130+
- image: circleci/node:10.9.0-browsers
131+
working_directory: ~/plotly.js
132+
steps:
133+
- attach_workspace:
134+
at: ~/
135+
- run:
136+
name: Run test-bundle
137+
command: ./.circleci/test.sh bundle
138+
124139
publish:
125140
docker:
126141
- image: circleci/node:10.9.0
@@ -157,6 +172,9 @@ workflows:
157172
build-and-test:
158173
jobs:
159174
- build
175+
- test-bundle:
176+
requires:
177+
- build
160178
- test-jasmine:
161179
requires:
162180
- build

.circleci/test.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ case $1 in
4444
jasmine)
4545
set_tz
4646

47-
npm run test-jasmine -- --skip-tags=gl,noCI,flaky || EXIT_STATE=$?
48-
npm run test-bundle || EXIT_STATE=$?
47+
SUITE=$(circleci tests glob "$ROOT/test/jasmine/tests/*" | circleci tests split)
48+
npm run test-jasmine -- $SUITE --skip-tags=gl,noCI,flaky --showSkipped || EXIT_STATE=$?
4949

5050
exit $EXIT_STATE
5151
;;
5252

5353
jasmine2)
5454
set_tz
5555

56-
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --tag=gl))
56+
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --tag=gl | circleci tests split))
5757

5858
for s in ${SHARDS[@]}; do
59-
retry npm run test-jasmine -- "$s" --tags=gl --skip-tags=noCI
59+
retry npm run test-jasmine -- "$s" --tags=gl --skip-tags=noCI --showSkipped
6060
done
6161

6262
exit $EXIT_STATE
@@ -65,23 +65,29 @@ case $1 in
6565
jasmine3)
6666
set_tz
6767

68-
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --tag=flaky))
68+
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --tag=flaky | circleci tests split))
6969

7070
for s in ${SHARDS[@]}; do
71-
retry npm run test-jasmine -- "$s" --tags=flaky --skip-tags=noCI
71+
retry npm run test-jasmine -- "$s" --tags=flaky --skip-tags=noCI --showSkipped
7272
done
7373

7474
exit $EXIT_STATE
7575
;;
7676

7777
image)
78-
npm run test-image || EXIT_STATE=$?
78+
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | circleci tests split)
79+
npm run test-image -- $SUITE --filter || EXIT_STATE=$?
7980
exit $EXIT_STATE
8081
;;
8182

8283
image2)
8384
npm run test-export || EXIT_STATE=$?
84-
npm run test-image-gl2d || EXIT_STATE=$?
85+
exit $EXIT_STATE
86+
;;
87+
88+
bundle)
89+
set_tz
90+
npm run test-bundle || EXIT_STATE=$?
8591
exit $EXIT_STATE
8692
;;
8793

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@
3535
"pretest": "node tasks/pretest.js",
3636
"test-jasmine": "karma start test/jasmine/karma.conf.js",
3737
"test-image": "node tasks/test_image.js",
38-
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
3938
"test-export": "node tasks/test_export.js",
4039
"test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output",
4140
"test-bundle": "node tasks/test_bundle.js",
42-
"test": "npm run test-jasmine && npm run test-bundle && npm run test-image && npm run test-image-gl2d && npm run test-syntax && npm run lint",
41+
"test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint",
4342
"start-test_dashboard": "node devtools/test_dashboard/server.js",
4443
"start-image_viewer": "node devtools/image_viewer/server.js",
4544
"start": "npm run start-test_dashboard",

test/image/compare_pixels_test.js

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var fs = require('fs');
2+
var minimist = require('minimist');
23

34
var common = require('../../tasks/util/common');
45
var getMockList = require('./assets/get_mock_list');
@@ -48,45 +49,57 @@ var QUEUE_WAIT = 10;
4849
* npm run test-image -- gl3d_* --queue
4950
*/
5051

51-
var pattern = process.argv[2];
52-
var mockList = getMockList(pattern);
53-
var isInQueue = (process.argv[3] === '--queue');
52+
var argv = minimist(process.argv.slice(2), {boolean: ['queue', 'filter' ]});
53+
var isInQueue = argv.queue;
54+
var filter = argv.filter;
5455

55-
if(mockList.length === 0) {
56-
throw new Error('No mocks found with pattern ' + pattern);
56+
var allMock = false;
57+
// If no pattern is provided, all mocks are compared
58+
if(argv._.length === 0) {
59+
allMock = true;
60+
argv._.push('');
5761
}
5862

59-
// filter out untestable mocks if no pattern is specified
60-
if(!pattern) {
63+
// Build list of mocks to compare
64+
var allMockList = [];
65+
argv._.forEach(function(pattern) {
66+
var mockList = getMockList(pattern);
67+
68+
if(mockList.length === 0) {
69+
throw new Error('No mocks found with pattern ' + pattern);
70+
}
71+
72+
allMockList = allMockList.concat(mockList);
73+
});
74+
75+
// To get rid of duplicates
76+
function unique(value, index, self) {
77+
return self.indexOf(value) === index;
78+
}
79+
allMockList = allMockList.filter(unique);
80+
81+
// filter out untestable mocks if no pattern is specified (ie. we're testing all mocks)
82+
// or if flag '--filter' is provided
83+
if(allMock || filter) {
6184
console.log('Filtering out untestable mocks:');
62-
mockList = mockList.filter(untestableFilter);
85+
allMockList = allMockList.filter(untestableFilter);
6386
console.log('\n');
6487
}
6588

66-
// gl2d have limited image-test support
67-
if(pattern === 'gl2d_*') {
68-
if(!isInQueue) {
69-
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');
70-
}
71-
console.log('\nSorting gl2d mocks to avoid gl-shader conflicts');
72-
sortGl2dMockList(mockList);
73-
console.log('');
74-
}
89+
sortGl2dMockList(allMockList);
7590

7691
// main
7792
if(isInQueue) {
78-
runInQueue(mockList);
93+
runInQueue(allMockList);
7994
}
8095
else {
81-
runInBatch(mockList);
96+
runInBatch(allMockList);
8297
}
8398

8499
/* Test cases:
85100
*
86101
* - font-wishlist
87-
* - all gl2d
88102
* - all mapbox
89-
* - gl3d_cone-*
90103
*
91104
* don't behave consistently from run-to-run and/or
92105
* machine-to-machine; skip over them for now.
@@ -95,7 +108,6 @@ else {
95108
function untestableFilter(mockName) {
96109
var cond = !(
97110
mockName === 'font-wishlist' ||
98-
mockName.indexOf('gl2d_') !== -1 ||
99111
mockName.indexOf('mapbox_') !== -1
100112
);
101113

test/jasmine/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if(argv.info) {
5959
' - `--nowatch (dflt: `false`, `true` on CI)`: run karma w/o `autoWatch` / multiple run mode',
6060
' - `--failFast` (dflt: `false`): exit karma upon first test failure',
6161
' - `--verbose` (dflt: `false`): show test result using verbose reporter',
62+
' - `--showSkipped` (dflt: `false`): show tests that are skipped',
6263
' - `--tags`: run only test with given tags (using the `jasmine-spec-tags` framework)',
6364
' - `--width`(dflt: 1035): set width of the browser window',
6465
' - `--height` (dflt: 617): set height of the browser window',
@@ -111,7 +112,7 @@ var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
111112
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
112113
var pathToMathJax = path.join(constants.pathToDist, 'extras', 'mathjax');
113114

114-
var reporters = (isFullSuite && !argv.tags) ? ['dots', 'spec'] : ['progress'];
115+
var reporters = ((isFullSuite && !argv.tags) || argv.showSkipped) ? ['dots', 'spec'] : ['progress'];
115116
if(argv.failFast) reporters.push('fail-fast');
116117
if(argv.verbose) reporters.push('verbose');
117118

test/jasmine/tests/sankey_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ describe('sankey tests', function() {
10541054
});
10551055

10561056
['node', 'link'].forEach(function(obj) {
1057-
it('should not output hover/unhover event data when ' + obj + '.hoverinfo is skip', function(done) {
1057+
it('@flaky should not output hover/unhover event data when ' + obj + '.hoverinfo is skip', function(done) {
10581058
var fig = Lib.extendDeep({}, mock);
10591059

10601060
Plotly.plot(gd, fig)

0 commit comments

Comments
 (0)