aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipes/housekeeper.py
blob: f4c206a488e553fb38b625f1a711becd0a23fed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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 PerCommit Housekeeper.


import calendar


DEPS = [
  'depot_tools/bot_update',
  'recipe_engine/context',
  'recipe_engine/file',
  'recipe_engine/path',
  'recipe_engine/properties',
  'recipe_engine/python',
  'recipe_engine/step',
  'recipe_engine/time',
  'core',
  'run',
  'vars',
]


def RunSteps(api):
  # Checkout, compile, etc.
  api.core.setup()

  cwd = api.path['checkout']

  # TODO(borenet): Detect static initializers?

  with api.context(cwd=cwd):
    if not api.vars.is_trybot:
      api.run(
        api.step,
        'generate and upload doxygen',
        cmd=['python', api.core.resource('generate_and_upload_doxygen.py')],
        abort_on_failure=False)

    now = api.time.utcnow()
    ts = int(calendar.timegm(now.utctimetuple()))
    filename = 'nanobench_%s_%d.json' % (api.vars.got_revision, ts)
    dest_dir = api.vars.perf_data_dir
    dest_file = dest_dir + '/' + filename
    api.file.ensure_directory('makedirs perf_dir', dest_dir)
    cmd = ['python', api.core.resource('run_binary_size_analysis.py'),
           '--library', api.vars.skia_out.join('Release', 'libskia.so'),
           '--githash', api.properties['revision'],
           '--dest', dest_file]
    if api.vars.is_trybot:
      cmd.extend(['--issue_number', str(api.properties['patch_issue'])])
    api.run(
      api.step,
      'generate binary size data',
      cmd=cmd)


def GenTests(api):
  yield (
      api.test('Housekeeper-PerCommit') +
      api.properties(buildername='Housekeeper-PerCommit',
                     repository='https://skia.googlesource.com/skia.git',
                     revision='abc123',
                     path_config='kitchen',
                     swarm_out_dir='[SWARM_OUT_DIR]') +
      api.path.exists(api.path['start_dir'])
  )
  yield (
      api.test('Housekeeper-PerCommit-Trybot') +
      api.properties(buildername='Housekeeper-PerCommit',
                     repository='https://skia.googlesource.com/skia.git',
                     revision='abc123',
                     path_config='kitchen',
                     patch_storage='gerrit',
                     swarm_out_dir='[SWARM_OUT_DIR]') +
      api.properties.tryserver(
          buildername='Housekeeper-PerCommit',
          gerrit_project='skia',
          gerrit_url='https://skia-review.googlesource.com/',
      ) +
      api.path.exists(api.path['start_dir'])
  )