Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
upload_buildstats_results.py
Go to the documentation of this file.
1# Copyright 2016 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 uploading buildstats results to Perf.
7
8PYTHON_VERSION_COMPATIBILITY = "PY3"
9
10DEPS = [
11 'recipe_engine/context',
12 'recipe_engine/file',
13 'recipe_engine/path',
14 'recipe_engine/properties',
15 'recipe_engine/step',
16 'recipe_engine/time',
17 'vars',
18]
19
20
21def RunSteps(api):
22 # Upload the buildstats results.
23 api.vars.setup()
24
25 now = api.time.utcnow()
26 src_path = api.path['start_dir'].join('perf')
27 with api.context(cwd=src_path):
28 results = api.file.glob_paths(
29 'find results',
30 src_path,
31 '*.json',
32 test_data=['buildstats_abc123.json', 'buildstats_def.json'])
33 if not len(results): # pragma: nocover
34 raise Exception('Unable to find buildstats JSON file!')
35
36 for src in results:
37 basename = api.path.basename(src)
38 basename = api.properties['revision'] + '_' + basename
39 gs_path = '/'.join((
40 'buildstats-json-v1', str(now.year).zfill(4),
41 str(now.month).zfill(2), str(now.day).zfill(2), str(now.hour).zfill(2),
42 api.vars.builder_name))
43
44 if api.vars.is_trybot:
45 gs_path = '/'.join(('trybot', gs_path,
46 str(api.vars.issue), str(api.vars.patchset)))
47
48 dst = '/'.join((
49 'gs://%s' % api.properties['gs_bucket'], gs_path, basename))
50
51 api.step(
52 'upload %s' % src,
53 cmd=['gsutil', 'cp', '-z', 'json', src, dst],
54 infra_step=True)
55
56
57def GenTests(api):
58 builder = 'BuildStats-Debian10-EMCC-wasm-Release-PathKit'
59 yield (
60 api.test('normal_bot') +
61 api.properties(buildername=builder,
62 gs_bucket='skia-perf',
63 revision='abc123',
64 path_config='kitchen')
65 )
66
67 yield (
68 api.test('trybot') +
69 api.properties.tryserver(
70 gerrit_project='skia',
71 gerrit_url='https://skia-review.googlesource.com/',
72 ) +
73 api.properties(buildername=builder,
74 gs_bucket='skia-perf',
75 revision='abc123',
76 path_config='kitchen')
77 )