]> git.evergreen-ils.org Git - OpenSRF.git/blob - examples/buildbot.cfg
81ebda18b9c46382d135d788a94479d7a0745ba0
[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'] = [BuildSlave("XXX", "XXX", max_builds=1)]
18
19 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
20 # This must match the value configured into the buildslaves (with their
21 # --master option)
22 c['slavePortnum'] = XXX
23
24 ####### CHANGESOURCES
25
26 # the 'change_source' setting tells the buildmaster how it should find out
27 # about source code changes.  Here we point to OpenSRF:
28 def split_file_branches_trunk(path):
29     pieces = path.split('/')
30     if pieces[0] == 'trunk':
31         return ('trunk', '/'.join(pieces[1:]))
32     elif pieces[0] == 'branches':
33         return ('/'.join(pieces[0:2]),
34                 '/'.join(pieces[2:]))
35     else:
36         return None
37
38 from buildbot.changes import svnpoller
39 c['change_source'] = svnpoller.SVNPoller(
40         project='OpenSRF',
41         svnurl='svn://svn.open-ils.org/OpenSRF',
42         split_file=svnpoller.split_file_branches,
43         pollinterval=600)
44
45 ####### FILTERS
46 from buildbot.schedulers.filter import ChangeFilter
47 trunk_filter = ChangeFilter(branch=None)
48 rel_1_6_filter = ChangeFilter(branch="branches/rel_1_6")
49 rel_2_0_filter = ChangeFilter(branch="branches/rel_2_0")
50
51 ####### SCHEDULERS
52
53 # Configure the Schedulers, which decide how to react to incoming changes.  In this
54 # case, just kick off a 'runtests' build
55
56 from buildbot.scheduler import Scheduler
57 c['schedulers'] = []
58 c['schedulers'].append(Scheduler(name="osrf-trunk-full",
59             treeStableTimer=300,
60             change_filter=trunk_filter,
61             builderNames=["osrf-trunk-ubuntu-10.04-x86_64"]))
62
63 c['schedulers'].append(Scheduler(name="osrf-rel_1_6",
64             treeStableTimer=300,
65             change_filter=rel_1_6_filter,
66             builderNames=["osrf-rel_1_6-ubuntu-10.04-x86_64"]))
67
68 c['schedulers'].append(Scheduler(name="osrf-rel_2_0",
69             treeStableTimer=300,
70             change_filter=rel_2_0_filter,
71             builderNames=["osrf-rel_2_0-ubuntu-10.04-x86_64"]))
72
73 ####### BUILDERS
74
75 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
76 # what steps, and which slaves can execute them.  Note that any particular build will
77 # only take place on one slave.
78
79 from buildbot.process.factory import BuildFactory
80 from buildbot.steps import source 
81 from buildbot.steps import shell
82 from buildbot.steps import python
83 from buildbot.steps import python_twisted
84
85 factory = BuildFactory()
86 # check out the source
87 factory.addStep(source.SVN(
88             baseURL='svn://svn.open-ils.org/OpenSRF/',
89             defaultBranch='trunk',
90             mode='copy'))
91
92 # bootstrap the code
93 factory.addStep(shell.ShellCommand(command=["./autogen.sh"]))
94
95 # configure (default args for now)
96 factory.addStep(shell.Configure())
97
98 # compile the code
99 factory.addStep(shell.Compile(command=["make"]))
100
101 # run the Perl unit tests
102 factory.addStep(shell.PerlModuleTest(workdir="build/src/perl"))
103
104 # run the Python unit tests (available after rel_1_6)
105 def has_python_unit_test(step):
106     return step.build.getProperty('branch') != 'branches/rel_1_6'
107
108 factory.addStep(python_twisted.Trial(
109     doStepIf=has_python_unit_test,
110     testpath="build",
111     tests="src/python/tests/json_test.py"))
112
113 # report on the Python code
114 factory.addStep(python.PyLint(
115     env={"PYTHONPATH": ["src/python"]},
116     flunkOnFailure=False,
117     command=["pylint", 
118         "--output-format=parseable",
119         "src/python/opensrf.py",
120         "src/python/osrf/app.py",
121         "src/python/osrf/cache.py",
122         "src/python/osrf/conf.py",
123         "src/python/osrf/const.py",
124         "src/python/osrf/ex.py",
125         "src/python/osrf/gateway.py",
126         "src/python/osrf/http_translator.py",
127         "src/python/osrf/json.py",
128         "src/python/osrf/log.py",
129         "src/python/osrf/net_obj.py",
130         "src/python/osrf/net.py",
131         "src/python/osrf/server.py",
132         "src/python/osrf/ses.py",
133         "src/python/osrf/set.py",
134         "src/python/osrf/stack.py",
135         "src/python/osrf/system.py",
136         "src/python/osrf/xml_obj.py",
137         "src/python/osrf/apps/example.py"]))
138
139 from buildbot.config import BuilderConfig
140
141 c['builders'] = []
142 c['builders'].append(
143     BuilderConfig(name="osrf-trunk-ubuntu-10.04-x86_64",
144       slavenames=["opensrf-slave"],
145       factory=factory))
146 c['builders'].append(
147     BuilderConfig(name="osrf-rel_1_6-ubuntu-10.04-x86_64",
148       slavenames=["opensrf-slave"],
149       factory=factory))
150 c['builders'].append(
151     BuilderConfig(name="osrf-rel_2_0-ubuntu-10.04-x86_64",
152       slavenames=["opensrf-slave"],
153       factory=factory))
154
155 ####### STATUS TARGETS
156
157 # 'status' is a list of Status Targets. The results of each build will be
158 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
159 # including web pages, email senders, and IRC bots.
160
161 c['status'] = []
162
163 from buildbot.status import html
164 from buildbot.status.web import auth, authz
165
166 users = [('XXX', 'XXX'), ('XXX', 'XXX')]
167 authz_cfg=authz.Authz(
168     auth=auth.BasicAuth(users),
169     # change any of these to True to enable; see the manual for more
170     # options
171     gracefulShutdown = False,
172     forceBuild = 'auth', # use this to test your slave once it is set up
173     forceAllBuilds = False,
174     pingBuilder = False,
175     stopBuild = False,
176     stopAllBuilds = False,
177     cancelPendingBuild = False,
178 )
179 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
180
181 # Send mail when a build is broken
182 from buildbot.status.mail import MailNotifier
183 mn = MailNotifier(
184     fromaddr="buildbot@testing.esilibrary.com",
185     sendToInterestedUsers=False,
186     mode='problem',
187     extraRecipients=["dan@coffeecode.net","open-ils-dev@list.georgialibraries.org"])
188 c['status'].append(mn)
189
190 ####### PROJECT IDENTITY
191
192 # the 'projectName' string will be used to describe the project that this
193 # buildbot is working on. For example, it is used as the title of the
194 # waterfall HTML page. The 'projectURL' string will be used to provide a link
195 # from buildbot HTML pages to your project's home page.
196
197 c['projectName'] = "OpenSRF"
198 c['projectURL'] = "http://evergreen-ils.org/"
199
200 # the 'buildbotURL' string should point to the location where the buildbot's
201 # internal web server (usually the html.WebStatus page) is visible. This
202 # typically uses the port number set in the Waterfall 'status' entry, but
203 # with an externally-visible host name which the buildbot cannot figure out
204 # without some help.
205
206 c['buildbotURL'] = "http://testing.evergreen-ils.org/buildbot/"
207
208 ####### DB URL
209
210 # This specifies what database buildbot uses to store change and scheduler
211 # state.  You can leave this at its default for all but the largest
212 # installations.
213 c['db_url'] = "sqlite:///state.sqlite"
214