borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 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 which runs the Skia presubmit. |
| 7 | |
| 8 | |
| 9 | DEPS = [ |
borenet | 3493e17 | 2016-10-05 07:29:06 -0700 | [diff] [blame] | 10 | 'depot_tools/depot_tools', |
| 11 | 'recipe_engine/path', |
borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 12 | 'recipe_engine/properties', |
| 13 | 'recipe_engine/step', |
borenet | 3493e17 | 2016-10-05 07:29:06 -0700 | [diff] [blame] | 14 | 'recipe_engine/uuid', |
Eric Boren | 6441a46 | 2017-01-13 13:37:53 -0500 | [diff] [blame] | 15 | 'skia-recipes/core', |
| 16 | 'skia-recipes/vars', |
borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 17 | ] |
| 18 | |
| 19 | |
| 20 | def RunSteps(api): |
| 21 | api.vars.setup() |
| 22 | api.core.checkout_steps() |
borenet | 3493e17 | 2016-10-05 07:29:06 -0700 | [diff] [blame] | 23 | |
borenet | cd72afa | 2016-10-14 10:11:44 -0700 | [diff] [blame] | 24 | # git-cl wants us to be on a branch. |
| 25 | branch = 'tmp_%s' % api.uuid.random() |
| 26 | api.step('create git branch', |
| 27 | cmd=['git', 'checkout', '-b', branch], |
borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 28 | cwd=api.vars.skia_dir) |
borenet | cd72afa | 2016-10-14 10:11:44 -0700 | [diff] [blame] | 29 | try: |
| 30 | api.step('git status', |
| 31 | cmd=['git', 'status'], |
| 32 | cwd=api.vars.skia_dir) |
borenet | 3493e17 | 2016-10-05 07:29:06 -0700 | [diff] [blame] | 33 | |
borenet | cd72afa | 2016-10-14 10:11:44 -0700 | [diff] [blame] | 34 | depot_tools_path = api.depot_tools.package_repo_resource() |
| 35 | env = {'PATH': api.path.pathsep.join([str(depot_tools_path), '%(PATH)s'])} |
| 36 | api.step('presubmit', |
| 37 | cmd=['git', 'cl', 'presubmit', '--force', '-v', '-v'], |
| 38 | cwd=api.vars.skia_dir, |
| 39 | env=env) |
| 40 | finally: |
| 41 | api.step('git reset', |
| 42 | cmd=['git', 'reset', '--hard', 'origin/master'], |
| 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 | |
borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 51 | |
| 52 | |
| 53 | def GenTests(api): |
| 54 | yield ( |
| 55 | api.test('presubmit') + |
| 56 | api.properties(buildername='Housekeeper-PerCommit-Presubmit', |
| 57 | mastername='client.skia.fyi', |
| 58 | slavename='dummy-slave', |
| 59 | buildnumber=5, |
Eric Boren | ad29aee | 2017-01-17 14:35:06 -0500 | [diff] [blame^] | 60 | repository='https://skia.googlesource.com/skia.git', |
borenet | 93408df | 2016-10-05 06:00:26 -0700 | [diff] [blame] | 61 | revision='abc123', |
| 62 | path_config='kitchen', |
| 63 | swarm_out_dir='[SWARM_OUT_DIR]') |
| 64 | ) |