-
-
Notifications
You must be signed in to change notification settings - Fork 2k
751 lines (627 loc) · 22.3 KB
/
ci.yml
File metadata and controls
751 lines (627 loc) · 22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
name: CI
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
# TODO: Update this version to match library
NODE_VERSION: '18.20.4'
jobs:
# ============================================================
# Root build job - all dependent jobs fan out from here
# ============================================================
install-and-cibuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Pretest
run: npm run pretest
- name: CI-Build
run: npm run cibuild
- uses: actions/upload-artifact@v7
with:
name: build-output
retention-days: 3
path: |
build/
lib/
src/version.js
# ============================================================
# Jasmine browser tests
# ============================================================
timezone-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run hover_label test in UTC timezone
uses: ./.github/actions/run-xvfb
env:
TZ: 'UTC'
with:
run: npm run test-jasmine hover_label
- name: Run hover_label test in Europe/Berlin timezone
uses: ./.github/actions/run-xvfb
env:
TZ: 'Europe/Berlin'
with:
run: npm run test-jasmine hover_label
- name: Run hover_label test in Asia/Tokyo timezone
uses: ./.github/actions/run-xvfb
env:
TZ: 'Asia/Tokyo'
with:
run: npm run test-jasmine hover_label
- name: Run hover_label test in America/Toronto timezone
uses: ./.github/actions/run-xvfb
env:
TZ: 'America/Toronto'
with:
run: npm run test-jasmine hover_label
no-gl-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]
env:
TZ: 'America/Anchorage'
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 4
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run jasmine tests (no-gl, shard ${{ matrix.shard }})
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh no-gl-jasmine
webgl-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
env:
TZ: 'America/Anchorage'
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 8
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run jasmine tests (webgl, shard ${{ matrix.shard }})
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh webgl-jasmine
virtual-webgl-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
env:
TZ: 'America/Anchorage'
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 8
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run jasmine tests (virtual-webgl, shard ${{ matrix.shard }})
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh virtual-webgl-jasmine
webgl-jasmine-chromeLatest:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
env:
TZ: 'America/Anchorage'
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 8
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
with:
chrome-version: '143.0.7499.192'
- name: Run jasmine tests (webgl chromeLatest, shard ${{ matrix.shard }})
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh webgl-jasmine
flaky-no-gl-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
env:
TZ: 'America/Anchorage'
SHARD_INDEX: 0
SHARD_TOTAL: 1
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run flaky jasmine tests
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh flaky-no-gl-jasmine
bundle-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
env:
TZ: 'America/Anchorage'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run bundle jasmine tests
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh bundle-jasmine
mathjax-firefoxLatest:
needs: install-and-cibuild
runs-on: ubuntu-latest
env:
TZ: 'America/Anchorage'
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: browser-actions/setup-firefox@v1
- name: Test MathJax on firefox-latest
uses: ./.github/actions/run-xvfb
with:
run: .github/scripts/test.sh mathjax-firefox
# ============================================================
# noCI tests (merged from test.yml)
# ============================================================
noci-jasmine:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: ./.github/actions/setup-chrome
- name: Run noCI tests
uses: ./.github/actions/run-xvfb
with:
run: ./tasks/noci_test.sh jasmine
# ============================================================
# Image baseline generation and comparison
# ============================================================
make-baselines:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
env:
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 12
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install Kaleido, plotly.io and required fonts
run: .github/scripts/env_image.sh
- name: Create all png files
run: .github/scripts/test.sh make-baselines
- uses: actions/upload-artifact@v7
with:
name: baselines-default-${{ matrix.shard }}
retention-days: 3
path: build/test_images/
test-baselines:
needs: make-baselines
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/download-artifact@v8
with:
pattern: baselines-default-*
path: build/test_images/
merge-multiple: true
- name: Compare pixels
run: .github/scripts/test.sh test-image ; find build -maxdepth 1 -type f -delete
- name: IMAGE DIFF DETECTED
if: failure()
run: |
echo "::warning::Image Diff Detected: baseline images may need to be updated."
echo "Download the baseline images from the artifacts of this workflow run."
echo "Add the new images to 'test/image/baselines/' and commit them to this pull request."
mkdir -p build/baselines
for f in build/test_images/*.png; do
[ -f "$f" ] && cp "test/image/baselines/$(basename "$f")" build/baselines/ 2>/dev/null || true
done
- uses: actions/upload-artifact@v7
if: failure()
with:
name: baselines-default-diff
retention-days: 7
path: |
build/baselines/
build/test_images/
build/test_images_diff/
make-baselines-b64:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
env:
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 12
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install kaleido, plotly.io and required fonts
run: .github/scripts/env_image.sh
- name: Create all png files (b64)
run: .github/scripts/test.sh make-baselines-b64
- uses: actions/upload-artifact@v7
with:
name: baselines-b64-${{ matrix.shard }}
retention-days: 3
path: build/test_images/
test-baselines-b64:
needs: make-baselines-b64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/download-artifact@v8
with:
pattern: baselines-b64-*
path: build/test_images/
merge-multiple: true
- name: Compare pixels
run: .github/scripts/test.sh test-image ; find build -maxdepth 1 -type f -delete
- name: IMAGE DIFF DETECTED
if: failure()
run: |
echo "::warning::Image Diff Detected: baseline images may need to be updated."
echo "Download the baseline images from the artifacts of this workflow run."
echo "Add the new images to 'test/image/baselines/' and commit them to this pull request."
mkdir -p build/baselines
for f in build/test_images/*.png; do
[ -f "$f" ] && cp "test/image/baselines/$(basename "$f")" build/baselines/ 2>/dev/null || true
done
- uses: actions/upload-artifact@v7
if: failure()
with:
name: baselines-b64-diff
retention-days: 7
path: |
build/baselines/
build/test_images/
build/test_images_diff/
make-baselines-virtual-webgl:
needs: install-and-cibuild
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
env:
SHARD_INDEX: ${{ matrix.shard }}
SHARD_TOTAL: 8
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install kaleido, plotly.io and required fonts
run: .github/scripts/env_image.sh
- name: Create png files (virtual-webgl)
run: .github/scripts/test.sh make-baselines-virtual-webgl
- uses: actions/upload-artifact@v7
with:
name: baselines-virtual-webgl-${{ matrix.shard }}
retention-days: 3
path: build/test_images/
test-baselines-virtual-webgl:
needs: make-baselines-virtual-webgl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/download-artifact@v8
with:
pattern: baselines-virtual-webgl-*
path: build/test_images/
merge-multiple: true
- name: Compare pixels
run: .github/scripts/test.sh test-image-virtual-webgl ; find build -maxdepth 1 -type f -delete
- name: IMAGE DIFF DETECTED
if: failure()
run: |
echo "::warning::Image Diff Detected: baseline images may need to be updated."
echo "Download the baseline images from the artifacts of this workflow run."
echo "Add the new images to 'test/image/baselines/' and commit them to this pull request."
mkdir -p build/baselines
for f in build/test_images/*.png; do
[ -f "$f" ] && cp "test/image/baselines/$(basename "$f")" build/baselines/ 2>/dev/null || true
done
- uses: actions/upload-artifact@v7
if: failure()
with:
name: baselines-virtual-webgl-diff
retention-days: 7
path: |
build/baselines/
build/test_images/
build/test_images_diff/
make-baselines-mathjax3:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install kaleido, plotly.io and required fonts
run: .github/scripts/env_image.sh
- name: Create mathjax v3 png files
run: .github/scripts/test.sh make-baselines-mathjax3
- uses: actions/upload-artifact@v7
with:
name: baselines-mathjax3
retention-days: 3
path: build/test_images/
test-baselines-mathjax3:
needs: make-baselines-mathjax3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/download-artifact@v8
with:
name: baselines-mathjax3
path: build/test_images/
- name: Compare pixels of mathjax v3 baselines
run: .github/scripts/test.sh test-image-mathjax3
- name: IMAGE DIFF DETECTED
if: failure()
run: |
echo "::warning::Image Diff Detected: baseline images may need to be updated."
echo "Download the baseline images from the artifacts of this workflow run."
echo "Add the new images to 'test/image/baselines/' and commit them to this pull request."
mkdir -p build/baselines
for f in build/test_images/*.png; do
[ -f "$f" ] && cp "test/image/baselines/$(basename "$f")" build/baselines/ 2>/dev/null || true
done
- uses: actions/upload-artifact@v7
if: failure()
with:
name: baselines-mathjax3-diff
retention-days: 7
path: |
build/baselines/
build/test_images/
build/test_images_diff/
# ============================================================
# Export generation and testing
# ============================================================
make-exports:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install kaleido, plotly.io and required fonts
run: .github/scripts/env_image.sh
- name: Install poppler-utils for eps export
run: |
sudo apt-get update --allow-releaseinfo-change
sudo apt-get install poppler-utils
- name: Create svg, jpg, jpeg, webp, pdf and eps files
run: sudo python3 test/image/make_exports.py
- uses: actions/upload-artifact@v7
with:
name: exports
retention-days: 3
path: build/
test-exports:
needs: make-exports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- uses: actions/download-artifact@v8
with:
name: exports
path: build/
- name: Test export sizes
run: node test/image/export_test.js ; find build -maxdepth 1 -type f -delete
- uses: actions/upload-artifact@v7
if: failure()
with:
name: exports-diff
retention-days: 7
path: build/
# ============================================================
# Validation jobs
# ============================================================
mock-validation:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- name: Test validation using node.js and jsdom
run: npm run test-plain-obj
- name: Validate mocks
run: npm run test-mock
source-syntax:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-workspace
- name: Run syntax tests on source files
run: .github/scripts/test.sh source-syntax
# ============================================================
# Standalone jobs (no dependencies on install-and-cibuild)
# ============================================================
publish-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set up build environment
run: .github/scripts/env_build.sh
- name: Preview CHANGELOG for next release (only on master)
if: github.ref == 'refs/heads/master'
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
- name: Set draft version in package.json
run: |
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
- name: View package.json diff between previous and next releases
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
- name: Build dist/
run: npm run build
- uses: actions/upload-artifact@v7
with:
name: dist-node18
retention-days: 7
path: dist/
- name: View dist/README.md diff between previous and next releases
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
- name: Preview plot-schema diff (only on master)
if: github.ref == 'refs/heads/master'
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
- name: Pack tarball
run: |
npm pack
version=$(node --eval "console.log(require('./package.json').version)")
mv plotly.js-$version.tgz plotly.js.tgz
- uses: actions/upload-artifact@v7
with:
name: tarball-node18
retention-days: 7
path: plotly.js.tgz
- name: Test plot-schema.json diff
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
publish-dist-node-v22:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-node@v6
with:
node-version: '22.14.0'
cache: 'npm'
- name: Set up build environment
run: .github/scripts/env_build.sh
- name: Preview CHANGELOG for next release (only on master)
if: github.ref == 'refs/heads/master'
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
- name: Set draft version in package.json
run: |
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
- name: View package.json diff between previous and next releases
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
- name: Build dist/
run: npm run build
- uses: actions/upload-artifact@v7
with:
name: dist-node22
retention-days: 7
path: dist/
- name: View dist/README.md diff between previous and next releases
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
- name: Preview plot-schema diff (only on master)
if: github.ref == 'refs/heads/master'
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
- name: Pack tarball
run: |
npm pack
version=$(node --eval "console.log(require('./package.json').version)")
mv plotly.js-$version.tgz plotly.js.tgz
- uses: actions/upload-artifact@v7
with:
name: tarball-node22
retention-days: 7
path: plotly.js.tgz
- name: Test plot-schema.json diff
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
test-stackgl-bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set up build environment
run: cd stackgl_modules && npm ci
- name: Bundle bundle-stackgl/index.js
run: cd stackgl_modules && cp index.js INDEX.js && npm run bundle-stackgl
- name: Test stackgl_modules/index.js diff
run: diff --unified --color stackgl_modules/INDEX.js stackgl_modules/index.js
- uses: actions/upload-artifact@v7
if: failure()
with:
name: stackgl-bundle
retention-days: 7
path: stackgl_modules/index.js
test-topojson-build:
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Set up build environment
run: cd topojson && npm ci
- name: Build topojson
run: cd topojson && mv dist dist_backup && npm run build
- name: Compare existing files with newly built files
run: diff -qr topojson/dist topojson/dist_backup
- uses: actions/upload-artifact@v7
if: failure()
with:
name: topojson-dist
retention-days: 7
path: topojson/dist/