]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/buildbot.cfg
39de29794afe136284ac302db94f676ea1e37296
[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=["evergreen-rel_1_6_1-debian-6.00-x86_64"]))
91
92 c['schedulers'].append(Scheduler(name="evergreen-rel_2_0",
93             treeStableTimer=300,
94             change_filter=eg_rel_2_0_filter,
95             builderNames=["evergreen-rel_2_0-debian-6.00-x86_64"]))
96
97 c['schedulers'].append(Scheduler(name="evergreen-rel_2_1",
98             treeStableTimer=300,
99             change_filter=eg_rel_2_1_filter,
100             builderNames=["evergreen-rel_2_1-debian-6.00-x86_64"]))
101
102 c['schedulers'].append(Scheduler(name="evergreen-trunk",
103             treeStableTimer=300,
104             change_filter=eg_trunk_filter,
105             builderNames=["evergreen-trunk-debian-6.00-x86_64"]))
106
107 ####### BUILDERS
108
109 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
110 # what steps, and which slaves can execute them.  Note that any particular build will
111 # only take place on one slave.
112
113 from buildbot.process.factory import BuildFactory
114 from buildbot.steps import source 
115 from buildbot.steps import shell
116 from buildbot.steps import python
117 from buildbot.steps import python_twisted
118
119 osrf_factory = BuildFactory()
120 # check out the source
121 osrf_factory.addStep(source.SVN(
122             baseURL='svn://svn.open-ils.org/OpenSRF/',
123             defaultBranch='trunk',
124             mode='copy'))
125
126 # bootstrap the code
127 osrf_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
128
129 # configure (default args for now)
130 osrf_factory.addStep(shell.Configure())
131
132 # compile the code
133 osrf_factory.addStep(shell.Compile(command=["make"]))
134
135 # run the Perl unit tests
136 osrf_factory.addStep(shell.PerlModuleTest(workdir="build/src/perl"))
137
138 # run the Python unit tests (available after rel_1_6)
139 def has_python_unit_test(step):
140     return step.build.getProperty('branch') != 'branches/rel_1_6'
141
142 osrf_factory.addStep(python_twisted.Trial(
143     doStepIf=has_python_unit_test,
144     testpath="build",
145     tests="src/python/tests/json_test.py"))
146
147 # report on the Python code
148 osrf_factory.addStep(python.PyLint(
149     env={"PYTHONPATH": ["src/python"]},
150     flunkOnFailure=False,
151     command=["pylint", 
152         "--output-format=parseable",
153         "src/python/opensrf.py",
154         "src/python/osrf/app.py",
155         "src/python/osrf/cache.py",
156         "src/python/osrf/conf.py",
157         "src/python/osrf/const.py",
158         "src/python/osrf/ex.py",
159         "src/python/osrf/gateway.py",
160         "src/python/osrf/http_translator.py",
161         "src/python/osrf/json.py",
162         "src/python/osrf/log.py",
163         "src/python/osrf/net_obj.py",
164         "src/python/osrf/net.py",
165         "src/python/osrf/server.py",
166         "src/python/osrf/ses.py",
167         "src/python/osrf/set.py",
168         "src/python/osrf/stack.py",
169         "src/python/osrf/system.py",
170         "src/python/osrf/xml_obj.py",
171         "src/python/osrf/apps/example.py"]))
172
173 eg_factory = BuildFactory()
174 # check out the source
175 eg_factory.addStep(source.SVN(
176             baseURL='svn://svn.open-ils.org/ILS/',
177             defaultBranch='trunk',
178             mode='copy'))
179
180 # bootstrap the code
181 eg_factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
182
183 # configure (default args for now)
184 eg_factory.addStep(shell.Configure())
185
186 # compile the code
187 eg_factory.addStep(shell.Compile(command=["make"]))
188
189 perldir = 'build/Open-ILS/src/perlmods'
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     'Only run Perl tests if there are tests'
197     if (step.build.getProperty('branch') == 'branches/rel_1_6_1'):
198         return False
199     elif (step.build.getProperty('branch') == 'branches/rel_2_0'):
200         return False
201     return True
202
203 # run the Perl unit tests
204 eg_factory.addStep(PerlModuleTestMFHDMadness(
205     doStepIf=has_perl_unit_tests,
206     workdir=perldir)
207 )
208
209 # report on the Python code
210 eg_factory.addStep(python.PyLint(
211     env={"PYTHONPATH": ["Open-ILS/src/python"]},
212     flunkOnFailure=False,
213     command=["pylint", 
214         "--output-format=parseable",
215         "Open-ILS/src/python/setup.py",
216         "Open-ILS/src/python/oils/const.py",
217         "Open-ILS/src/python/oils/event.py",
218         "Open-ILS/src/python/oils/__init__.py",
219         "Open-ILS/src/python/oils/org.py",
220         "Open-ILS/src/python/oils/srfsh.py",
221         "Open-ILS/src/python/oils/system.py",
222         "Open-ILS/src/python/oils/utils/csedit.py",
223         "Open-ILS/src/python/oils/utils/idl.py",
224         "Open-ILS/src/python/oils/utils/__init__.py",
225         "Open-ILS/src/python/oils/utils/utils.py"
226     ]
227 ))
228
229 from buildbot.config import BuilderConfig
230
231 c['builders'] = []
232 c['builders'].append(
233     BuilderConfig(name="osrf-trunk-ubuntu-10.04-x86_64",
234       slavenames=["opensrf-slave"],
235       factory=osrf_factory))
236 c['builders'].append(
237     BuilderConfig(name="osrf-rel_1_6-ubuntu-10.04-x86_64",
238       slavenames=["opensrf-slave"],
239       factory=osrf_factory))
240 c['builders'].append(
241     BuilderConfig(name="osrf-rel_2_0-ubuntu-10.04-x86_64",
242       slavenames=["opensrf-slave"],
243       factory=osrf_factory))
244 c['builders'].append(
245     BuilderConfig(name="evergreen-rel_1_6_1-debian-6.00-x86_64",
246       slavenames=["eg-slave"],
247       factory=eg_factory))
248 c['builders'].append(
249     BuilderConfig(name="evergreen-rel_2_0-debian-6.00-x86_64",
250       slavenames=["eg-slave"],
251       factory=eg_factory))
252 c['builders'].append(
253     BuilderConfig(name="evergreen-rel_2_1-debian-6.00-x86_64",
254       slavenames=["eg-slave"],
255       factory=eg_factory))
256 c['builders'].append(
257     BuilderConfig(name="evergreen-trunk-debian-6.00-x86_64",
258       slavenames=["eg-slave"],
259       factory=eg_factory))
260
261 ####### STATUS TARGETS
262
263 # 'status' is a list of Status Targets. The results of each build will be
264 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
265 # including web pages, email senders, and IRC bots.
266
267 c['status'] = []
268
269 from buildbot.status import html
270 from buildbot.status.web import auth, authz
271
272 users = [('XXX', 'XXX'), ('XXX', 'XXX')]
273 authz_cfg=authz.Authz(
274     auth=auth.BasicAuth(users),
275     # change any of these to True to enable; see the manual for more
276     # options
277     gracefulShutdown = False,
278     forceBuild = 'auth', # use this to test your slave once it is set up
279     forceAllBuilds = False,
280     pingBuilder = False,
281     stopBuild = False,
282     stopAllBuilds = False,
283     cancelPendingBuild = False,
284 )
285 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
286
287 # Send mail when a build is broken
288 from buildbot.status.mail import MailNotifier
289 mn = MailNotifier(
290     fromaddr="buildbot@testing.esilibrary.com",
291     sendToInterestedUsers=False,
292     mode='problem',
293     extraRecipients=["dan@coffeecode.net","open-ils-dev@list.georgialibraries.org"])
294
295 # Uncomment to actually send mail
296 # c['status'].append(mn)
297
298 ####### PROJECT IDENTITY
299
300 # the 'projectName' string will be used to describe the project that this
301 # buildbot is working on. For example, it is used as the title of the
302 # waterfall HTML page. The 'projectURL' string will be used to provide a link
303 # from buildbot HTML pages to your project's home page.
304
305 c['projectName'] = "Evergreen and OpenSRF"
306 c['projectURL'] = "http://evergreen-ils.org/"
307
308 # the 'buildbotURL' string should point to the location where the buildbot's
309 # internal web server (usually the html.WebStatus page) is visible. This
310 # typically uses the port number set in the Waterfall 'status' entry, but
311 # with an externally-visible host name which the buildbot cannot figure out
312 # without some help.
313
314 c['buildbotURL'] = "http://testing.evergreen-ils.org/buildbot/"
315
316 ####### DB URL
317
318 # This specifies what database buildbot uses to store change and scheduler
319 # state.  You can leave this at its default for all but the largest
320 # installations.
321 c['db_url'] = "sqlite:///state.sqlite"
322