Skip to content

Commit 7234c08

Browse files
authored
Merge pull request #6784 from plotly/virtual-webgl
Add option to use `virtual-webgl` for handling multiple WebGL contexts
2 parents 5a7cc3e + 7b12beb commit 7234c08

13 files changed

+264
-93
lines changed

.circleci/config.yml

+62
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,26 @@ jobs:
122122
name: Run jasmine tests (part B)
123123
command: .circleci/test.sh webgl-jasmine
124124

125+
virtual-webgl-jasmine:
126+
docker:
127+
# need '-browsers' version to test in real (xvfb-wrapped) browsers
128+
- image: cimg/node:16.17.1-browsers
129+
environment:
130+
# Alaska time (arbitrary timezone to test date logic)
131+
TZ: "America/Anchorage"
132+
parallelism: 8
133+
working_directory: ~/plotly.js
134+
steps:
135+
- browser-tools/install-browser-tools: &browser-versions
136+
chrome-version: 110.0.5481.100
137+
install-firefox: false
138+
install-geckodriver: false
139+
- attach_workspace:
140+
at: ~/
141+
- run:
142+
name: Run jasmine tests (part B)
143+
command: .circleci/test.sh virtual-webgl-jasmine
144+
125145
flaky-no-gl-jasmine:
126146
docker:
127147
# need '-browsers' version to test in real (xvfb-wrapped) browsers
@@ -216,6 +236,25 @@ jobs:
216236
name: Test MathJax on firefox-latest
217237
command: .circleci/test.sh mathjax-firefox82+
218238

239+
make-baselines-virtual-webgl:
240+
parallelism: 2
241+
docker:
242+
- image: circleci/python:3.8.9
243+
working_directory: ~/plotly.js
244+
steps:
245+
- attach_workspace:
246+
at: ~/
247+
- run:
248+
name: Install kaleido, plotly.io and required fonts
249+
command: .circleci/env_image.sh
250+
- run:
251+
name: Create png files using virtual-webgl & WebGL v1
252+
command: .circleci/test.sh make-baselines-virtual-webgl
253+
- persist_to_workspace:
254+
root: ~/
255+
paths:
256+
- plotly.js
257+
219258
make-baselines-mathjax3:
220259
docker:
221260
- image: circleci/python:3.8.9
@@ -267,6 +306,20 @@ jobs:
267306
path: build
268307
destination: /
269308

309+
test-baselines-virtual-webgl:
310+
docker:
311+
- image: circleci/node:16.9.0
312+
working_directory: ~/plotly.js
313+
steps:
314+
- attach_workspace:
315+
at: ~/
316+
- run:
317+
name: Compare pixels
318+
command: .circleci/test.sh test-image-virtual-webgl ; find build -maxdepth 1 -type f -delete
319+
- store_artifacts:
320+
path: build
321+
destination: /
322+
270323
test-baselines-mathjax3:
271324
docker:
272325
- image: circleci/node:16.9.0
@@ -441,9 +494,18 @@ workflows:
441494
- webgl-jasmine:
442495
requires:
443496
- install-and-cibuild
497+
- virtual-webgl-jasmine:
498+
requires:
499+
- install-and-cibuild
444500
- flaky-no-gl-jasmine:
445501
requires:
446502
- install-and-cibuild
503+
- make-baselines-virtual-webgl:
504+
requires:
505+
- install-and-cibuild
506+
- test-baselines-virtual-webgl:
507+
requires:
508+
- make-baselines-virtual-webgl
447509
- make-baselines-mathjax3:
448510
requires:
449511
- install-and-cibuild

.circleci/test.sh

+24
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ case $1 in
5353
exit $EXIT_STATE
5454
;;
5555

56+
virtual-webgl-jasmine)
57+
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=5 --tag=gl | circleci tests split))
58+
for s in ${SHARDS[@]}; do
59+
MAX_AUTO_RETRY=2
60+
retry ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --virtualWebgl --tags=gl --skip-tags=noCI,noVirtualWebgl --doNotFailOnEmptyTestSuite -- "$s"
61+
done
62+
63+
exit $EXIT_STATE
64+
;;
65+
5666
flaky-no-gl-jasmine)
5767
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | circleci tests split))
5868

@@ -82,6 +92,15 @@ case $1 in
8292
exit $EXIT_STATE
8393
;;
8494

95+
make-baselines-virtual-webgl)
96+
SUITE=$({\
97+
find $ROOT/test/image/mocks/gl* -type f -printf "%f\n"; \
98+
find $ROOT/test/image/mocks/mapbox* -type f -printf "%f\n"; \
99+
} | sed 's/\.json$//1' | circleci tests split)
100+
python3 test/image/make_baseline.py virtual-webgl $SUITE || EXIT_STATE=$?
101+
exit $EXIT_STATE
102+
;;
103+
85104
make-baselines-mathjax3)
86105
python3 test/image/make_baseline.py mathjax3 legend_mathjax_title_and_items mathjax parcats_grid_subplots table_latex_multitrace_scatter table_plain_birds table_wrapped_birds ternary-mathjax || EXIT_STATE=$?
87106
exit $EXIT_STATE
@@ -103,6 +122,11 @@ case $1 in
103122
exit $EXIT_STATE
104123
;;
105124

125+
test-image-virtual-webgl)
126+
node test/image/compare_pixels_test.js virtual-webgl || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$?
127+
exit $EXIT_STATE
128+
;;
129+
106130
source-syntax)
107131
npm run lint || EXIT_STATE=$?
108132
npm run test-syntax || EXIT_STATE=$?

0 commit comments

Comments
 (0)