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