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