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