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