Skip to content

Commit 905eeb0

Browse files
committed
Merge remote-tracking branch 'origin/master' into new-d3-geo
2 parents 98c19b8 + bd5ac04 commit 905eeb0

File tree

1,308 files changed

+102247
-80974
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,308 files changed

+102247
-80974
lines changed

.circleci/config.yml

Lines changed: 89 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
name: Run jasmine tests (part B)
6767
command: ./.circleci/test.sh webgl-jasmine
6868

69-
no-gl-flaky-jasmine:
69+
flaky-no-gl-jasmine:
7070
docker:
7171
# need '-browsers' version to test in real (xvfb-wrapped) browsers
7272
- image: circleci/node:12.22.1-browsers
@@ -76,43 +76,101 @@ jobs:
7676
at: ~/
7777
- run:
7878
name: Run jasmine tests (part C)
79-
command: ./.circleci/test.sh no-gl-flaky-jasmine
79+
command: ./.circleci/test.sh flaky-no-gl-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
95+
- run:
96+
name: install plotly.io v5.0.0
97+
command: python3 -m pip install plotly==5.0.0
98+
- run:
99+
name: install liberation2 fonts
100+
command: sudo apt-get install fonts-liberation2
101+
- run:
102+
name: install OpenSans fonts
103+
command: sudo apt-get install fonts-open-sans
104+
- run:
105+
name: install NotoSansCJK fonts
106+
command: sudo apt install fonts-noto-cjk
107+
- run:
108+
name: download google fonts e.g. Dosis, GravitasOne, NotoSansMono, NotoSans, NotoSerif, Old_Standard_TT, PT_Sans_Narrow, Raleway and Roboto
109+
command: python3 ./.circleci/download_google_fonts.py
89110
- run:
90-
name: Run and setup container
111+
name: install downloaded google fonts
91112
command: |
92-
supervisord &
93-
npm run docker -- setup
113+
sudo cp -r .circleci/fonts/ /usr/share/
114+
sudo fc-cache -f
94115
- run:
95-
name: Run image tests (part A)
96-
command: ./.circleci/test.sh stable-image ; find build -maxdepth 1 -type f -delete
116+
name: create all png files
117+
command: ./.circleci/test.sh make-baselines
118+
- persist_to_workspace:
119+
root: ~/
120+
paths:
121+
- plotly.js
122+
123+
test-baselines:
124+
docker:
125+
- image: circleci/node:12.22.1
126+
working_directory: ~/plotly.js
127+
steps:
128+
- attach_workspace:
129+
at: ~/
130+
- run:
131+
name: compare pixels
132+
command: ./.circleci/test.sh test-image ; find build -maxdepth 1 -type f -delete
97133
- store_artifacts:
98134
path: build
99135
destination: /
100136

101-
flaky-image:
137+
make-exports:
102138
docker:
103-
- image: plotly/testbed:latest
104-
working_directory: /var/www/streambed/image_server/plotly.js/
139+
- image: circleci/python:3.8.9
140+
working_directory: ~/plotly.js
105141
steps:
106142
- attach_workspace:
107-
at: /var/www/streambed/image_server/
143+
at: ~/
108144
- run:
109-
name: Run and setup container
110-
command: |
111-
supervisord &
112-
npm run docker -- setup
145+
name: which pip3 version
146+
command: which pip3 && pip3 --version
147+
- run:
148+
name: install kaleido v0.2.1
149+
command: python3 -m pip install kaleido==0.2.1
150+
- run:
151+
name: install plotly.io v5.0.0
152+
command: python3 -m pip install plotly==5.0.0
113153
- run:
114-
name: Run image tests (part B)
115-
command: ./.circleci/test.sh flaky-image ; find build -maxdepth 1 -type f -delete
154+
name: install poppler-utils to have pdftops for exporting eps
155+
command: sudo apt-get install poppler-utils
156+
- run:
157+
name: create svg, jpg, jpeg, webp, pdf and eps files
158+
command: python3 test/image/make_exports.py
159+
- persist_to_workspace:
160+
root: ~/
161+
paths:
162+
- plotly.js
163+
164+
test-exports:
165+
docker:
166+
- image: circleci/node:12.22.1
167+
working_directory: ~/plotly.js
168+
steps:
169+
- attach_workspace:
170+
at: ~/
171+
- run:
172+
name: test export sizes
173+
command: node test/image/export_test.js ; find build -maxdepth 1 -type f -delete
116174
- store_artifacts:
117175
path: build
118176
destination: /
@@ -234,15 +292,21 @@ workflows:
234292
- webgl-jasmine:
235293
requires:
236294
- install-and-cibuild
237-
- no-gl-flaky-jasmine:
295+
- flaky-no-gl-jasmine:
238296
requires:
239297
- install-and-cibuild
240-
- stable-image:
298+
- make-baselines:
241299
requires:
242300
- install-and-cibuild
243-
- flaky-image:
301+
- test-baselines:
302+
requires:
303+
- make-baselines
304+
- make-exports:
244305
requires:
245306
- install-and-cibuild
307+
- test-exports:
308+
requires:
309+
- make-exports
246310
- mock-validation:
247311
requires:
248312
- install-and-cibuild

