]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/buildbot.cfg
Fix reversed logic in test for Perl tests. Oh the irony.
[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 perldir = 'build/Open-ILS/src/perlmods'
191 class PerlModuleTestMFHDMadness(shell.PerlModuleTest):
192     'Override PerlModuleTest with nonstandard library location for testlib.pm'
193     command = ['prove', '--lib', 'lib', '-I', 'lib/OpenILS/Utils/MFHD/test', '-r', 't']
194     total = 0
195
196 def has_perl_unit_tests(step):
197     'If there is a /lib/ sudir in the Perl dir, there are tests'
198     if (os.path.exists(os.path.join(perldir, 'lib'))):
199         return True
200     return False
201
202 # run the Perl unit tests
203 eg_factory.addStep(PerlModuleTestMFHDMadness(
204     doStepIf=has_perl_unit_tests,
205     workdir=perldir)
206 )
207
208 # report on the Python code
209 eg_factory.addStep(python.PyLint(
210     env={"PYTHONPATH": ["Open-ILS/src/python"]},
211     flunkOnFailure=False,
212     command=["pylint", 
213         "--output-format=parseable",
214         "Open-ILS/src/python/setup.py",
215         "Open-ILS/src/python/oils/const.py",
216         "Open-ILS/src/python/oils/event.py",
217         "Open-ILS/src/python/oils/__init__.py",
218         "Open-ILS/src/python/oils/org.py",
219         "Open-ILS/src/python/oils/srfsh.py",
220         "Open-ILS/src/python/oils/system.py",
221         "Open-ILS/src/python/oils/utils/csedit.py",
222         "Open-ILS/src/python/oils/utils/idl.py",
223         "Open-ILS/src/python/oils/utils/__init__.py",
224         "Open-ILS/src/python/oils/utils/utils.py"
225     ]
226 ))
227
228 from buildbot.config import BuilderConfig
229
230 c['builders'] = []
231 c['builders'].append(
232     BuilderConfig(name="osrf-trunk-ubuntu-10.04-x86_64",
233       slavenames=["opensrf-slave"],
234       factory=osrf_factory))
235 c['builders'].append(
236     BuilderConfig(name="osrf-rel_1_6-ubuntu-10.04-x86_64",
237       slavenames=["opensrf-slave"],
238       factory=osrf_factory))
239 c['builders'].append(
240     BuilderConfig(name="osrf-rel_2_0-ubuntu-10.04-x86_64",
241       slavenames=["opensrf-slave"],
242       factory=osrf_factory))
243 c['builders'].append(
244     BuilderConfig(name="evergreen-rel_1_6_1-debian-6.00-x86_64",
245       slavenames=["eg-slave"],
246       factory=eg_factory))
247 c['builders'].append(
248     BuilderConfig(name="evergreen-rel_2_0-debian-6.00-x86_64",
249       slavenames=["eg-slave"],
250       factory=eg_factory))
251 c['builders'].append(
252     BuilderConfig(name="evergreen-rel_2_1-debian-6.00-x86_64",
253       slavenames=["eg-slave"],
254       factory=eg_factory))
255 c['builders'].append(
256     BuilderConfig(name="evergreen-trunk-debian-6.00-x86_64",
257       slavenames=["eg-slave"],
258       factory=eg_factory))
259
260 ####### STATUS TARGETS
261
262 # 'status' is a list of Status Targets. The results of each build will be
263 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
264 # including web pages, email senders, and IRC bots.
265
266 c['status'] = []
267
268 from buildbot.status import html
269 from buildbot.status.web import auth, authz
270
271 users = [('XXX', 'XXX'), ('XXX', 'XXX')]
272 authz_cfg=authz.Authz(
273     auth=auth.BasicAuth(users),
274     # change any of these to True to enable; see the manual for more
275     # options
276     gracefulShutdown = False,
277     forceBuild = 'auth', # use this to test your slave once it is set up
278     forceAllBuilds = False,
279     pingBuilder = False,
280     stopBuild = False,
281     stopAllBuilds = False,
282     cancelPendingBuild = False,
283 )
284 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
285
286 # Send mail when a build is broken
287 from buildbot.status.mail import MailNotifier
288 mn = MailNotifier(
289     fromaddr="buildbot@testing.esilibrary.com",
290     sendToInterestedUsers=False,
291     mode='problem',
292     extraRecipients=["dan@coffeecode.net","open-ils-dev@list.georgialibraries.org"])
293
294 # Uncomment to actually send mail
295 # c['status'].append(mn)
296
297 ####### PROJECT IDENTITY
298
299 # the 'projectName' string will be used to describe the project that this
300 # buildbot is working on. For example, it is used as the title of the
301 # waterfall HTML page. The 'projectURL' string will be used to provide a link
302 # from buildbot HTML pages to your project's home page.
303
304 c['projectName'] = "Evergreen and OpenSRF"
305 c['projectURL'] = "http://evergreen-ils.org/"
306
307 # the 'buildbotURL' string should point to the location where the buildbot's
308 # internal web server (usually the html.WebStatus page) is visible. This
309 # typically uses the port number set in the Waterfall 'status' entry, but
310 # with an externally-visible host name which the buildbot cannot figure out
311 # without some help.
312
313 c['buildbotURL'] = "http://testing.evergreen-ils.org/buildbot/"
314
315 ####### DB URL
316
317 # This specifies what database buildbot uses to store change and scheduler
318 # state.  You can leave this at its default for all but the largest
319 # installations.
320 c['db_url'] = "sqlite:///state.sqlite"
321