]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/buildbot.cfg
1af14540880796cb573bf316738bac122a28204f
[OpenSRF.git] / examples / buildbot.cfg
1 # -*- python -*-
2 # vim: set syntax=python:et:ts=4:sw=4:
3
4 # This is a sample buildmaster config file. It must be installed as
5 # 'master.cfg' in your buildmaster's base directory.
6
7 # This is the dictionary that the buildmaster pays attention to. We also use
8 # a shorter alias to save typing.
9 c = BuildmasterConfig = {}
10
11 ####### BUILDSLAVES
12
13 # The 'slaves' list defines the set of recognized buildslaves. Each element is
14 # a BuildSlave object, specifying a username and password.  The same username and
15 # password must be configured on the slave.
16 from buildbot.buildslave import BuildSlave
17 c['slaves'] = [
18     BuildSlave("opensrf-slave", "XXX", max_builds=1),
19     BuildSlave("eg-slave", "XXX", max_builds=1),
20     BuildSlave("eg-u804", "XXX", max_builds=1),
21     BuildSlave("eg-u1004", "XXX", max_builds=1)
22 ]
23
24 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
25 # This must match the value configured into the buildslaves (with their
26 # --master option)
27 c['slavePortnum'] = XXX
28
29 # Branches and distros to build
30 osrf_branches = ('master', 'rel_1_6', 'rel_2_0')
31 osrf_distros = [('ubuntu-10.04-x86_64', 'opensrf-slave')]
32 eg_branches = ('master', 'rel_1_6_1', 'rel_2_0', 'rel_2_1')
33 eg_distros = [
34     ('debian-6.00-x86_64', 'eg-slave'), # UPEI
35     ('ubuntu-8.04-x86', 'eg-u804'),     # GPLS
36     ('ubuntu-10.04-x86', 'eg-u1004')    # GPLS
37 ]
38
39 eg_git = 'git://git.evergreen-ils.org/Evergreen.git'
40 osrf_git = 'git://git.evergreen-ils.org/OpenSRF.git'
41
42 ####### CHANGESOURCES
43
44 # the 'change_source' setting tells the buildmaster how it should find out
45 # about source code changes
46
47 from buildbot.changes import gitpoller
48 c['change_source'] = (
49         gitpoller.GitPoller(
50                 project='OpenSRF',
51                 repourl=osrf_git
52     ),
53         gitpoller.GitPoller(
54                 project='Evergreen',
55         repourl=eg_git
56     )
57 )
58
59 ####### FILTERS
60 from buildbot.schedulers.filter import ChangeFilter
61 master_filter = ChangeFilter(project='OpenSRF', branch="master")
62 rel_1_6_filter = ChangeFilter(project='OpenSRF', branch="rel_1_6")
63 rel_2_0_filter = ChangeFilter(project='OpenSRF', branch="rel_2_0")
64 eg_rel_1_6_1_filter = ChangeFilter(project='Evergreen', branch="rel_1_6_1")
65 eg_rel_2_0_filter = ChangeFilter(project='Evergreen', branch="rel_2_0")
66 eg_rel_2_1_filter = ChangeFilter(project='Evergreen', branch="rel_2_1")
67 eg_master_filter = ChangeFilter(project='Evergreen', branch="master")
68
69 ####### SCHEDULERS
70
71 # Configure the Schedulers, which decide how to react to incoming changes.  In this
72 # case, just kick off a 'runtests' build
73
74 from buildbot.scheduler import Scheduler
75 c['schedulers'] = []
76 c['schedulers'].append(Scheduler(name="osrf-master-full",
77             treeStableTimer=300,
78             change_filter=master_filter,
79             builderNames=["osrf-master-ubuntu-10.04-x86_64"]))
80
81 c['schedulers'].append(Scheduler(name="osrf-rel_1_6",
82             treeStableTimer=300,
83             change_filter=rel_1_6_filter,
84             builderNames=["osrf-rel_1_6-ubuntu-10.04-x86_64"]))
85
86 c['schedulers'].append(Scheduler(name="osrf-rel_2_0",
87             treeStableTimer=300,
88             change_filter=rel_2_0_filter,
89             builderNames=["osrf-rel_2_0-ubuntu-10.04-x86_64"]))
90
91 c['schedulers'].append(Scheduler(name="evergreen-rel_1_6_1",
92             treeStableTimer=300,
93             change_filter=eg_rel_1_6_1_filter,
94             builderNames=[
95                 "evergreen-rel_1_6_1-debian-6.00-x86_64",
96                 "evergreen-rel_1_6_1-ubuntu-8.04-x86",
97                 "evergreen-rel_1_6_1-ubuntu-10.04-x86"
98             ]))
99
100 c['schedulers'].append(Scheduler(name="evergreen-rel_2_0",
101             treeStableTimer=300,
102             change_filter=eg_rel_2_0_filter,
103             builderNames=[
104                 "evergreen-rel_2_0-debian-6.00-x86_64",
105                 "evergreen-rel_2_0-ubuntu-8.04-x86",
106                 "evergreen-rel_2_0-ubuntu-10.04-x86"
107             ]))
108
109 c['schedulers'].append(Scheduler(name="evergreen-rel_2_1",
110             treeStableTimer=300,
111             change_filter=eg_rel_2_1_filter,
112             builderNames=[
113                 "evergreen-rel_2_1-debian-6.00-x86_64",
114                 "evergreen-rel_2_1-ubuntu-8.04-x86",
115                 "evergreen-rel_2_1-ubuntu-10.04-x86"
116             ]))
117
118 c['schedulers'].append(Scheduler(name="evergreen-master",
119             treeStableTimer=300,
120             change_filter=eg_master_filter,
121             builderNames=[
122                 "evergreen-master-debian-6.00-x86_64",
123                 "evergreen-master-ubuntu-8.04-x86",
124                 "evergreen-master-ubuntu-10.04-x86"
125             ]))
126
127 ####### BUILDERS
128
129 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
130 # what steps, and which slaves can execute them.  Note that any particular build will
131 # only take place on one slave.
132
133 from buildbot.process.factory import BuildFactory
134 from buildbot.steps import source 
135 from buildbot.steps import shell
136 from buildbot.steps import python
137 from buildbot.steps import python_twisted
138
139 osrf_factory = BuildFactory()
140 # check out the source
141 osrf_factory.addStep(source.Git(
142         repourl=osrf_git
143     )
144 )
145
146 # bootstrap the code
147 osrf_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
148
149 # configure (default args for now)
150 osrf_factory.addStep(shell.Configure())
151
152 # compile the code
153 osrf_factory.addStep(shell.Compile(command=["make"]))
154
155 # run the Perl unit tests
156 osrf_factory.addStep(shell.PerlModuleTest(workdir="build/src/perl"))
157
158 # run the Python unit tests (available after rel_1_6)
159 def has_python_unit_test(step):
160     return step.build.getProperty('branch') != 'branches/rel_1_6'
161
162 osrf_factory.addStep(python_twisted.Trial(
163     doStepIf=has_python_unit_test,
164     testpath="build",
165     tests="src/python/tests/json_test.py"))
166
167 # report on the Python code
168 osrf_factory.addStep(python.PyLint(
169     env={"PYTHONPATH": ["src/python"]},
170     flunkOnFailure=False,
171     command=["pylint", 
172         "--output-format=parseable",
173         "src/python/opensrf.py",
174         "src/python/osrf/app.py",
175         "src/python/osrf/cache.py",
176         "src/python/osrf/conf.py",
177         "src/python/osrf/const.py",
178         "src/python/osrf/ex.py",
179         "src/python/osrf/gateway.py",
180         "src/python/osrf/http_translator.py",
181         "src/python/osrf/json.py",
182         "src/python/osrf/log.py",
183         "src/python/osrf/net_obj.py",
184         "src/python/osrf/net.py",
185         "src/python/osrf/server.py",
186         "src/python/osrf/ses.py",
187         "src/python/osrf/set.py",
188         "src/python/osrf/stack.py",
189         "src/python/osrf/system.py",
190         "src/python/osrf/xml_obj.py",
191         "src/python/osrf/apps/example.py"]))
192
193 eg_factory = BuildFactory()
194 # check out the source
195 eg_factory.addStep(source.Git(
196         repourl=eg_git
197     )
198 )
199
200 # bootstrap the code
201 eg_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
202
203 # configure (default args for now)
204 eg_factory.addStep(shell.Configure())
205
206 # compile the code
207 eg_factory.addStep(shell.Compile(command=["make"]))
208
209 perldir = 'build/Open-ILS/src/perlmods'
210 class PerlModuleTestMFHDMadness(shell.PerlModuleTest):
211     'Override PerlModuleTest with nonstandard library location for testlib.pm'
212     command = ['prove', '--lib', 'lib', '-I', 'lib/OpenILS/Utils/MFHD/test', '-r', 't']
213     total = 0
214
215 def has_perl_unit_tests(step):
216     'Only run Perl tests if there are tests'
217     if (step.build.getProperty('branch') == 'branches/rel_1_6_1'):
218         return False
219     elif (step.build.getProperty('branch') == 'branches/rel_2_0'):
220         return False
221     return True
222
223 # run the Perl unit tests
224 eg_factory.addStep(PerlModuleTestMFHDMadness(
225     doStepIf=has_perl_unit_tests,
226     workdir=perldir)
227 )
228
229 # report on the Python code
230 eg_factory.addStep(python.PyLint(
231     env={"PYTHONPATH": ["Open-ILS/src/python"]},
232     flunkOnFailure=False,
233     command=["pylint", 
234         "--output-format=parseable",
235         "Open-ILS/src/python/setup.py",
236         "Open-ILS/src/python/oils/const.py",
237         "Open-ILS/src/python/oils/event.py",
238         "Open-ILS/src/python/oils/__init__.py",
239         "Open-ILS/src/python/oils/org.py",
240         "Open-ILS/src/python/oils/srfsh.py",
241         "Open-ILS/src/python/oils/system.py",
242         "Open-ILS/src/python/oils/utils/csedit.py",
243         "Open-ILS/src/python/oils/utils/idl.py",
244         "Open-ILS/src/python/oils/utils/__init__.py",
245         "Open-ILS/src/python/oils/utils/utils.py"
246     ]
247 ))
248
249 from buildbot.config import BuilderConfig
250
251 c['builders'] = []
252
253 for branch in osrf_branches:
254     for distro, slave in osrf_distros:
255         build = "osrf-%s-%s" % (branch, distro)
256         c['builders'].append(BuilderConfig(name=build, slavenames=slave, factory=osrf_factory))
257         
258 for branch in eg_branches:
259     for distro, slave in eg_distros:
260         build = "evergreen-%s-%s" % (branch, distro)
261         c['builders'].append(BuilderConfig(name=build, slavenames=slave, factory=eg_factory))
262
263 ####### STATUS TARGETS
264
265 # 'status' is a list of Status Targets. The results of each build will be
266 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
267 # including web pages, email senders, and IRC bots.
268
269 c['status'] = []
270
271 from buildbot.status import html
272 from buildbot.status.web import auth, authz
273
274 users = [('XXX', 'XXX'), ('XXX', 'XXX')]
275 authz_cfg = authz.Authz(
276     auth=auth.BasicAuth(users),
277     # change any of these to True to enable; see the manual for more
278     # options
279     gracefulShutdown = False,
280     forceBuild = 'auth', # use this to test your slave once it is set up
281     forceAllBuilds = False,
282     pingBuilder = False,
283     stopBuild = False,
284     stopAllBuilds = False,
285     cancelPendingBuild = False,
286 )
287 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
288
289 # Send mail when a build is broken
290 from buildbot.status.mail import MailNotifier
291 mn = MailNotifier(
292     fromaddr="buildbot@testing.esilibrary.com",
293     sendToInterestedUsers=False,
294     mode='problem',
295     extraRecipients=["dan@coffeecode.net","open-ils-dev@list.georgialibraries.org"])
296
297 # Uncomment to actually send mail
298 # c['status'].append(mn)
299
300 ####### PROJECT IDENTITY
301
302 # the 'projectName' string will be used to describe the project that this
303 # buildbot is working on. For example, it is used as the title of the
304 # waterfall HTML page. The 'projectURL' string will be used to provide a link
305 # from buildbot HTML pages to your project's home page.
306
307 c['projectName'] = "Evergreen and OpenSRF"
308 c['projectURL'] = "http://evergreen-ils.org/"
309
310 # the 'buildbotURL' string should point to the location where the buildbot's
311 # internal web server (usually the html.WebStatus page) is visible. This
312 # typically uses the port number set in the Waterfall 'status' entry, but
313 # with an externally-visible host name which the buildbot cannot figure out
314 # without some help.
315
316 c['buildbotURL'] = "http://testing.evergreen-ils.org/buildbot/"
317
318 ####### DB URL
319
320 # This specifies what database buildbot uses to store change and scheduler
321 # state.  You can leave this at its default for all but the largest
322 # installations.
323 c['db_url'] = "sqlite:///state.sqlite"
324