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 from recipe_engine.types import freeze | 5 from recipe_engine.types import freeze |
6 | 6 |
7 DEPS = [ | 7 DEPS = [ |
8 'chromium_checkout', | 8 'chromium_checkout', |
9 'depot_tools/bot_update', | 9 'depot_tools/bot_update', |
10 'depot_tools/gclient', | 10 'depot_tools/gclient', |
11 'depot_tools/git', | 11 'depot_tools/git', |
12 'depot_tools/tryserver', | 12 'depot_tools/tryserver', |
13 'recipe_engine/path', | 13 'recipe_engine/path', |
14 'recipe_engine/properties', | 14 'recipe_engine/properties', |
15 'recipe_engine/python', | 15 'recipe_engine/python', |
16 'recipe_engine/raw_io', | 16 'recipe_engine/raw_io', |
17 'recipe_engine/shutil', | 17 'recipe_engine/shutil', |
18 'recipe_engine/step', | 18 'recipe_engine/step', |
19 ] | 19 ] |
20 | 20 |
21 MASTERS = freeze({ | 21 MASTERS = freeze({ |
22 'chromium.fyi': { | 22 'chromium.fyi': { |
23 'buildername': 'Chromium DevTools Linux', | 23 'buildername': 'Chromium DevTools Linux', |
24 'testname': 'devtools_fyi', | 24 'testname': 'devtools_fyi', |
25 }, | 25 }, |
| 26 'tryserver.chromium.linux': { |
| 27 'buildername': 'chromium_devtools', |
| 28 'testname': 'devtools_tryserver', |
| 29 }, |
26 }) | 30 }) |
27 | 31 |
28 AFFECTED_PATHS = ( | 32 AFFECTED_PATHS = ( |
29 'third_party/WebKit/Source/devtools', | 33 'third_party/WebKit/Source/devtools', |
30 ) | 34 ) |
31 | 35 |
32 def should_skip_checks(api): | 36 def should_skip_checks(api): |
33 if not api.tryserver.is_tryserver: | 37 if not api.tryserver.is_tryserver: |
34 return False | 38 return False |
35 return all( | 39 return all( |
36 not filename.startswith(AFFECTED_PATHS) | 40 not filename.startswith(AFFECTED_PATHS) |
37 for filename in api.chromium_checkout.get_files_affected_by_patch()) | 41 for filename in api.chromium_checkout.get_files_affected_by_patch()) |
38 | 42 |
39 def RunSteps(api): | 43 def RunSteps(api): |
40 api.gclient.set_config('chromium') | 44 api.gclient.set_config('chromium') |
41 api.bot_update.ensure_checkout() | 45 api.bot_update.ensure_checkout() |
42 | 46 |
43 if should_skip_checks(api): | 47 if should_skip_checks(api): |
44 api.step('skip checks', ['echo', 'no devtools file in patch']) | 48 result = api.step('skip checks', ['echo', 'No devtools files in patch.']) |
| 49 result.presentation.step_text = "No devtools files in patch." |
45 return | 50 return |
46 | 51 |
47 def get_devtools_path(*sub_paths): | 52 def get_devtools_path(*sub_paths): |
48 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') | 53 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') |
49 joined_path = devtools_sub_path + sub_paths | 54 joined_path = devtools_sub_path + sub_paths |
50 return api.path['checkout'].join(*joined_path) | 55 return api.path['checkout'].join(*joined_path) |
51 | 56 |
52 devtools_path = get_devtools_path() | 57 devtools_path = get_devtools_path() |
53 node_path = get_devtools_path('scripts', 'buildbot', 'node.py') | 58 node_path = get_devtools_path('scripts', 'buildbot', 'node.py') |
54 npm_modules_checkout_path = get_devtools_path('npm_modules') | 59 npm_modules_checkout_path = get_devtools_path('npm_modules') |
55 eslint_path = get_devtools_path( | 60 eslint_path = get_devtools_path( |
56 'npm_modules', 'node_modules', '.bin', 'eslint') | 61 'npm_modules', 'node_modules', '.bin', 'eslint') |
57 | 62 |
58 api.python('install node.js and npm', node_path, ['--version']) | 63 api.python('install node.js and npm', node_path, ['--version']) |
59 | 64 |
60 # TODO(chenwilliam): instead of checkout here, add it as DEPS | 65 # TODO(chenwilliam): instead of checkout here, add it as DEPS |
61 api.git.checkout( | 66 api.git.checkout( |
62 url='https://chromium.googlesource.com/deps/third_party/npm_modules', | 67 url='https://chromium.googlesource.com/deps/third_party/npm_modules', |
63 ref='8451e3a3fae09eaa18ddeed0c069a8e2f0e3541c', | 68 ref='8451e3a3fae09eaa18ddeed0c069a8e2f0e3541c', |
64 dir_path=npm_modules_checkout_path) | 69 dir_path=npm_modules_checkout_path) |
65 | 70 |
66 eslint_args = [ | 71 eslint_args = [ |
67 eslint_path, '-c', 'front_end/.eslintrc.js', | 72 eslint_path, '-c', 'front_end/.eslintrc.js', |
68 '--ignore-path', 'front_end/.eslintignore', 'front_end' | 73 '--ignore-path', 'front_end/.eslintignore', 'front_end' |
69 ] | 74 ] |
70 api.python('run eslint', node_path, eslint_args, cwd=devtools_path) | 75 api.python('run eslint', node_path, eslint_args, cwd=devtools_path) |
71 | 76 |
72 | |
73 def tryserver_properties(api, mastername, config): | |
74 return api.properties.generic( | |
75 buildername=config['buildername'], | |
76 mastername=mastername, | |
77 rietveld='https://rietveld.example.com', | |
78 issue=1, | |
79 patchset=2, | |
80 ) | |
81 | |
82 def GenTests(api): | 77 def GenTests(api): |
83 for mastername, config in MASTERS.iteritems(): | 78 for mastername, config in MASTERS.iteritems(): |
84 yield ( | 79 if mastername.startswith('tryserver'): |
85 api.test(config['testname'] + '_main') + | 80 yield ( |
86 api.properties.generic( | 81 api.test(config['testname'] + '_no_devtools') + |
87 buildername=config['buildername'], | 82 api.properties.tryserver( |
88 mastername=mastername, | 83 buildername=config['buildername'], |
| 84 mastername=mastername, |
| 85 ) |
89 ) | 86 ) |
90 ) | 87 yield ( |
91 yield ( | 88 api.test(config['testname'] + '_with_devtools') + |
92 api.test(config['testname'] + '_tryserver_no_devtools') + | 89 api.properties.tryserver( |
93 tryserver_properties(api, mastername, config) | 90 buildername=config['buildername'], |
94 ) | 91 mastername=mastername, |
95 yield ( | 92 ) + |
96 api.test(config['testname'] + '_tryserver_with_devtools') + | 93 api.override_step_data( |
97 tryserver_properties(api, mastername, config) + | 94 'git diff to analyze patch', |
98 api.override_step_data( | 95 api.raw_io.stream_output( |
99 'git diff to analyze patch', | 96 'third_party/WebKit/Source/devtools/fake.js\n'), |
100 api.raw_io.stream_output( | 97 ) |
101 'third_party/WebKit/Source/devtools/fake.js\n') | |
102 ) | 98 ) |
103 ) | 99 else: |
| 100 yield ( |
| 101 api.test(config['testname']) + |
| 102 api.properties.generic( |
| 103 buildername=config['buildername'], |
| 104 mastername=mastername, |
| 105 ) |
| 106 ) |
OLD | NEW |