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 api.step('git status', | 24 # git-cl wants us to be on a branch. |
25 cmd=['git', 'status'], | 25 branch = 'tmp_%s' % api.uuid.random() |
| 26 api.step('create git branch', |
| 27 cmd=['git', 'checkout', '-b', branch], |
26 cwd=api.vars.skia_dir) | 28 cwd=api.vars.skia_dir) |
| 29 try: |
| 30 api.step('git status', |
| 31 cmd=['git', 'status'], |
| 32 cwd=api.vars.skia_dir) |
27 | 33 |
28 depot_tools_path = api.depot_tools.package_repo_resource() | 34 depot_tools_path = api.depot_tools.package_repo_resource() |
29 script = depot_tools_path.join('presubmit_support.py') | 35 env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])} |
30 env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])} | 36 api.step('presubmit', |
31 # TODO(borenet): --upstream=HEAD^ is a hack to force presubmit_support to | 37 cmd=['git', 'cl', 'presubmit', '--force', '-v', '-v'], |
32 # find a diff. Otherwise, it quits early with: | 38 cwd=api.vars.skia_dir, |
33 # "Warning, no PRESUBMIT.py found." | 39 env=env) |
34 api.step('presubmit', | 40 finally: |
35 cmd=[script, '--commit', '--upstream=HEAD^', '-v', '-v'], | 41 api.step('git reset', |
36 cwd=api.vars.skia_dir, | 42 cmd=['git', 'reset', '--hard', 'origin/master'], |
37 env=env) | 43 cwd=api.vars.skia_dir) |
| 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 |
38 | 51 |
39 | 52 |
40 def GenTests(api): | 53 def GenTests(api): |
41 yield ( | 54 yield ( |
42 api.test('presubmit') + | 55 api.test('presubmit') + |
43 api.properties(buildername='Housekeeper-PerCommit-Presubmit', | 56 api.properties(buildername='Housekeeper-PerCommit-Presubmit', |
44 mastername='client.skia.fyi', | 57 mastername='client.skia.fyi', |
45 slavename='dummy-slave', | 58 slavename='dummy-slave', |
46 buildnumber=5, | 59 buildnumber=5, |
47 revision='abc123', | 60 revision='abc123', |
48 path_config='kitchen', | 61 path_config='kitchen', |
49 swarm_out_dir='[SWARM_OUT_DIR]') | 62 swarm_out_dir='[SWARM_OUT_DIR]') |
50 ) | 63 ) |
OLD | NEW |