.circleci/download_google_fonts.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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/eliheuer/dosis-vf/blob/master/fonts/static-fonts/',
15+
'Dosis',
16+
[
17+
'-Regular',
18+
'-Bold'
19+
]
20+
)
21+
22+
download(
23+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSansMono/',
24+
'NotoSansMono',
25+
[
26+
'-Regular',
27+
'-Bold'
28+
]
29+
)
30+
31+
download(
32+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSans/',
33+
'NotoSans',
34+
[
35+
'-Regular',
36+
'-Italic',
37+
'-Bold'
38+
]
39+
)
40+
41+
download(
42+
'https://github.com/googlefonts/noto-fonts/blob/main/hinted/ttf/NotoSerif/',
43+
'NotoSerif',
44+
[
45+
'-Regular',
46+
'-Italic',
47+
'-Bold',
48+
'-BoldItalic',
49+
]
50+
)
51+
52+
download(
53+
'https://github.com/google/fonts/blob/main/ofl/oldstandardtt/',
54+
'OldStandard',
55+
[
56+
'-Regular',
57+
'-Italic',
58+
'-Bold'
59+
]
60+
)
61+
62+
download(
63+
'https://github.com/google/fonts/blob/main/ofl/ptsansnarrow/',
64+
'PT_Sans-Narrow-Web',
65+
[
66+
'-Regular',
67+
'-Bold'
68+
]
69+
)
70+
71+
download(
72+
'https://github.com/impallari/Raleway/blob/master/fonts/v3.000%20Fontlab/TTF/',
73+
'Raleway',
74+
[
75+
'-Regular',
76+
'-Regular-Italic',
77+
'-Bold',
78+
'-Bold-Italic'
79+
]
80+
)
81+
82+
download(
83+
'https://github.com/googlefonts/roboto/blob/main/src/hinted/',
84+
'Roboto',
85+
[
86+
'-Regular',
87+
'-Italic',
88+
'-Bold',
89+
'-BoldItalic'
90+
]
91+
)
92+
93+
download(
94+
'https://github.com/expo/google-fonts/blob/master/font-packages/gravitas-one/',
95+
'GravitasOne',
96+
[
97+
'_400Regular'
98+
]
99+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

.circleci/test.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ case $1 in
6363
exit $EXIT_STATE
6464
;;
6565

66-
no-gl-flaky-jasmine)
66+
flaky-no-gl-jasmine)
6767
set_tz
6868

6969
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --limit=1 --tag=flaky | circleci tests split))
@@ -76,16 +76,14 @@ case $1 in
7676
exit $EXIT_STATE
7777
;;
7878

79-
stable-image)
80-
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | circleci tests split)
81-
npm run test-image -- $SUITE --filter --skip-flaky || EXIT_STATE=$?
79+
make-baselines)
80+
SUITE=$(find $ROOT/test/image/mocks/ -type f -printf "%f\n" | sed 's/\.json$//1' | circleci tests split)
81+
python3 test/image/make_baseline.py $SUITE || EXIT_STATE=$?
8282
exit $EXIT_STATE
8383
;;
8484

85-
flaky-image)
86-
MAX_AUTO_RETRY=5
87-
retry npm run test-image -- --just-flaky
88-
npm run test-export || EXIT_STATE=$?
85+
test-image)
86+
node test/image/compare_pixels_test.js || { tar -cvf build/baselines.tar build/test_images/*.png ; exit 1 ; } || EXIT_STATE=$?
8987
exit $EXIT_STATE
9088
;;
9189

BUILDING.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
# Building plotly.js
1+
# Alternative ways to require or build plotly.js
2+
Depending on your needs you may require/import one of [the distributed plotly.js packages](https://github.com/plotly/plotly.js/blob/master/dist/README.md) or [a plotly.js/lib index file](https://github.com/plotly/plotly.js/tree/master/lib) and integrate it into your application.
23

3-
The easiest way to bundle plotly.js into your application is to use one of the distributed plotly.js packages on npm. These distributed packages should just work with **any** build framework. That said, if you're looking to save a few bytes, read the section below corresponding to your building framework.
4+
The sections below provide additional info in respect to alternative building frameworks.
45

6+
## Browserify example
7+
8+
Given source file:
9+
```js
10+
// file: index.js
11+
var Plotly = require('plotly.js-dist-min');
12+
// ....
13+
```
14+
15+
then simply run
16+
17+
```sh
18+
browserify index.js > bundle.js
19+
```
20+
21+
---
522
## Webpack
623

724
For plotly.js to build with Webpack you will need to install [ify-loader@v1.1.0+](https://github.com/hughsk/ify-loader) and add it to your `webpack.config.json`. This adds Browserify transform compatibility to Webpack which is necessary for some plotly.js dependencies.
@@ -21,24 +38,7 @@ A repo that demonstrates how to build plotly.js with Webpack can be found [here]
2138
...
2239
```
2340

24-
## Browserify
25-
26-
Given source file:
27-
28-
```js
29-
// file: index.js
30-
31-
var Plotly = require('plotly.js');
32-
33-
// ....
34-
```
35-
36-
then simply run,
37-
38-
```
39-
browserify index.js > bundle.js
40-
```
41-
41+
---
4242
## Angular CLI
4343

4444
Since Angular uses webpack under the hood and doesn't allow easily to change it's webpack configuration, there is some work needed using a `custom-webpack` builder to get things going.
@@ -99,3 +99,4 @@ module.exports = {
9999

100100
It's important to set `projects.x.architect.build.builder` and `projects.x.architect.build.options.customWebpackConfig`.
101101
If you have more projects in your `angular.json` make sure to adjust their settings accordingly.
102+
---

0 commit comments

Comments
 (0)