Skip to content

Commit f9df5dd

Browse files
authored
Merge pull request #5724 from plotly/switch-to-kaleido
Simplify the process of creating baselines using Kaleido and improve image & other export test systems
2 parents 4f54bcd + 5756afe commit f9df5dd

File tree

1,151 files changed

+625
-1086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,151 files changed

+625
-1086
lines changed

.circleci/config.yml

Lines changed: 83 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,41 +78,96 @@ jobs:
7878
name: Run jasmine tests (part C)
7979
command: ./.circleci/test.sh no-gl-flaky-jasmine
8080

81-
stable-image:
82-
docker:
83-
- image: plotly/testbed:latest
81+
make-baselines:
8482
parallelism: 4
85-
working_directory: /var/www/streambed/image_server/plotly.js/
83+
docker:
84+
- image: circleci/python:3.8.9
85+
working_directory: ~/plotly.js
8686
steps:
8787
- attach_workspace:
88-
at: /var/www/streambed/image_server/
88+
at: ~/
89+
- run:
90+
name: which pip3 version
91+
command: which pip3 && pip3 --version
92+
- run:
93+
name: install kaleido v0.2.1
94+
command: python3 -m pip install kaleido==0.2.1
8995
- run:
90-
name: Run and setup container
96+
name: install plotly.io v4.14.3
97+
command: python3 -m pip install plotly==4.14.3
98+
- run:
99+
name: install liberation2 fonts
100+
command: sudo apt-get install fonts-liberation2
101+
- run:
102+
name: install NotoSansCJK fonts
103+
command: sudo apt install fonts-noto-cjk
104+
- run:
105+
name: download google fonts e.g. GravitasOne, NotoSansMono, NotoSans, NotoSerif, Old_Standard_TT, PT_Sans_Narrow, Raleway and Roboto
106+
command: python3 ./.circleci/download_google_fonts.py
107+
- run:
108+
name: install OpenSans as well as downloaded google fonts
91109
command: |
92-
supervisord &
93-
npm run docker -- setup
110+
sudo cp -r .circleci/fonts/ /usr/share/
111+
sudo fc-cache -f
112+
- run:
113+
name: create all png files
114+
command: ./.circleci/test.sh make-baselines
115+
- persist_to_workspace:
116+
root: ~/
117+
paths:
118+
- plotly.js
119+
120+
test-baselines:
121+
docker:
122+
- image: circleci/node:12.22.1
123+
working_directory: ~/plotly.js
124+
steps:
125+
- attach_workspace:
126+
at: ~/
94127
- run:
95-
name: Run image tests (part A)
96-
command: ./.circleci/test.sh stable-image || { tar -cvf build/baselines.tar build/test_images/ ; exit 1; } ; find build -maxdepth 1 -type f -delete
128+
name: compare pixels
129+
command: ./.circleci/test.sh test-image ; find build -maxdepth 1 -type f -delete
97130
- store_artifacts:
98131
path: build
99132
destination: /
100133

