blob: c4000ab1196a73202c47ccb9a763809d97de7bdc [file] [log] [blame]
borenet1ed2ae42016-07-26 11:52:17 -07001# 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
9DEPS = [
Eric Boren90f05032018-05-24 09:14:18 -040010 'checkout',
borenet1ed2ae42016-07-26 11:52:17 -070011 'depot_tools/gclient',
Eric Borenb7023162018-05-04 13:46:15 -040012 'flavor',
Eric Boren3e2ffd72017-06-16 13:10:22 -040013 'infra',
Robert Iannucci297a7ef2017-05-12 19:09:38 -070014 'recipe_engine/context',
Eric Boren3e2ffd72017-06-16 13:10:22 -040015 'recipe_engine/file',
borenet1ed2ae42016-07-26 11:52:17 -070016 'recipe_engine/path',
17 'recipe_engine/properties',
18 'recipe_engine/python',
19 'recipe_engine/raw_io',
20 'recipe_engine/step',
Eric Boren81340c62017-04-17 10:29:04 -040021 'run',
Eric Boren7e97dc02017-02-02 09:02:37 -050022 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070023]
24
25
26TEST_BUILDERS = {
27 'client.skia.compile': {
28 'skiabot-linux-swarm-000': [
29 'Housekeeper-Nightly-RecreateSKPs_Canary',
30 'Housekeeper-Weekly-RecreateSKPs',
31 ],
32 },
33}
34
35
borenet1ed2ae42016-07-26 11:52:17 -070036def RunSteps(api):
37 # Check out Chrome.
Eric Borenb7023162018-05-04 13:46:15 -040038 api.vars.setup()
Eric Boren41846082018-05-30 14:36:03 -040039
Eric Boren90f05032018-05-24 09:14:18 -040040 checkout_root = api.checkout.default_checkout_root
Eric Boren41846082018-05-30 14:36:03 -040041 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 Borenb7023162018-05-04 13:46:15 -040048 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
49 api.flavor.setup()
borenet1ed2ae42016-07-26 11:52:17 -070050
Eric Boren72f66682018-05-18 07:36:55 -040051 src_dir = checkout_root.join('src')
52 skia_dir = checkout_root.join('skia')
borenetb6aafe62016-08-02 07:02:52 -070053 out_dir = src_dir.join('out', 'Release')
borenet1ed2ae42016-07-26 11:52:17 -070054
Robert Iannucci297a7ef2017-05-12 19:09:38 -070055 with api.context(cwd=src_dir):
Eric Borene6b26ad2017-02-21 07:22:20 -050056 # Call GN.
57 platform = 'linux64' # This bot only runs on linux; don't bother checking.
58 gn = src_dir.join('buildtools', platform, 'gn')
Eric Boren53262d02017-03-20 15:40:12 -040059 gn_env = {'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1',
60 'GYP_GENERATORS': 'ninja'}
Robert Iannucci297a7ef2017-05-12 19:09:38 -070061 with api.context(env=gn_env):
Eric Boren81340c62017-04-17 10:29:04 -040062 api.run(api.step, 'GN', cmd=[gn, 'gen', out_dir])
Eric Borene6b26ad2017-02-21 07:22:20 -050063
64 # Build Chrome.
Eric Boren81340c62017-04-17 10:29:04 -040065 api.run(api.step, 'Build Chrome', cmd=['ninja', '-C', out_dir, 'chrome'])
borenet1ed2ae42016-07-26 11:52:17 -070066
borenet1ed2ae42016-07-26 11:52:17 -070067 # Clean up the output dir.
Ravi Mistry9bcca6a2016-11-21 16:06:19 -050068 output_dir = api.path['start_dir'].join('skp_output')
borenet1ed2ae42016-07-26 11:52:17 -070069 if api.path.exists(output_dir):
Eric Boren3e2ffd72017-06-16 13:10:22 -040070 api.run.rmtree(output_dir)
Robert Iannucci8cd50412017-07-07 14:36:58 -070071 api.file.ensure_directory('makedirs skp_output', output_dir)
borenet1ed2ae42016-07-26 11:52:17 -070072
73 # Capture the SKPs.
Eric Boren72f66682018-05-18 07:36:55 -040074 asset_dir = skia_dir.join('infra', 'bots', 'assets', 'skp')
borenet1ed2ae42016-07-26 11:52:17 -070075 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 Mistry2b1d1792019-02-06 12:33:44 -050079 if 'Canary' not in api.properties['buildername']:
80 cmd.append('--upload_to_partner_bucket')
Eric Boren72f66682018-05-18 07:36:55 -040081 with api.context(cwd=skia_dir):
Eric Boren81340c62017-04-17 10:29:04 -040082 api.run(api.step, 'Recreate SKPs', cmd=cmd)
borenet1ed2ae42016-07-26 11:52:17 -070083
84 # Upload the SKPs.
85 if 'Canary' not in api.properties['buildername']:
86 cmd = ['python',
Eric Boren72f66682018-05-18 07:36:55 -040087 skia_dir.join('infra', 'bots', 'upload_skps.py'),
Eric Borend41c1872019-01-25 12:05:59 -050088 '--target_dir', output_dir,
89 '--chromium_path', src_dir]
Eric Boren72f66682018-05-18 07:36:55 -040090 with api.context(cwd=skia_dir, env=api.infra.go_env):
Eric Boren78179312018-04-23 08:35:45 -040091 api.run(api.step, 'Upload SKPs', cmd=cmd)
borenet1ed2ae42016-07-26 11:52:17 -070092
93
94def GenTests(api):
borenetb2cf2662016-10-24 08:40:26 -070095 builder = 'Housekeeper-Nightly-RecreateSKPs_Canary'
96 yield (
97 api.test(builder) +
98 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -050099 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700100 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700101 path_config='kitchen',
102 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500103 api.path.exists(api.path['start_dir'].join('skp_output'))
borenetb2cf2662016-10-24 08:40:26 -0700104 )
105
106 builder = 'Housekeeper-Weekly-RecreateSKPs'
107 yield (
108 api.test(builder) +
109 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -0500110 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700111 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700112 path_config='kitchen',
113 swarm_out_dir='[SWARM_OUT_DIR]') +
Eric Boren78179312018-04-23 08:35:45 -0400114 api.path.exists(api.path['start_dir'].join('skp_output'))
borenetb2cf2662016-10-24 08:40:26 -0700115 )
116
117 yield (
118 api.test('failed_upload') +
119 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -0500120 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700121 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700122 path_config='kitchen',
123 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500124 api.path.exists(api.path['start_dir'].join('skp_output')) +
borenetb2cf2662016-10-24 08:40:26 -0700125 api.step_data('Upload SKPs', retcode=1)
126 )