2016-07-26 18:52:17 +00:00
|
|
|
# Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
"""Recipe for the Skia RecreateSKPs Bot."""
|
|
|
|
|
|
|
|
|
|
|
|
DEPS = [
|
2017-06-16 17:10:22 +00:00
|
|
|
'core',
|
2016-07-26 18:52:17 +00:00
|
|
|
'depot_tools/gclient',
|
2017-06-16 17:10:22 +00:00
|
|
|
'infra',
|
2017-05-13 02:09:38 +00:00
|
|
|
'recipe_engine/context',
|
2017-06-16 17:10:22 +00:00
|
|
|
'recipe_engine/file',
|
2016-07-26 18:52:17 +00:00
|
|
|
'recipe_engine/path',
|
|
|
|
'recipe_engine/properties',
|
|
|
|
'recipe_engine/python',
|
|
|
|
'recipe_engine/raw_io',
|
|
|
|
'recipe_engine/step',
|
2017-04-17 14:29:04 +00:00
|
|
|
'run',
|
2017-02-02 14:02:37 +00:00
|
|
|
'vars',
|
2016-07-26 18:52:17 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
TEST_BUILDERS = {
|
|
|
|
'client.skia.compile': {
|
|
|
|
'skiabot-linux-swarm-000': [
|
|
|
|
'Housekeeper-Nightly-RecreateSKPs_Canary',
|
|
|
|
'Housekeeper-Weekly-RecreateSKPs',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-23 13:38:18 +00:00
|
|
|
UPDATE_SKPS_GITCOOKIES_FILE = 'update_skps.git_cookies'
|
2017-07-13 18:27:45 +00:00
|
|
|
|
|
|
|
UPDATE_SKPS_GITCOOKIES_GS_PATH = (
|
|
|
|
'gs://skia-buildbots/artifacts/server/.gitcookies_update-skps')
|
|
|
|
|
|
|
|
|
|
|
|
class DownloadGitCookies(object):
|
|
|
|
"""Class to download gitcookies from GS."""
|
|
|
|
def __init__(self, gs_path, local_path, api):
|
|
|
|
self._gs_path = gs_path
|
|
|
|
self._local_path = local_path
|
|
|
|
self._api = api
|
|
|
|
|
|
|
|
def __enter__(self):
|
2017-09-25 13:20:40 +00:00
|
|
|
cmd = ['gsutil', 'cp', self._gs_path, self._local_path]
|
|
|
|
self._api.step('download gitcookies', cmd=cmd, infra_step=True)
|
2017-07-13 18:27:45 +00:00
|
|
|
|
|
|
|
def __exit__(self, exc_type, _value, _traceback):
|
|
|
|
if self._api.path.exists(self._local_path):
|
|
|
|
self._api.file.remove('remove %s' % self._local_path, self._local_path)
|
|
|
|
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def RunSteps(api):
|
|
|
|
# Check out Chrome.
|
2016-08-03 15:23:10 +00:00
|
|
|
api.core.setup()
|
2016-07-26 18:52:17 +00:00
|
|
|
|
2016-08-03 15:23:10 +00:00
|
|
|
src_dir = api.vars.checkout_root.join('src')
|
2016-08-02 14:02:52 +00:00
|
|
|
out_dir = src_dir.join('out', 'Release')
|
2016-07-26 18:52:17 +00:00
|
|
|
|
2017-05-13 02:09:38 +00:00
|
|
|
with api.context(cwd=src_dir):
|
2017-02-21 12:22:20 +00:00
|
|
|
# Call GN.
|
|
|
|
platform = 'linux64' # This bot only runs on linux; don't bother checking.
|
|
|
|
gn = src_dir.join('buildtools', platform, 'gn')
|
2017-03-20 19:40:12 +00:00
|
|
|
gn_env = {'CPPFLAGS': '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1',
|
|
|
|
'GYP_GENERATORS': 'ninja'}
|
2017-05-13 02:09:38 +00:00
|
|
|
with api.context(env=gn_env):
|
2017-04-17 14:29:04 +00:00
|
|
|
api.run(api.step, 'GN', cmd=[gn, 'gen', out_dir])
|
2017-02-21 12:22:20 +00:00
|
|
|
|
|
|
|
# Build Chrome.
|
2017-04-17 14:29:04 +00:00
|
|
|
api.run(api.step, 'Build Chrome', cmd=['ninja', '-C', out_dir, 'chrome'])
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
# Clean up the output dir.
|
2016-11-21 21:06:19 +00:00
|
|
|
output_dir = api.path['start_dir'].join('skp_output')
|
2016-07-26 18:52:17 +00:00
|
|
|
if api.path.exists(output_dir):
|
2017-06-16 17:10:22 +00:00
|
|
|
api.run.rmtree(output_dir)
|
2017-07-07 21:36:58 +00:00
|
|
|
api.file.ensure_directory('makedirs skp_output', output_dir)
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
# Capture the SKPs.
|
2016-08-03 15:23:10 +00:00
|
|
|
asset_dir = api.vars.infrabots_dir.join('assets', 'skp')
|
2016-07-26 18:52:17 +00:00
|
|
|
cmd = ['python', asset_dir.join('create.py'),
|
|
|
|
'--chrome_src_path', src_dir,
|
|
|
|
'--browser_executable', src_dir.join('out', 'Release', 'chrome'),
|
|
|
|
'--target_dir', output_dir]
|
2017-07-13 20:46:21 +00:00
|
|
|
# TODO(rmistry): Uncomment the below after skbug.com/6797 is fixed.
|
|
|
|
# if 'Canary' not in api.properties['buildername']:
|
|
|
|
# cmd.append('--upload_to_partner_bucket')
|
2017-05-13 02:09:38 +00:00
|
|
|
with api.context(cwd=api.vars.skia_dir):
|
2017-04-17 14:29:04 +00:00
|
|
|
api.run(api.step, 'Recreate SKPs', cmd=cmd)
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
# Upload the SKPs.
|
|
|
|
if 'Canary' not in api.properties['buildername']:
|
2016-10-24 13:36:30 +00:00
|
|
|
api.infra.update_go_deps()
|
2017-07-13 18:27:45 +00:00
|
|
|
update_skps_gitcookies = api.path['start_dir'].join(
|
|
|
|
UPDATE_SKPS_GITCOOKIES_FILE)
|
2016-07-26 18:52:17 +00:00
|
|
|
cmd = ['python',
|
2016-08-03 15:23:10 +00:00
|
|
|
api.vars.skia_dir.join('infra', 'bots', 'upload_skps.py'),
|
2016-11-23 13:38:18 +00:00
|
|
|
'--target_dir', output_dir,
|
|
|
|
'--gitcookies', str(update_skps_gitcookies)]
|
2017-07-13 18:27:45 +00:00
|
|
|
with DownloadGitCookies(
|
|
|
|
UPDATE_SKPS_GITCOOKIES_GS_PATH, update_skps_gitcookies, api):
|
2017-05-13 02:09:38 +00:00
|
|
|
with api.context(cwd=api.vars.skia_dir, env=api.infra.go_env):
|
2017-04-17 14:29:04 +00:00
|
|
|
api.run(api.step, 'Upload SKPs', cmd=cmd)
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GenTests(api):
|
2016-10-24 15:40:26 +00:00
|
|
|
builder = 'Housekeeper-Nightly-RecreateSKPs_Canary'
|
|
|
|
yield (
|
|
|
|
api.test(builder) +
|
|
|
|
api.properties(buildername=builder,
|
2017-01-17 19:35:06 +00:00
|
|
|
repository='https://skia.googlesource.com/skia.git',
|
2016-10-24 15:40:26 +00:00
|
|
|
revision='abc123',
|
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]') +
|
2016-11-21 21:06:19 +00:00
|
|
|
api.path.exists(api.path['start_dir'].join('skp_output'))
|
2016-10-24 15:40:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
builder = 'Housekeeper-Weekly-RecreateSKPs'
|
|
|
|
yield (
|
|
|
|
api.test(builder) +
|
|
|
|
api.properties(buildername=builder,
|
2017-01-17 19:35:06 +00:00
|
|
|
repository='https://skia.googlesource.com/skia.git',
|
2016-10-24 15:40:26 +00:00
|
|
|
revision='abc123',
|
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]') +
|
2017-07-13 18:27:45 +00:00
|
|
|
api.path.exists(api.path['start_dir'].join('skp_output')) +
|
|
|
|
api.path.exists(api.path['start_dir'].join(UPDATE_SKPS_GITCOOKIES_FILE))
|
2016-10-24 15:40:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
yield (
|
|
|
|
api.test('failed_upload') +
|
|
|
|
api.properties(buildername=builder,
|
2017-01-17 19:35:06 +00:00
|
|
|
repository='https://skia.googlesource.com/skia.git',
|
2016-10-24 15:40:26 +00:00
|
|
|
revision='abc123',
|
|
|
|
path_config='kitchen',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]') +
|
2016-11-21 21:06:19 +00:00
|
|
|
api.path.exists(api.path['start_dir'].join('skp_output')) +
|
2016-10-24 15:40:26 +00:00
|
|
|
api.step_data('Upload SKPs', retcode=1)
|
|
|
|
)
|