| 1 |
# Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 |
# Use of this source code is governed by a BSD-style license that can be |
| 3 |
# found in the LICENSE file. |
| 4 |
|
| 5 |
# Recipe which generates the Gold images for lottie-web using docker |
| 6 |
|
| 7 |
|
| 8 |
DEPS = [ |
| 9 |
'checkout', |
| 10 |
'docker', |
| 11 |
'env', |
| 12 |
'flavor', |
| 13 |
'gold_upload', |
| 14 |
'infra', |
| 15 |
'recipe_engine/file', |
| 16 |
'recipe_engine/path', |
| 17 |
'recipe_engine/properties', |
| 18 |
'recipe_engine/step', |
| 19 |
'run', |
| 20 |
'vars', |
| 21 |
] |
| 22 |
|
| 23 |
|
| 24 |
DOCKER_IMAGE = 'gcr.io/skia-public/gold-lottie-web-puppeteer:v2' |
| 25 |
LOTTIECAP_SCRIPT = 'skia/infra/lottiecap/docker/lottiecap_gold.sh' |
| 26 |
|
| 27 |
|
| 28 |
def RunSteps(api): |
| 29 |
api.vars.setup() |
| 30 |
api.flavor.setup("dm") |
| 31 |
checkout_root = api.path.start_dir |
| 32 |
out_dir = api.vars.swarming_out_dir |
| 33 |
lottie_files_src = api.vars.workdir.joinpath('lottie-samples') |
| 34 |
lottie_files_dir = '/tmp/lottie_files' |
| 35 |
# The lottie-web repo is DEP'd in. This links to its build directory |
| 36 |
# to make finding the lottie.min.js easier to reference from inside |
| 37 |
# the docker image. |
| 38 |
lottie_build = checkout_root.joinpath('lottie', 'build', 'player') |
| 39 |
|
| 40 |
# Make sure this exists, otherwise Docker will make it with root permissions. |
| 41 |
api.file.ensure_directory('mkdirs out_dir', out_dir, mode=0o777) |
| 42 |
# When lottie files are brought in via isolate or CIPD, they are just |
| 43 |
# symlinks, which does not work well with Docker because we can't mount |
| 44 |
# the folder as a volume. |
| 45 |
# e.g. /LOTTIE_FILES/foo.json -> ../.cipd/alpha/beta/foo.json |
| 46 |
# To get around this, we just copy the lottie files into a temporary |
| 47 |
# directory. |
| 48 |
api.file.rmtree('remove previous lottie files', lottie_files_dir) |
| 49 |
api.file.copytree('copy lottie files', lottie_files_src, lottie_files_dir) |
| 50 |
|
| 51 |
recursive_read = [lottie_build, lottie_files_dir] |
| 52 |
|
| 53 |
docker_args = [ |
| 54 |
'--mount', |
| 55 |
'type=bind,source=%s,target=/LOTTIE_BUILD' % lottie_build, |
| 56 |
'--mount', |
| 57 |
'type=bind,source=%s,target=/LOTTIE_FILES' % lottie_files_dir |
| 58 |
] |
| 59 |
|
| 60 |
args = [ |
| 61 |
'--builder', api.vars.builder_name, |
| 62 |
'--git_hash', api.properties['revision'], |
| 63 |
'--buildbucket_build_id', api.properties.get('buildbucket_build_id', |
| 64 |
''), |
| 65 |
'--bot_id', api.vars.swarming_bot_id, |
| 66 |
'--task_id', api.vars.swarming_task_id, |
| 67 |
'--browser', 'Chrome', |
| 68 |
'--config', api.vars.configuration, |
| 69 |
] |
| 70 |
|
| 71 |
if api.vars.is_trybot: |
| 72 |
args.extend([ |
| 73 |
'--issue', api.vars.issue, |
| 74 |
'--patchset', api.vars.patchset, |
| 75 |
'--patch_storage', api.vars.patch_storage, |
| 76 |
]) |
| 77 |
|
| 78 |
api.docker.run( |
| 79 |
name='Generate LottieWeb Gold output with Docker', |
| 80 |
docker_image=DOCKER_IMAGE, |
| 81 |
src_dir=checkout_root, |
| 82 |
out_dir=out_dir, |
| 83 |
script=checkout_root.joinpath(LOTTIECAP_SCRIPT), |
| 84 |
args=args, |
| 85 |
docker_args=docker_args, |
| 86 |
recursive_read=recursive_read, |
| 87 |
attempts=3, |
| 88 |
) |
| 89 |
|
| 90 |
api.gold_upload.upload() |
| 91 |
|
| 92 |
|
| 93 |
def GenTests(api): |
| 94 |
yield ( |
| 95 |
api.test('Test-Debian10-none-GCE-CPU-AVX2-x86_64-Debug-All-LottieWeb') + |
| 96 |
api.properties(buildername=('Test-Debian10-none-GCE-CPU-AVX2' |
| 97 |
'-x86_64-Debug-All-LottieWeb'), |
| 98 |
repository='https://skia.googlesource.com/skia.git', |
| 99 |
revision='abc123', |
| 100 |
gs_bucket='skia-infra-gm', |
| 101 |
path_config='kitchen', |
| 102 |
swarm_out_dir='[SWARM_OUT_DIR]') |
| 103 |
) |
| 104 |
|
| 105 |
yield ( |
| 106 |
api.test('lottie_web_trybot') + |
| 107 |
api.properties(buildername=('Test-Debian10-none-GCE-CPU-AVX2' |
| 108 |
'-x86_64-Debug-All-LottieWeb'), |
| 109 |
repository='https://skia.googlesource.com/skia.git', |
| 110 |
revision='abc123', |
| 111 |
gs_bucket='skia-infra-gm', |
| 112 |
path_config='kitchen', |
| 113 |
swarm_out_dir='[SWARM_OUT_DIR]', |
| 114 |
patch_ref='89/456789/12', |
| 115 |
patch_repo='https://skia.googlesource.com/skia.git', |
| 116 |
patch_storage='gerrit', |
| 117 |
patch_set=7, |
| 118 |
patch_issue=1234, |
| 119 |
gerrit_project='skia', |
| 120 |
gerrit_url='https://skia-review.googlesource.com/') |
| 121 |
) |