blob: b41d56f3f6de94e82d9bd12c4f0395e57e512397 [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 Boren3e2ffd72017-06-16 13:10:22 -040010 'core',
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 Boren72f66682018-05-18 07:36:55 -040039 checkout_root = api.core.default_checkout_root
40 api.core.checkout_bot_update(checkout_root=checkout_root)
Eric Borenb7023162018-05-04 13:46:15 -040041 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
42 api.flavor.setup()
borenet1ed2ae42016-07-26 11:52:17 -070043
Eric Boren72f66682018-05-18 07:36:55 -040044 src_dir = checkout_root.join('src')
45 skia_dir = checkout_root.join('skia')
borenetb6aafe62016-08-02 07:02:52 -070046 out_dir = src_dir.join('out', 'Release')
borenet1ed2ae42016-07-26 11:52:17 -070047
Robert Iannucci297a7ef2017-05-12 19:09:38 -070048 with api.context(cwd=src_dir):
Eric Borene6b26ad2017-02-21 07:22:20 -050049 # Call GN.
50 platform = 'linux64' # This bot only runs on linux; don't bother checking.
51 gn = src_dir.join('buildtools', platform, 'gn')
Eric Boren53262d02017-03-20 15:40:12 -040052 gn_env = {'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1',
53 'GYP_GENERATORS': 'ninja'}
Robert Iannucci297a7ef2017-05-12 19:09:38 -070054 with api.context(env=gn_env):
Eric Boren81340c62017-04-17 10:29:04 -040055 api.run(api.step, 'GN', cmd=[gn, 'gen', out_dir])
Eric Borene6b26ad2017-02-21 07:22:20 -050056
57 # Build Chrome.
Eric Boren81340c62017-04-17 10:29:04 -040058 api.run(api.step, 'Build Chrome', cmd=['ninja', '-C', out_dir, 'chrome'])
borenet1ed2ae42016-07-26 11:52:17 -070059
borenet1ed2ae42016-07-26 11:52:17 -070060 # Clean up the output dir.
Ravi Mistry9bcca6a2016-11-21 16:06:19 -050061 output_dir = api.path['start_dir'].join('skp_output')
borenet1ed2ae42016-07-26 11:52:17 -070062 if api.path.exists(output_dir):
Eric Boren3e2ffd72017-06-16 13:10:22 -040063 api.run.rmtree(output_dir)
Robert Iannucci8cd50412017-07-07 14:36:58 -070064 api.file.ensure_directory('makedirs skp_output', output_dir)
borenet1ed2ae42016-07-26 11:52:17 -070065
66 # Capture the SKPs.
Eric Boren72f66682018-05-18 07:36:55 -040067 asset_dir = skia_dir.join('infra', 'bots', 'assets', 'skp')
borenet1ed2ae42016-07-26 11:52:17 -070068 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 Mistry50cd9e92017-07-13 20:46:21 +000072 # 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')
Eric Boren72f66682018-05-18 07:36:55 -040075 with api.context(cwd=skia_dir):
Eric Boren81340c62017-04-17 10:29:04 -040076 api.run(api.step, 'Recreate SKPs', cmd=cmd)
borenet1ed2ae42016-07-26 11:52:17 -070077
78 # Upload the SKPs.
79 if 'Canary' not in api.properties['buildername']:
borenet09732a62016-10-24 06:36:30 -070080 api.infra.update_go_deps()
borenet1ed2ae42016-07-26 11:52:17 -070081 cmd = ['python',
Eric Boren72f66682018-05-18 07:36:55 -040082 skia_dir.join('infra', 'bots', 'upload_skps.py'),
Eric Boren78179312018-04-23 08:35:45 -040083 '--target_dir', output_dir]
Eric Boren72f66682018-05-18 07:36:55 -040084 with api.context(cwd=skia_dir, env=api.infra.go_env):
Eric Boren78179312018-04-23 08:35:45 -040085 api.run(api.step, 'Upload SKPs', cmd=cmd)
borenet1ed2ae42016-07-26 11:52:17 -070086
87
88def GenTests(api):
borenetb2cf2662016-10-24 08:40:26 -070089 builder = 'Housekeeper-Nightly-RecreateSKPs_Canary'
90 yield (
91 api.test(builder) +
92 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -050093 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -070094 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -070095 path_config='kitchen',
96 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9bcca6a2016-11-21 16:06:19 -050097 api.path.exists(api.path['start_dir'].join('skp_output'))
borenetb2cf2662016-10-24 08:40:26 -070098 )
99
100 builder = 'Housekeeper-Weekly-RecreateSKPs'
101 yield (
102 api.test(builder) +
103 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -0500104 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700105 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700106 path_config='kitchen',
107 swarm_out_dir='[SWARM_OUT_DIR]') +
Eric Boren78179312018-04-23 08:35:45 -0400108 api.path.exists(api.path['start_dir'].join('skp_output'))
borenetb2cf2662016-10-24 08:40:26 -0700109 )
110
111 yield (
112 api.test('failed_upload') +
113 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -0500114 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700115 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700116 path_config='kitchen',
117 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500118 api.path.exists(api.path['start_dir'].join('skp_output')) +
borenetb2cf2662016-10-24 08:40:26 -0700119 api.step_data('Upload SKPs', retcode=1)
120 )