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