• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2018 Google LLC
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# This assumes it is being run inside a docker container of gold-karma-chrome-tests
8# and a Skia checkout has been mounted at /SRC, the output directory
9# is mounted at /OUT, and any lottie json files are in a folder and mounted
10# at /LOTTIE_FILES.
11
12# For example:
13# docker run -v ~/lottie-samples:/LOTTIE_FILES -v $LOTTIE_ROOT/build/player:/LOTTIE_BUILD -v $SKIA_ROOT:/SRC -v /tmp/dockerout:/OUT gcr.io/skia-public/gold-lottie-web-puppeteer:v2 /SRC/infra/lottiecap/docker/lottiecap_gold.sh
14
15set -ex
16
17#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/lottiecap/docker)
18BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
19LOTTIECAP_DIR=$BASE_DIR/../../../tools/lottiecap
20
21# Start the aggregator in the background
22/opt/gold-aggregator $@ &
23
24cd $LOTTIECAP_DIR
25
26# lottie files may have spaces in their names, so a naive bash for loop
27# did not work here.
28find /LOTTIE_FILES -not -path /LOTTIE_FILES -exec \
29    node ./lottiecap.js --port 8082 \
30            --lottie_player /LOTTIE_BUILD/lottie.min.js \
31            --in_docker \
32            --post_to http://localhost:8081/report_gold_data \
33            --input {} \;
34
35
36# Tell the aggregator to dump the json
37# This curl command gets the HTTP code and stores it into $CODE
38CODE=`curl -s -o /dev/null -I -w "%{http_code}" -X POST localhost:8081/dump_json`
39if [ $CODE -ne 200 ]; then
40    # If we don't get 200 back, something is wrong with writing to disk, so exit with error
41    exit 1
42fi
43