101-
flaky-image:
134+
make-exports:
102135
docker:
103-
- image: plotly/testbed:latest
104-
working_directory: /var/www/streambed/image_server/plotly.js/
136+
- image: circleci/python:3.8.9
137+
working_directory: ~/plotly.js
105138
steps:
106139
- attach_workspace:
107-
at: /var/www/streambed/image_server/
140+
at: ~/
108141
- run:
109-
name: Run and setup container
110-
command: |
111-
supervisord &
112-
npm run docker -- setup
142+
name: which pip3 version
143+
command: which pip3 && pip3 --version
144+
- run:
145+
name: install kaleido v0.2.1
146+
command: python3 -m pip install kaleido==0.2.1
147+
- run:
148+
name: install plotly.io v4.14.3
149+
command: python3 -m pip install plotly==4.14.3
113150
- run:
114-
name: Run image tests (part B)
115-
command: ./.circleci/test.sh flaky-image ; find build -maxdepth 1 -type f -delete
151+
name: install poppler-utils to have pdftops for exporting eps
152+
command: sudo apt-get install poppler-utils
153+
- run:
154+
name: create svg, jpg, jpeg, webp, pdf and eps files
155+
command: python3 test/image/make_exports.py
156+
- persist_to_workspace:
157+
root: ~/
158+
paths:
159+
- plotly.js
160+
161+
test-exports:
162+
docker:
163+
- image: circleci/node:12.22.1
164+
working_directory: ~/plotly.js
165+
steps:
166+
- attach_workspace:
167+
at: ~/
168+
- run:
169+
name: test export sizes
170+
command: node test/image/export_test.js ; find build -maxdepth 1 -type f -delete
116171
- store_artifacts:
117172
path: build
118173
destination: /
@@ -237,12 +292,18 @@ workflows:
237292
- no-gl-flaky-jasmine:
238293
requires:
239294
- install-and-cibuild
240-
- stable-image:
295+
- make-baselines:
241296
requires:
242297
- install-and-cibuild
243-
- flaky-image:
298+
- test-baselines:
299+
requires:
300+
- make-baselines
301+
- make-exports:
244302
requires:
245303
- install-and-cibuild
304+
- test-exports:
305+
requires:
306+
- make-exports
246307
- mock-validation:
247308
requires:
248309
- install-and-cibuild

.circleci/download_google_fonts.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import requests
2+
3+
dirOut = '.circleci/fonts/truetype/googleFonts/'
4+
5+
def download(repo, family, types) :
6+
for t in types :
7+
name = family + t + '.ttf'
8+
url = repo + name + '?raw=true'
9+
print(url)
10+
req = requests.get(url, allow_redirects=True)
11+
open(dirOut + name, 'wb').write(req.content)
12+
13+
download(
14+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSansMono/',
15+
'NotoSansMono',
16+
[
17+
'-Regular',
18+
'-Bold'
19+
]
20+
)
21+
22+
download(
23+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSans/',
24+
'NotoSans',
25+
[
26+
'-Regular',
27+
'-Italic',
28+
'-Bold'
29+
]
30+
)
31+
32+
download(
33+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSerif/',
34+
'NotoSerif',
35+
[
36+
'-Regular',
37+
'-Italic',
38+
'-Bold',
39+
'-BoldItalic',
40+
]
41+
)
42+
43+
download(
44+
'https://github.com/google/fonts/blob/main/ofl/oldstandardtt/',
45+
'OldStandard',
46+
[
47+
'-Regular',
48+
'-Italic',
49+
'-Bold'
50+
]
51+
)
52+
53+
"""
54+
download(
55+
'https://github.com/googlefonts/opensans/blob/main/fonts/ttf/',
56+
'OpenSans',
57+
[
58+
'Bold',
59+
'BoldItalic',
60+
'ExtraBold',
61+
'ExtraBoldItalic',
62+
'Italic',
63+
'Light',
64+
'LightItalic',
65+
'Regular',
66+
'Semibold',
67+
'SemiboldItalic',
68+
]
69+
)
70+
"""
71+
72+
download(
73+
'https://github.com/google/fonts/blob/main/ofl/ptsansnarrow/',
74+
'PT_Sans-Narrow-Web',
75+
[
76+
'-Regular',
77+
'-Bold'
78+
]
79+
)
80+
81+
download(
82+
'https://github.com/impallari/Raleway/blob/master/fonts/v3.000%20Fontlab/TTF/',
83+
'Raleway',
84+
[
85+
'-Regular',
86+
'-Regular-Italic',
87+
'-Bold',
88+
'-Bold-Italic'
89+
]
90+
)
91+
92+
download(
93+
'https://github.com/googlefonts/roboto/blob/main/src/hinted/',
94+
'Roboto',
95+
[
96+
'-Regular',
97+
'-Italic',
98+
'-Bold',
99+
'-BoldItalic'
100+
]
101+
)
102+
103+
download(
104+
'https://github.com/expo/google-fonts/blob/master/font-packages/gravitas-one/',
105+
'GravitasOne',
106+
[
107+
'_400Regular'
108+
]
109+
)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)