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(force=True) | 45 api.bot_update.ensure_checkout(force=True) |
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 api.step('skip checks', ['echo', 'no devtools file in patch']) |
iannucci
2016/09/08 17:21:26
result = api.step('skip checks', [...])
result.pre
chenwilliam
2016/09/08 17:36:06
Done.
| |
45 return | 49 return |
46 | 50 |
47 def get_devtools_path(*sub_paths): | 51 def get_devtools_path(*sub_paths): |
48 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') | 52 devtools_sub_path = ('third_party', 'WebKit', 'Source', 'devtools') |
49 joined_path = devtools_sub_path + sub_paths | 53 joined_path = devtools_sub_path + sub_paths |
50 return api.path['checkout'].join(*joined_path) | 54 return api.path['checkout'].join(*joined_path) |
51 | 55 |
52 devtools_path = get_devtools_path() | 56 devtools_path = get_devtools_path() |
53 node_path = get_devtools_path('scripts', 'buildbot', 'node.py') | 57 node_path = get_devtools_path('scripts', 'buildbot', 'node.py') |
54 npm_modules_checkout_path = get_devtools_path('npm_modules') | 58 npm_modules_checkout_path = get_devtools_path('npm_modules') |
55 eslint_path = get_devtools_path( | 59 eslint_path = get_devtools_path( |
56 'npm_modules', 'node_modules', '.bin', 'eslint') | 60 'npm_modules', 'node_modules', '.bin', 'eslint') |
57 | 61 |
58 api.python('install node.js and npm', node_path, ['--version']) | 62 api.python('install node.js and npm', node_path, ['--version']) |
59 | 63 |
60 # TODO(chenwilliam): instead of checkout here, add it as DEPS | 64 # TODO(chenwilliam): instead of checkout here, add it as DEPS |
61 api.git.checkout( | 65 api.git.checkout( |
62 url='https://chromium.googlesource.com/deps/third_party/npm_modules', | 66 url='https://chromium.googlesource.com/deps/third_party/npm_modules', |
63 ref='8451e3a3fae09eaa18ddeed0c069a8e2f0e3541c', | 67 ref='8451e3a3fae09eaa18ddeed0c069a8e2f0e3541c', |
64 dir_path=npm_modules_checkout_path) | 68 dir_path=npm_modules_checkout_path) |
65 | 69 |
66 eslint_args = [ | 70 eslint_args = [ |
67 eslint_path, '-c', 'front_end/.eslintrc.js', | 71 eslint_path, '-c', 'front_end/.eslintrc.js', |
68 '--ignore-path', 'front_end/.eslintignore', 'front_end' | 72 '--ignore-path', 'front_end/.eslintignore', 'front_end' |
69 ] | 73 ] |
70 api.python('run eslint', node_path, eslint_args, cwd=devtools_path) | 74 api.python('run eslint', node_path, eslint_args, cwd=devtools_path) |
71 | 75 |
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): | 76 def GenTests(api): |
83 for mastername, config in MASTERS.iteritems(): | 77 for mastername, config in MASTERS.iteritems(): |
84 yield ( | 78 if mastername.startswith('tryserver'): |
85 api.test(config['testname'] + '_main') + | 79 yield ( |
86 api.properties.generic( | 80 api.test(config['testname'] + '_no_devtools') + |
87 buildername=config['buildername'], | 81 api.properties.tryserver( |
88 mastername=mastername, | 82 buildername=config['buildername'], |
83 mastername=mastername, | |
84 ) | |
89 ) | 85 ) |
90 ) | 86 yield ( |
91 yield ( | 87 api.test(config['testname'] + '_with_devtools') + |
92 api.test(config['testname'] + '_tryserver_no_devtools') + | 88 api.properties.tryserver( |
93 tryserver_properties(api, mastername, config) | 89 buildername=config['buildername'], |
94 ) | 90 mastername=mastername, |
95 yield ( | 91 ) + |
96 api.test(config['testname'] + '_tryserver_with_devtools') + | 92 api.override_step_data( |
97 tryserver_properties(api, mastername, config) + | 93 'git diff to analyze patch', |
98 api.override_step_data( | 94 api.raw_io.stream_output( |
99 'git diff to analyze patch', | 95 'third_party/WebKit/Source/devtools/fake.js\n'), |
100 api.raw_io.stream_output( | 96 ) |
101 'third_party/WebKit/Source/devtools/fake.js\n') | |
102 ) | 97 ) |
103 ) | 98 else: |
99 yield ( | |
100 api.test(config['testname']) + | |
101 api.properties.generic( | |
102 buildername=config['buildername'], | |
103 mastername=mastername, | |
104 ) | |
105 ) | |
OLD | NEW |