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 | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 10 | 'core', |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 11 | 'depot_tools/gclient', |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 12 | 'infra', |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 13 | 'recipe_engine/context', |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 14 | 'recipe_engine/file', |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 15 | 'recipe_engine/path', |
| 16 | 'recipe_engine/properties', |
| 17 | 'recipe_engine/python', |
| 18 | 'recipe_engine/raw_io', |
| 19 | 'recipe_engine/step', |
Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 20 | 'run', |
Eric Boren | 7e97dc0 | 2017-02-02 09:02:37 -0500 | [diff] [blame] | 21 | 'vars', |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 22 | ] |
| 23 | |
| 24 | |
| 25 | TEST_BUILDERS = { |
| 26 | 'client.skia.compile': { |
| 27 | 'skiabot-linux-swarm-000': [ |
| 28 | 'Housekeeper-Nightly-RecreateSKPs_Canary', |
| 29 | 'Housekeeper-Weekly-RecreateSKPs', |
| 30 | ], |
| 31 | }, |
| 32 | } |
| 33 | |
| 34 | |
Ravi Mistry | badc137 | 2016-11-23 08:38:18 -0500 | [diff] [blame] | 35 | UPDATE_SKPS_GITCOOKIES_FILE = 'update_skps.git_cookies' |
Ravi Mistry | 9d3e162 | 2017-07-13 14:27:45 -0400 | [diff] [blame] | 36 | |
| 37 | UPDATE_SKPS_GITCOOKIES_GS_PATH = ( |
| 38 | 'gs://skia-buildbots/artifacts/server/.gitcookies_update-skps') |
| 39 | |
| 40 | |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 41 | def RunSteps(api): |
| 42 | # Check out Chrome. |
borenet | 1436a09 | 2016-08-03 08:23:10 -0700 | [diff] [blame] | 43 | api.core.setup() |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 44 | |
borenet | 1436a09 | 2016-08-03 08:23:10 -0700 | [diff] [blame] | 45 | src_dir = api.vars.checkout_root.join('src') |
borenet | b6aafe6 | 2016-08-02 07:02:52 -0700 | [diff] [blame] | 46 | out_dir = src_dir.join('out', 'Release') |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 47 | |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 48 | with api.context(cwd=src_dir): |
Eric Boren | e6b26ad | 2017-02-21 07:22:20 -0500 | [diff] [blame] | 49 | # Call GN. |
| 50 | platform = 'linux64' # This bot only runs on linux; don't bother checking. |
| 51 | gn = src_dir.join('buildtools', platform, 'gn') |
Eric Boren | 53262d0 | 2017-03-20 15:40:12 -0400 | [diff] [blame] | 52 | gn_env = {'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1', |
| 53 | 'GYP_GENERATORS': 'ninja'} |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 54 | with api.context(env=gn_env): |
Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 55 | api.run(api.step, 'GN', cmd=[gn, 'gen', out_dir]) |
Eric Boren | e6b26ad | 2017-02-21 07:22:20 -0500 | [diff] [blame] | 56 | |
| 57 | # Build Chrome. |
Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 58 | api.run(api.step, 'Build Chrome', cmd=['ninja', '-C', out_dir, 'chrome']) |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 59 | |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 60 | # Clean up the output dir. |
Ravi Mistry | 9bcca6a | 2016-11-21 16:06:19 -0500 | [diff] [blame] | 61 | output_dir = api.path['start_dir'].join('skp_output') |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 62 | if api.path.exists(output_dir): |
Eric Boren | 3e2ffd7 | 2017-06-16 13:10:22 -0400 | [diff] [blame] | 63 | api.run.rmtree(output_dir) |
Robert Iannucci | 8cd5041 | 2017-07-07 14:36:58 -0700 | [diff] [blame] | 64 | api.file.ensure_directory('makedirs skp_output', output_dir) |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 65 | |
| 66 | # Capture the SKPs. |
borenet | 1436a09 | 2016-08-03 08:23:10 -0700 | [diff] [blame] | 67 | asset_dir = api.vars.infrabots_dir.join('assets', 'skp') |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 68 | cmd = ['python', asset_dir.join('create.py'), |
| 69 | '--chrome_src_path', src_dir, |
| 70 | '--browser_executable', src_dir.join('out', 'Release', 'chrome'), |
| 71 | '--target_dir', output_dir] |
Ravi Mistry | 50cd9e9 | 2017-07-13 20:46:21 +0000 | [diff] [blame] | 72 | # TODO(rmistry): Uncomment the below after skbug.com/6797 is fixed. |
| 73 | # if 'Canary' not in api.properties['buildername']: |
| 74 | # cmd.append('--upload_to_partner_bucket') |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 75 | with api.context(cwd=api.vars.skia_dir): |
Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 76 | api.run(api.step, 'Recreate SKPs', cmd=cmd) |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 77 | |
| 78 | # Upload the SKPs. |
| 79 | if 'Canary' not in api.properties['buildername']: |
borenet | 09732a6 | 2016-10-24 06:36:30 -0700 | [diff] [blame] | 80 | api.infra.update_go_deps() |
Ravi Mistry | 9d3e162 | 2017-07-13 14:27:45 -0400 | [diff] [blame] | 81 | update_skps_gitcookies = api.path['start_dir'].join( |
| 82 | UPDATE_SKPS_GITCOOKIES_FILE) |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 83 | cmd = ['python', |
borenet | 1436a09 | 2016-08-03 08:23:10 -0700 | [diff] [blame] | 84 | api.vars.skia_dir.join('infra', 'bots', 'upload_skps.py'), |
Ravi Mistry | badc137 | 2016-11-23 08:38:18 -0500 | [diff] [blame] | 85 | '--target_dir', output_dir, |
| 86 | '--gitcookies', str(update_skps_gitcookies)] |
Ravi Mistry | edc4f3e | 2017-12-08 12:58:20 -0500 | [diff] [blame] | 87 | with api.infra.DownloadGitCookies( |
Ravi Mistry | 9d3e162 | 2017-07-13 14:27:45 -0400 | [diff] [blame] | 88 | UPDATE_SKPS_GITCOOKIES_GS_PATH, update_skps_gitcookies, api): |
Robert Iannucci | 297a7ef | 2017-05-12 19:09:38 -0700 | [diff] [blame] | 89 | with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env): |
Eric Boren | 81340c6 | 2017-04-17 10:29:04 -0400 | [diff] [blame] | 90 | api.run(api.step, 'Upload SKPs', cmd=cmd) |
borenet | 1ed2ae4 | 2016-07-26 11:52:17 -0700 | [diff] [blame] | 91 | |
| 92 | |
| 93 | def GenTests(api): |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 94 | builder = 'Housekeeper-Nightly-RecreateSKPs_Canary' |
| 95 | yield ( |
| 96 | api.test(builder) + |
| 97 | api.properties(buildername=builder, |
Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame] | 98 | repository='https://skia.googlesource.com/skia.git', |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 99 | revision='abc123', |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 100 | path_config='kitchen', |
| 101 | swarm_out_dir='[SWARM_OUT_DIR]') + |
Ravi Mistry | 9bcca6a | 2016-11-21 16:06:19 -0500 | [diff] [blame] | 102 | api.path.exists(api.path['start_dir'].join('skp_output')) |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 103 | ) |
| 104 | |
| 105 | builder = 'Housekeeper-Weekly-RecreateSKPs' |
| 106 | yield ( |
| 107 | api.test(builder) + |
| 108 | api.properties(buildername=builder, |
Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame] | 109 | repository='https://skia.googlesource.com/skia.git', |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 110 | revision='abc123', |
borenet | b2cf266 | 2016-10-24 08:40:26 -0700 | [diff] [blame] | 111 | path_config='kitchen', |
| 112 | swarm_out_dir='[SWARM_OUT_DIR]') + |
Ravi Mistry | 9d3e162 | 2017-07-13 14:27:45 -0400 | [diff] [blame] | 113 | api.path.exists(api.path['start_dir'].join('skp_output')) + |
| 114 | api.path.exists(api.path['start_dir'].join(UPDATE_SKPS_GITCOOKIES_FILE)) |
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 | ) |