blob: df30338a7dbfa38dc3707a28ac9057ca38a4ea2c [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 Boren3e2ffd72017-06-16 13:10:22 -040012 'infra',
Robert Iannucci297a7ef2017-05-12 19:09:38 -070013 'recipe_engine/context',
Eric Boren3e2ffd72017-06-16 13:10:22 -040014 'recipe_engine/file',
borenet1ed2ae42016-07-26 11:52:17 -070015 'recipe_engine/path',
16 'recipe_engine/properties',
17 'recipe_engine/python',
18 'recipe_engine/raw_io',
19 'recipe_engine/step',
Eric Boren81340c62017-04-17 10:29:04 -040020 'run',
Eric Boren7e97dc02017-02-02 09:02:37 -050021 'vars',
borenet1ed2ae42016-07-26 11:52:17 -070022]
23
24
25TEST_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 Mistrybadc1372016-11-23 08:38:18 -050035UPDATE_SKPS_GITCOOKIES_FILE = 'update_skps.git_cookies'
Ravi Mistry9d3e1622017-07-13 14:27:45 -040036
37UPDATE_SKPS_GITCOOKIES_GS_PATH = (
38 'gs://skia-buildbots/artifacts/server/.gitcookies_update-skps')
39
40
borenet1ed2ae42016-07-26 11:52:17 -070041def RunSteps(api):
42 # Check out Chrome.
borenet1436a092016-08-03 08:23:10 -070043 api.core.setup()
borenet1ed2ae42016-07-26 11:52:17 -070044
borenet1436a092016-08-03 08:23:10 -070045 src_dir = api.vars.checkout_root.join('src')
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.
borenet1436a092016-08-03 08:23:10 -070067 asset_dir = api.vars.infrabots_dir.join('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')
Robert Iannucci297a7ef2017-05-12 19:09:38 -070075 with api.context(cwd=api.vars.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()
Ravi Mistry9d3e1622017-07-13 14:27:45 -040081 update_skps_gitcookies = api.path['start_dir'].join(
82 UPDATE_SKPS_GITCOOKIES_FILE)
borenet1ed2ae42016-07-26 11:52:17 -070083 cmd = ['python',
borenet1436a092016-08-03 08:23:10 -070084 api.vars.skia_dir.join('infra', 'bots', 'upload_skps.py'),
Ravi Mistrybadc1372016-11-23 08:38:18 -050085 '--target_dir', output_dir,
86 '--gitcookies', str(update_skps_gitcookies)]
Ravi Mistryedc4f3e2017-12-08 12:58:20 -050087 with api.infra.DownloadGitCookies(
Ravi Mistry9d3e1622017-07-13 14:27:45 -040088 UPDATE_SKPS_GITCOOKIES_GS_PATH, update_skps_gitcookies, api):
Robert Iannucci297a7ef2017-05-12 19:09:38 -070089 with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env):
Eric Boren81340c62017-04-17 10:29:04 -040090 api.run(api.step, 'Upload SKPs', cmd=cmd)
borenet1ed2ae42016-07-26 11:52:17 -070091
92
93def GenTests(api):
borenetb2cf2662016-10-24 08:40:26 -070094 builder = 'Housekeeper-Nightly-RecreateSKPs_Canary'
95 yield (
96 api.test(builder) +
97 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -050098 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -070099 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700100 path_config='kitchen',
101 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9bcca6a2016-11-21 16:06:19 -0500102 api.path.exists(api.path['start_dir'].join('skp_output'))
borenetb2cf2662016-10-24 08:40:26 -0700103 )
104
105 builder = 'Housekeeper-Weekly-RecreateSKPs'
106 yield (
107 api.test(builder) +
108 api.properties(buildername=builder,
Eric Borenad29aee2017-01-17 14:35:06 -0500109 repository='https://skia.googlesource.com/skia.git',
borenetb2cf2662016-10-24 08:40:26 -0700110 revision='abc123',
borenetb2cf2662016-10-24 08:40:26 -0700111 path_config='kitchen',
112 swarm_out_dir='[SWARM_OUT_DIR]') +
Ravi Mistry9d3e1622017-07-13 14:27:45 -0400113 api.path.exists(api.path['start_dir'].join('skp_output')) +
114 api.path.exists(api.path['start_dir'].join(UPDATE_SKPS_GITCOOKIES_FILE))
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 )