|
1 |
| -#!/bin/bash |
2 |
| - |
3 |
| -# override CircleCi's default run settings |
4 |
| -set +e |
5 |
| -set +o pipefail |
6 |
| - |
7 |
| -ROOT=$(dirname $0)/.. |
8 |
| -EXIT_STATE=0 |
9 |
| -MAX_AUTO_RETRY=0 |
10 |
| - |
11 |
| -log () { |
12 |
| - echo -e "\n$1" |
13 |
| -} |
14 |
| - |
15 |
| -# inspired by https://unix.stackexchange.com/a/82602 |
16 |
| -retry () { |
17 |
| - local n=1 |
18 |
| - |
19 |
| - until [ $n -ge $MAX_AUTO_RETRY ]; do |
20 |
| - "$@" --failFast && break |
21 |
| - log "run $n of $MAX_AUTO_RETRY failed, trying again ..." |
22 |
| - n=$[$n+1] |
23 |
| - done |
24 |
| - |
25 |
| - if [ $n -eq $MAX_AUTO_RETRY ]; then |
26 |
| - log "one last time, w/o failing fast" |
27 |
| - "$@" && n=0 |
28 |
| - fi |
29 |
| - |
30 |
| - if [ $n -eq $MAX_AUTO_RETRY ]; then |
31 |
| - log "all $n runs failed, moving on." |
32 |
| - EXIT_STATE=1 |
33 |
| - fi |
34 |
| -} |
35 |
| - |
36 |
| -case $1 in |
37 |
| - |
38 |
| - no-gl-jasmine) |
39 |
| - SUITE=$(circleci tests glob "$ROOT/test/jasmine/tests/*" | circleci tests split) |
40 |
| - MAX_AUTO_RETRY=2 |
41 |
| - retry npm run test-jasmine -- $SUITE --skip-tags=gl,noCI,flaky || EXIT_STATE=$? |
42 |
| - |
43 |
| - exit $EXIT_STATE |
44 |
| - ;; |
45 |
| - |
46 |
| - webgl-jasmine) |
47 |
| - SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=5 --tag=gl | circleci tests split)) |
48 |
| - for s in ${SHARDS[@]}; do |
49 |
| - MAX_AUTO_RETRY=2 |
50 |
| - retry npm run test-jasmine -- "$s" --tags=gl --skip-tags=noCI --doNotFailOnEmptyTestSuite |
51 |
| - done |
52 |
| - |
53 |
| - exit $EXIT_STATE |
54 |
| - ;; |
55 |
| - |
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 |
| - |
66 |
| - flaky-no-gl-jasmine) |
67 |
| - SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | circleci tests split)) |
68 |
| - |
69 |
| - for s in ${SHARDS[@]}; do |
70 |
| - MAX_AUTO_RETRY=5 |
71 |
| - retry npm run test-jasmine -- "$s" --tags=flaky --skip-tags=noCI |
72 |
| - done |
73 |
| - |
74 |
| - exit $EXIT_STATE |
75 |
| - ;; |
76 |
| - |
77 |
| - bundle-jasmine) |
78 |
| - npm run test-bundle || EXIT_STATE=$? |
79 |
| - exit $EXIT_STATE |
80 |
| - ;; |
81 |
| - |
82 |
| - mathjax-firefox) |
83 |
| - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --nowatch || EXIT_STATE=$? |
84 |
| - exit $EXIT_STATE |
85 |
| - ;; |
86 |
| - |
87 |
| - mathjax-firefox82+) |
88 |
| - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --skip-tags=noFF82 --nowatch && |
89 |
| - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --mathjax3 --skip-tags=noFF82 --nowatch && |
90 |
| - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --mathjax3 --nowatch && |
91 |
| - ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --nowatch || EXIT_STATE=$? |
92 |
| - exit $EXIT_STATE |
93 |
| - ;; |
94 |
| - |
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 |
| - |
104 |
| - make-baselines-mathjax3) |
105 |
| - 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=$? |
106 |
| - exit $EXIT_STATE |
107 |
| - ;; |
108 |
| - |
109 |
| - make-baselines) |
110 |
| - SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split) |
111 |
| - python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$? |
112 |
| - exit $EXIT_STATE |
113 |
| - ;; |
114 |
| - |
115 |
| - test-image) |
116 |
| - node test/image/compare_pixels_test.js || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$? |
117 |
| - exit $EXIT_STATE |
118 |
| - ;; |
119 |
| - |
120 |
| - test-image-mathjax3) |
121 |
| - node test/image/compare_pixels_test.js mathjax3 || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$? |
122 |
| - exit $EXIT_STATE |
123 |
| - ;; |
124 |
| - |
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 |
| - |
130 |
| - source-syntax) |
131 |
| - npm run lint || EXIT_STATE=$? |
132 |
| - npm run test-syntax || EXIT_STATE=$? |
133 |
| - exit $EXIT_STATE |
134 |
| - ;; |
135 |
| - |
136 |
| -esac |
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# override CircleCi's default run settings |
| 4 | +set +e |
| 5 | +set +o pipefail |
| 6 | + |
| 7 | +ROOT=$(dirname $0)/.. |
| 8 | +EXIT_STATE=0 |
| 9 | +MAX_AUTO_RETRY=0 |
| 10 | + |
| 11 | +log () { |
| 12 | + echo -e "\n$1" |
| 13 | +} |
| 14 | + |
| 15 | +# inspired by https://unix.stackexchange.com/a/82602 |
| 16 | +retry () { |
| 17 | + local n=1 |
| 18 | + |
| 19 | + until [ $n -ge $MAX_AUTO_RETRY ]; do |
| 20 | + "$@" --failFast && break |
| 21 | + log "run $n of $MAX_AUTO_RETRY failed, trying again ..." |
| 22 | + n=$[$n+1] |
| 23 | + done |
| 24 | + |
| 25 | + if [ $n -eq $MAX_AUTO_RETRY ]; then |
| 26 | + log "one last time, w/o failing fast" |
| 27 | + "$@" && n=0 |
| 28 | + fi |
| 29 | + |
| 30 | + if [ $n -eq $MAX_AUTO_RETRY ]; then |
| 31 | + log "all $n runs failed, moving on." |
| 32 | + EXIT_STATE=1 |
| 33 | + fi |
| 34 | +} |
| 35 | + |
| 36 | +case $1 in |
| 37 | + |
| 38 | + no-gl-jasmine) |
| 39 | + SUITE=$(circleci tests glob "$ROOT/test/jasmine/tests/*" | circleci tests split) |
| 40 | + MAX_AUTO_RETRY=2 |
| 41 | + retry npm run test-jasmine -- $SUITE --skip-tags=gl,noCI,flaky || EXIT_STATE=$? |
| 42 | + |
| 43 | + exit $EXIT_STATE |
| 44 | + ;; |
| 45 | + |
| 46 | + webgl-jasmine) |
| 47 | + SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=5 --tag=gl | circleci tests split)) |
| 48 | + for s in ${SHARDS[@]}; do |
| 49 | + MAX_AUTO_RETRY=2 |
| 50 | + retry npm run test-jasmine -- "$s" --tags=gl --skip-tags=noCI --doNotFailOnEmptyTestSuite |
| 51 | + done |
| 52 | + |
| 53 | + exit $EXIT_STATE |
| 54 | + ;; |
| 55 | + |
| 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 | + |
| 66 | + flaky-no-gl-jasmine) |
| 67 | + SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | circleci tests split)) |
| 68 | + |
| 69 | + for s in ${SHARDS[@]}; do |
| 70 | + MAX_AUTO_RETRY=5 |
| 71 | + retry npm run test-jasmine -- "$s" --tags=flaky --skip-tags=noCI |
| 72 | + done |
| 73 | + |
| 74 | + exit $EXIT_STATE |
| 75 | + ;; |
| 76 | + |
| 77 | + bundle-jasmine) |
| 78 | + npm run test-bundle || EXIT_STATE=$? |
| 79 | + exit $EXIT_STATE |
| 80 | + ;; |
| 81 | + |
| 82 | + mathjax-firefox) |
| 83 | + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --nowatch || EXIT_STATE=$? |
| 84 | + exit $EXIT_STATE |
| 85 | + ;; |
| 86 | + |
| 87 | + mathjax-firefox82+) |
| 88 | + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --skip-tags=noFF82 --nowatch && |
| 89 | + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax --mathjax3 --skip-tags=noFF82 --nowatch && |
| 90 | + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --mathjax3 --nowatch && |
| 91 | + ./node_modules/karma/bin/karma start test/jasmine/karma.conf.js --FF --bundleTest=mathjax_config --nowatch || EXIT_STATE=$? |
| 92 | + exit $EXIT_STATE |
| 93 | + ;; |
| 94 | + |
| 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 | + |
| 104 | + make-baselines-mathjax3) |
| 105 | + 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=$? |
| 106 | + exit $EXIT_STATE |
| 107 | + ;; |
| 108 | + |
| 109 | + make-baselines) |
| 110 | + SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split) |
| 111 | + python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$? |
| 112 | + exit $EXIT_STATE |
| 113 | + ;; |
| 114 | + |
| 115 | + test-image) |
| 116 | + node test/image/compare_pixels_test.js || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$? |
| 117 | + exit $EXIT_STATE |
| 118 | + ;; |
| 119 | + |
| 120 | + test-image-mathjax3) |
| 121 | + node test/image/compare_pixels_test.js mathjax3 || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$? |
| 122 | + exit $EXIT_STATE |
| 123 | + ;; |
| 124 | + |
| 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 | + |
| 130 | + source-syntax) |
| 131 | + npm run lint || EXIT_STATE=$? |
| 132 | + npm run test-syntax || EXIT_STATE=$? |
| 133 | + exit $EXIT_STATE |
| 134 | + ;; |
| 135 | + |
| 136 | +esac |
0 commit comments