Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: third_party/grpc/tools/run_tests/package_targets.py

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python2.7
2 # Copyright 2016, Google Inc.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 """Definition of targets to build distribution packages."""
32
33 import jobset
34
35 def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={},
36 flake_retries=0, timeout_retries=0):
37 """Creates jobspec for a task running under docker."""
38 environ = environ.copy()
39 environ['RUN_COMMAND'] = shell_command
40
41 docker_args=[]
42 for k,v in environ.iteritems():
43 docker_args += ['-e', '%s=%s' % (k, v)]
44 docker_env = {'DOCKERFILE_DIR': dockerfile_dir,
45 'DOCKER_RUN_SCRIPT': 'tools/jenkins/docker_run.sh',
46 'OUTPUT_DIR': 'artifacts'}
47 jobspec = jobset.JobSpec(
48 cmdline=['tools/jenkins/build_and_run_docker.sh'] + docker_args,
49 environ=docker_env,
50 shortname='build_package.%s' % (name),
51 timeout_seconds=30*60,
52 flake_retries=flake_retries,
53 timeout_retries=timeout_retries)
54 return jobspec
55
56 def create_jobspec(name, cmdline, environ=None, cwd=None, shell=False,
57 flake_retries=0, timeout_retries=0):
58 """Creates jobspec."""
59 jobspec = jobset.JobSpec(
60 cmdline=cmdline,
61 environ=environ,
62 cwd=cwd,
63 shortname='build_package.%s' % (name),
64 timeout_seconds=10*60,
65 flake_retries=flake_retries,
66 timeout_retries=timeout_retries,
67 shell=shell)
68 return jobspec
69
70
71 class CSharpPackage:
72 """Builds C# nuget packages."""
73
74 def __init__(self):
75 self.name = 'csharp_package'
76 self.labels = ['package', 'csharp', 'windows']
77
78 def pre_build_jobspecs(self):
79 return []
80
81 def build_jobspec(self):
82 return create_jobspec(self.name,
83 ['build_packages.bat'],
84 cwd='src\\csharp',
85 shell=True)
86
87 def __str__(self):
88 return self.name
89
90
91 class NodePackage:
92 """Builds Node NPM package and collects precompiled binaries"""
93
94 def __init__(self):
95 self.name = 'node_package'
96 self.labels = ['package', 'node', 'linux']
97
98 def pre_build_jobspecs(self):
99 return []
100
101 def build_jobspec(self):
102 return create_docker_jobspec(
103 self.name,
104 'tools/dockerfile/grpc_artifact_linux_x64',
105 'tools/run_tests/build_package_node.sh')
106
107
108 class RubyPackage:
109 """Collects ruby gems created in the artifact phase"""
110
111 def __init__(self):
112 self.name = 'ruby_package'
113 self.labels = ['package', 'ruby', 'linux']
114
115 def pre_build_jobspecs(self):
116 return []
117
118 def build_jobspec(self):
119 return create_docker_jobspec(
120 self.name,
121 'tools/dockerfile/grpc_artifact_linux_x64',
122 'tools/run_tests/build_package_ruby.sh')
123
124
125 class PythonPackage:
126 """Collects python eggs and wheels created in the artifact phase"""
127
128 def __init__(self):
129 self.name = 'python_package'
130 self.labels = ['package', 'python', 'linux']
131
132 def pre_build_jobspecs(self):
133 return []
134
135 def build_jobspec(self):
136 return create_docker_jobspec(
137 self.name,
138 'tools/dockerfile/grpc_artifact_linux_x64',
139 'tools/run_tests/build_package_python.sh')
140
141
142 class PHPPackage:
143 """Copy PHP PECL package artifact"""
144
145 def __init__(self):
146 self.name = 'php_package'
147 self.labels = ['package', 'php', 'linux']
148
149 def pre_build_jobspecs(self):
150 return []
151
152 def build_jobspec(self):
153 return create_docker_jobspec(
154 self.name,
155 'tools/dockerfile/grpc_artifact_linux_x64',
156 'tools/run_tests/build_package_php.sh')
157
158
159 def targets():
160 """Gets list of supported targets"""
161 return [CSharpPackage(),
162 NodePackage(),
163 RubyPackage(),
164 PythonPackage(),
165 PHPPackage()]
OLDNEW
« no previous file with comments | « third_party/grpc/tools/run_tests/jobset.py ('k') | third_party/grpc/tools/run_tests/port_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698