| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 1 | # Copyright 2014 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 | |
| 6 | """Recipe for the Skia RecreateSKPs Bot.""" |
| 7 | |
| 8 | |
| 9 | DEPS = [ |
| Eric Boren | 90f0503 | 2018-05-24 09:14:18 -0400 | [diff] [blame] | 10 | 'checkout', |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 11 | 'depot_tools/gclient', |
| Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 12 | 'flavor', |
| Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 13 | 'infra', |
| Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 14 | 'recipe_engine/context', |
| Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 15 | 'recipe_engine/file', |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 16 | 'recipe_engine/path', |
| 17 | 'recipe_engine/properties', |
| 18 | 'recipe_engine/python', |
| 19 | 'recipe_engine/raw_io', |
| 20 | 'recipe_engine/step', |
| Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 21 | 'run', |
| Eric Boren | 7e97dc0 | 2017-02-02 09:02:37 -0500 | [diff] [blame] | 22 | 'vars', |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 23 | ] |
| 24 | |
| 25 | |
| 26 | TEST_BUILDERS = { |
| 27 | 'client.skia.compile': { |
| 28 | 'skiabot-linux-swarm-000': [ |
| 29 | 'Housekeeper-Nightly-RecreateSKPs_Canary', |
| 30 | 'Housekeeper-Weekly-RecreateSKPs', |
| 31 | ], |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 36 | def RunSteps(api): |
| 37 | # Check out Chrome. |
| Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 38 | api.vars.setup() |
| Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 39 | |
| Eric Boren | 90f0503 | 2018-05-24 09:14:18 -0400 | [diff] [blame] | 40 | checkout_root = api.checkout.default_checkout_root |
| Eric Boren | 4184608 | 2018-05-30 14:36:03 -0400 | [diff] [blame] | 41 | extra_gclient_env = { |
| 42 | 'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1'} |
| 43 | api.checkout.bot_update( |
| 44 | checkout_root=checkout_root, |
| 45 | checkout_chromium=True, |
| 46 | extra_gclient_env=extra_gclient_env) |
| 47 | |
| Eric Boren | b702316 | 2018-05-04 13:46:15 -0400 | [diff] [blame] | 48 | api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) |
| 49 | api.flavor.setup() |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 50 | |
| Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 51 | src_dir = checkout_root.join('src') |
| 52 | skia_dir = checkout_root.join('skia') |
| borenet | b6aafe6 | 2016-08-02 07:02:52 -0700 | [diff] [blame] | 53 | out_dir = src_dir.join('out', 'Release') |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 54 | |
| Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 55 | with api.context(cwd=src_dir): |
| Eric Boren | e6b26ad | 2017-02-21 07:22:20 -0500 | [diff] [blame] | 56 | # Call GN. |
| 57 | platform = 'linux64' # This bot only runs on linux; don't bother checking. |
| 58 | gn = src_dir.join('buildtools', platform, 'gn') |
| Eric Boren | 53262d0 | 2017-03-20 15:40:12 -0400 | [diff] [blame] | 59 | gn_env = {'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1', |
| 60 | 'GYP_GENERATORS': 'ninja'} |
| Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 61 | with api.context(env=gn_env): |
| Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 62 | api.run(api.step, 'GN', cmd=[gn, 'gen', out_dir]) |
| Eric Boren | e6b26ad | 2017-02-21 07:22:20 -0500 | [diff] [blame] | 63 | |
| 64 | # Build Chrome. |
| Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 65 | api.run(api.step, 'Build Chrome', cmd=['ninja', '-C', out_dir, 'chrome']) |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 66 | |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 67 | # Clean up the output dir. |
| Ravi Mistry | 9bcca6a | 2016-11-21 16:06:19 -0500 | [diff] [blame] | 68 | output_dir = api.path['start_dir'].join('skp_output') |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 69 | if api.path.exists(output_dir): |
| Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 70 | api.run.rmtree(output_dir) |
| Robert Iannucci | 8cd5041 | 2017-07-07 14:36:58 -0700 | [diff] [blame] | 71 | api.file.ensure_directory('makedirs skp_output', output_dir) |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 72 | |
| 73 | # Capture the SKPs. |
| Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 74 | asset_dir = skia_dir.join('infra', 'bots', 'assets', 'skp') |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 75 | cmd = ['python', asset_dir.join('create.py'), |
| 76 | '--chrome_src_path', src_dir, |
| 77 | '--browser_executable', src_dir.join('out', 'Release', 'chrome'), |
| 78 | '--target_dir', output_dir] |
| Ravi Mistry | 2b1d179 | 2019-02-06 12:33:44 -0500 | [diff] [blame] | 79 | if 'Canary' not in api.properties['buildername']: |
| 80 | cmd.append('--upload_to_partner_bucket') |
| Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 81 | with api.context(cwd=skia_dir): |
| Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 82 | api.run(api.step, 'Recreate SKPs', cmd=cmd) |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 83 | |
| 84 | # Upload the SKPs. |
| 85 | if 'Canary' not in api.properties['buildername']: |
| 86 | cmd = ['python', |
| Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 87 | skia_dir.join('infra', 'bots', 'upload_skps.py'), |
| Eric Boren | d41c187 | 2019-01-25 12:05:59 -0500 | [diff] [blame] | 88 | '--target_dir', output_dir, |
| 89 | '--chromium_path', src_dir] |
| Eric Boren | 72f6668 | 2018-05-18 07:36:55 -0400 | [diff] [blame] | 90 | with api.context(cwd=skia_dir, env=api.infra.go_env): |
| Eric Boren | 7817931 | 2018-04-23 08:35:45 -0400 | [diff] [blame] | 91 | api.run(api.step, 'Upload SKPs', cmd=cmd) |
| borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 92 | |
| 93 | |
| 94 | def GenTests(api): |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 95 | builder = 'Housekeeper-Nightly-RecreateSKPs_Canary' |
| 96 | yield ( |
| 97 | api.test(builder) + |
| 98 | api.properties(buildername=builder, |
| Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame] | 99 | repository='https://skia.googlesource.com/skia.git', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 100 | revision='abc123', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 101 | path_config='kitchen', |
| 102 | swarm_out_dir='[SWARM_OUT_DIR]') + |
| Ravi Mistry | 9bcca6a | 2016-11-21 16:06:19 -0500 | [diff] [blame] | 103 | api.path.exists(api.path['start_dir'].join('skp_output')) |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 104 | ) |
| 105 | |
| 106 | builder = 'Housekeeper-Weekly-RecreateSKPs' |
| 107 | yield ( |
| 108 | api.test(builder) + |
| 109 | api.properties(buildername=builder, |
| Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame] | 110 | repository='https://skia.googlesource.com/skia.git', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 111 | revision='abc123', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 112 | path_config='kitchen', |
| 113 | swarm_out_dir='[SWARM_OUT_DIR]') + |
| Eric Boren | 7817931 | 2018-04-23 08:35:45 -0400 | [diff] [blame] | 114 | api.path.exists(api.path['start_dir'].join('skp_output')) |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 115 | ) |
| 116 | |
| 117 | yield ( |
| 118 | api.test('failed_upload') + |
| 119 | api.properties(buildername=builder, |
| Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame] | 120 | repository='https://skia.googlesource.com/skia.git', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 121 | revision='abc123', |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 122 | path_config='kitchen', |
| 123 | swarm_out_dir='[SWARM_OUT_DIR]') + |
| Ravi Mistry | 9bcca6a | 2016-11-21 16:06:19 -0500 | [diff] [blame] | 124 | api.path.exists(api.path['start_dir'].join('skp_output')) + |
| borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 125 | api.step_data('Upload SKPs', retcode=1) |
| 126 | ) |