From 4fac59905727f210bd4f55ddf7e689920caffaf2 Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 30 Jun 2021 18:50:29 -0400 Subject: [PATCH 1/2] improve CONTRIBUTING guidelines for image-test --- .circleci/env_image.sh | 2 ++ CONTRIBUTING.md | 41 ++++++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.circleci/env_image.sh b/.circleci/env_image.sh index 7d371a7925e..fbc6e2c49c7 100755 --- a/.circleci/env_image.sh +++ b/.circleci/env_image.sh @@ -1,6 +1,8 @@ #!/bin/sh +# install required fonts sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji && \ sudo python3 .circleci/download_google_fonts.py && \ sudo cp -r .circleci/fonts/ /usr/share/ && \ sudo fc-cache -f && \ +# install kaleido & plotly sudo python3 -m pip install kaleido==0.2.1 plotly==5.1.0 --progress-bar off diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee871a84a53..a68704a4f33 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -207,17 +207,40 @@ npm run test-jasmine -- --help npm run test-jasmine -- --info ``` -### Draft new baseline -Install fonts and tools +### Draft new baselines +#### With docker: +> If you prefer using docker each time you need to +```sh +docker run -it -v "$(pwd)":/plotly.js circleci/python:3.8.9 bash +# then inside the docker +cd plotly.js +sudo bash .circleci/env_image.sh +``` + +#### Without docker: +> Otherwise you may need to install `python 3.8` +Then upgrade `pip` if needed ```sh -# install required fonts (if missing) on ubuntu -sudo cp -r .circleci/fonts/ /usr/share/ && sudo fc-cache -f -# upgrade pip (if needed) python3 -m pip install --upgrade pip -# install kaleido -python3 -m pip install kaleido -# install plotly -python3 -m pip install plotly +``` + +To install required fonts and tools see this [shell script](https://github.com/plotly/plotly.js/blob/master/.circleci/env_image.sh). + +#### Scrpits to generate/update new baselines with/without docker: +```sh +python3 test/image/make_baseline.py = mock_1 mock_2 +``` + +> Alternatively using npm & node.js (which are not available in the python docker by default) + +```sh +npm run baseline mock_1 mock_2 +``` + +Or + +```sh +npm run baseline mock_* ``` **IMPORTANT:** the `baseline`, `test-image` and `test-export` scripts do **not** bundle the source files before From ec020ecbd6440f13bbf88158e6e322dfd6fd5591 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com> Date: Wed, 7 Jul 2021 10:34:06 -0400 Subject: [PATCH 2/2] Update CONTRIBUTING.md Co-authored-by: Alex Johnson --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a68704a4f33..3869d831383 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -226,7 +226,7 @@ python3 -m pip install --upgrade pip To install required fonts and tools see this [shell script](https://github.com/plotly/plotly.js/blob/master/.circleci/env_image.sh). -#### Scrpits to generate/update new baselines with/without docker: +#### Scripts to generate/update new baselines with/without docker: ```sh python3 test/image/make_baseline.py = mock_1 mock_2 ```