OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 # Recipe which runs the Skia presubmit. | 6 # Recipe which runs the Skia presubmit. |
7 | 7 |
8 | 8 |
9 DEPS = [ | 9 DEPS = [ |
10 'core', | 10 'core', |
11 'depot_tools/depot_tools', | 11 'depot_tools/depot_tools', |
12 'recipe_engine/path', | 12 'recipe_engine/path', |
13 'recipe_engine/properties', | 13 'recipe_engine/properties', |
14 'recipe_engine/step', | 14 'recipe_engine/step', |
15 'recipe_engine/uuid', | 15 'recipe_engine/uuid', |
16 'vars', | 16 'vars', |
17 ] | 17 ] |
18 | 18 |
19 | 19 |
20 def RunSteps(api): | 20 def RunSteps(api): |
21 api.vars.setup() | 21 api.vars.setup() |
22 api.core.checkout_steps() | 22 api.core.checkout_steps() |
23 | 23 |
24 # git-cl wants us to be on a branch. | 24 api.step('git status', |
25 branch = 'tmp_%s' % api.uuid.random() | 25 cmd=['git', 'status'], |
26 api.step('create git branch', | |
27 cmd=['git', 'checkout', '-b', branch], | |
28 cwd=api.vars.skia_dir) | 26 cwd=api.vars.skia_dir) |
29 try: | |
30 api.step('git status', | |
31 cmd=['git', 'status'], | |
32 cwd=api.vars.skia_dir) | |
33 | 27 |
34 depot_tools_path = api.depot_tools.package_repo_resource() | 28 depot_tools_path = api.depot_tools.package_repo_resource() |
35 env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])} | 29 script = depot_tools_path.join('presubmit_support.py') |
36 api.step('presubmit', | 30 env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])} |
37 cmd=['git', 'cl', 'presubmit', '--force', '-v', '-v'], | 31 # TODO(borenet): --upstream=HEAD^ is a hack to force presubmit_support to |
38 cwd=api.vars.skia_dir, | 32 # find a diff. Otherwise, it quits early with: |
39 env=env) | 33 # "Warning, no PRESUBMIT.py found." |
40 finally: | 34 api.step('presubmit', |
41 api.step('git reset', | 35 cmd=[script, '--commit', '--upstream=HEAD^', '-v', '-v'], |
42 cmd=['git', 'reset', '--hard', 'origin/master'], | 36 cwd=api.vars.skia_dir, |
43 cwd=api.vars.skia_dir) | 37 env=env) |
44 api.step('checkout origin/master', | |
45 cmd=['git', 'checkout', 'origin/master'], | |
46 cwd=api.vars.skia_dir) | |
47 api.step('delete git branch', | |
48 cmd=['git', 'branch', '-D', branch], | |
49 cwd=api.vars.skia_dir) | |
50 | |
51 | 38 |
52 | 39 |
53 def GenTests(api): | 40 def GenTests(api): |
54 yield ( | 41 yield ( |
55 api.test('presubmit') + | 42 api.test('presubmit') + |
56 api.properties(buildername='Housekeeper-PerCommit-Presubmit', | 43 api.properties(buildername='Housekeeper-PerCommit-Presubmit', |
57 mastername='client.skia.fyi', | 44 mastername='client.skia.fyi', |
58 slavename='dummy-slave', | 45 slavename='dummy-slave', |
59 buildnumber=5, | 46 buildnumber=5, |
60 revision='abc123', | 47 revision='abc123', |
61 path_config='kitchen', | 48 path_config='kitchen', |
62 swarm_out_dir='[SWARM_OUT_DIR]') | 49 swarm_out_dir='[SWARM_OUT_DIR]') |
63 ) | 50 ) |
OLD | NEW |