82999c037e
This adds 2 docker containers (based on the ones used for PathKit added in https://skia-review.googlesource.com/c/skia/+/147042) which bundle Chrome and puppeteer to allow the lottiecap.js to be run anywhere. This adds a recipe (test_lottie_web.py) to drive the docker container and do a little bit of set-up (and a few docs/bug fixes discovered in the test_pathkit.py that it was based on). Additionally, this modifies lottiecap.js to support POSTing output to a running go server (again, the same as PathKit) which has the image data hashed and the metadata added to a large JSON output. This re-works driver.html to avoid re-loading the JSON object 25 times. The performance boost is important because, right now, the lottie files are processed individually. In a future CL, I want to address the two TODOs in lottie-web-aggregator.go Bug: skia:8108 Change-Id: I100c9ce23dcc5033a27287211cbf0db898960da9 Reviewed-on: https://skia-review.googlesource.com/149282 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Joe Gregorio <jcgregorio@google.com> Reviewed-by: Stephan Altmueller <stephana@google.com> |
||
---|---|---|
.. | ||
gold-lottie-web-puppeteer | ||
lottie-web-puppeteer | ||
lottiecap_gold.sh | ||
README.md |
Docker
Docker files to handle Gold + lottie-web integration
lottie-web-puppeteer
This image has Google Chrome, puppeteer, and a few other tools for automating web-browser tests.
This image is standalone and does not have any extra dependencies that make it Skia-exclusive.
It gets manually pushed anytime there's an update to the Dockerfile or relevant installed libraries.
docker build -t lottie-web-puppeteer ./lottie-web-puppeteer/
LOTTIE_VERSION="5.2.1_v1" # use v1, v2, etc for any re-spins of the container.
docker tag lottie-web-puppeteer gcr.io/skia-public/lottie-web-puppeteer:$LOTTIE_VERSION
docker push gcr.io/skia-public/lottie-web-puppeteer:$LOTTIE_VERSION
Of note, some versions (generally before Chrome 60) run out of space on /dev/shm when using the default Docker settings. To be safe, it is recommended to run the container with the flag --shm-size=2gb.
For testing the image locally, the following can be helpful:
docker build -t lottie-web-puppeteer ./lottie-web-puppeteer/
# Run bash in it to poke around and make sure things are properly installed
docker run -it --shm-size=2gb lottie-web-puppeteer /bin/bash
# Create a screenshot of a single .json file which will be put in
# $SKIA_ROOT/tools/lottiecap/docker_strip.png
docker run -it -v $SKIA_ROOT:/SRC -v ~/lottie-samples:/LOTTIE_FILES -w /SRC/tools/lottiecap lottie-web-puppeteer node /SRC/tools/lottiecap/lottiecap.js --input /LOTTIE_FILES/body_movin.json --lottie_player /usr/local/lib/node_modules/lottie-web/build/player/lottie.min.js --in_docker --output docker_strip.png
gold-lottie-web-puppeteer
This image has Google Chrome, puppeteer, and a few other tools for automating web-browser tests.
This image assumes the runner wants to collect the output images and JSON data specific to Skia Infra's Gold tool (image correctness).
It gets manually pushed anytime there's an update to the Dockerfile or relevant installed libraries.
# Run the following from $SKIA_ROOT/infra/pathkit
make gold-docker-image
LOTTIE_VERSION="5.2.1_v1" # use v1, v2, etc for any re-spins of the container.
docker tag gold-lottie-web-puppeteer gcr.io/skia-public/gold-lottie-web-puppeteer:$LOTTIE_VERSION
docker push gcr.io/skia-public/gold-lottie-web-puppeteer:$LOTTIE_VERSION
Of note, some versions (generally before Chrome 60) run out of space on /dev/shm when using the default Docker settings. To be safe, it is recommended to run the container with the flag --shm-size=2gb.
For testing the image locally, the following can be helpful:
# Run the following from $SKIA_ROOT/infra/pathkit
make gold-docker-image
docker run -it --shm-size=2gb gold-lottie-web-puppeteer /bin/bash
# Collect the gold output with the local source repo and *all* of the files
# from lottie-samples
mkdir -p -m 0777 /tmp/dockerout
docker run -v ~/lottie-samples:/LOTTIE_FILES -v $SKIA_ROOT:/SRC -v /tmp/dockerout:/OUT gold-lottie-web-puppeteer /SRC/infra/lottiecap/docker/lottiecap_gold.sh