-
Notifications
You must be signed in to change notification settings - Fork 5
/
master.cfg
302 lines (263 loc) · 9.19 KB
/
master.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# -*- python -*-
# ex: set syntax=python:
#
# Buildbot config for QLC+.
# If you want to add slaves edit 'build.config'.
# The config is organized bottom-up, i.e. slaves, then builders, then
# schedulers.
from buildbot.buildslave import BuildSlave
from buildbot.changes import filter
from buildbot.changes.gitpoller import GitPoller
from buildbot.config import BuilderConfig
from buildbot.process.factory import BuildFactory
from buildbot.scheduler import Try_Userpass
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.status import html
from buildbot.status import words
from buildbot.status.web import authz, auth
from buildbot.steps.shell import Compile
from buildbot.steps.shell import ShellCommand
from buildbot.steps.source import Git
import config_helper
config = config_helper.LoadConfig('build.config')
slaves = config_helper.SlaveStore(config['SLAVES'])
def BuildRepoURL():
"""Build a repo URL from it's constituent parts."""
return "%s%s" % (config['BASE_URL'], config['REPO_STUB'])
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
################################################################################
# PROJECT IDENTITY
c['title'] = config['TITLE']
c['titleURL'] = config['URL']
c['buildbotURL'] = config['BUILDBOTURL']
################################################################################
# CHANGESOURCES
# The 'change_source' setting tells the buildmaster how it should find out
# about source code changes.
c['change_source'] = [
GitPoller(BuildRepoURL(),
workdir='gitpoller-workdir',
branch='master',
pollinterval=300),
]
################################################################################
# BUILDSLAVES
c['slavePortnum'] = config['SLAVE_PORT']
# The 'slaves' list defines the set of recognized buildslaves. Each element is
# a BuildSlave object, specifying a unique slave name and password.
c['slaves'] = [BuildSlave(s.name(), s.password()) for s in slaves.GetSlaves()]
################################################################################
# BUILDERS
# The 'builders' list defines the Builders, which tell Buildbot how to perform
# a build: what steps, and which slaves can execute them. Note that any
# particular build will only take place on one slave.
# The main factory, to do fetch via git, autoreconf, configure, make & make
# check.
factory = BuildFactory()
# check out the source
factory.addStep(Git(repourl=BuildRepoURL()))
factory.addStep(ShellCommand(
command=["qmake"],
name="qmake",
haltOnFailure=True,
flunkOnFailure=True,
))
factory.addStep(Compile(
name='make',
description='building',
descriptionDone='build',
command=['make'],
))
factory.addStep(Compile(
name='unit tests',
description='testing',
descriptionDone='test',
command=['./unittest.sh'],
logfiles=config['LOGFILES'],
lazylogfiles=True,
))
# cpplint factory
if 'CPP_LINT_ARGS' in config:
cpp_lint_command = (
'cpplint.py %s $(find ./ -name "*.h" -or -name "*.cpp" | xargs)' %
config['CPP_LINT_ARGS'])
cpp_lint_factory = BuildFactory()
cpp_lint_factory.addStep(Git(repourl=BuildRepoURL()))
cpp_lint_factory.addStep(ShellCommand(
command=cpp_lint_command,
haltOnFailure=False,
flunkOnFailure=False,
warnOnWarnings=True,
warnOnFailure=True,
description='linting',
descriptionDone='lint',
))
# jslint factory
if 'JS_LINT_ARGS' in config:
js_lint_command = (
'gjslint %s -r javascript/' %
config['JS_LINT_ARGS'])
js_lint_factory = BuildFactory()
js_lint_factory.addStep(Git(repourl=BuildRepoURL()))
js_lint_factory.addStep(ShellCommand(
command=js_lint_command,
haltOnFailure=False,
flunkOnFailure=False,
warnOnWarnings=True,
warnOnFailure=True,
description='linting',
descriptionDone='lint',
))
# heap check factory
hc_factory = BuildFactory()
hc_factory.addStep(Git(repourl=BuildRepoURL()))
hc_factory.addStep(ShellCommand(
command=["qmake"],
name="qmake",
haltOnFailure=True,
flunkOnFailure=True,
))
hc_factory.addStep(Compile(
name='make',
description='building',
descriptionDone='build',
command=['make']))
hc_factory.addStep(Compile(
name='unit tests',
description='testing',
descriptionDone='test',
command=['./unittest.sh'],
env={'HEAPCHECK': 'normal',
'PPROF_PATH': '/usr/bin/google-pprof'},
logfiles=config['LOGFILES'],
lazylogfiles=True,
))
# doxygen doc factory
doc_factory = BuildFactory()
doc_factory.addStep(Git(repourl=BuildRepoURL()))
doc_factory.addStep(ShellCommand(
command=["qmake"],
name="qmake",
haltOnFailure=True,
flunkOnFailure=True,
))
doc_factory.addStep(Compile(
name='make doxygen-doc',
description='documenting',
descriptionDone='documented',
flunkOnWarnings=True,
command=['make', 'doxygen-doc']))
doc_factory.addStep(ShellCommand(
workdir="build",
command=["./doxygen/copy-doc.sh", "/opt/www/docs.qlcplus.org/doc/latest/"],
name="copy"))
c['builders'] = []
# Create a make, make check builder for each slave.
# TODO: We should probably just create a builder for each (platform, arch) and
# add all the slaves instead. No point running a build more than once in the
# same environment.
# PN: Although it depends if we want to be able to distinguish a build failing
# due to a bug related to openslp say, compared to the arch/OS in general
for slave in slaves.GetSlaves(config_helper.HasBuild):
c['builders'].append(
BuilderConfig(name=("buildcheck-qlcplus-%s" % slave.name()),
slavenames=[slave.name()],
factory=factory,
# Slow slaves will merge requests, to try and reduce their
# workload
mergeRequests=slave.is_slow))
cpp_lint_slaves = slaves.GetSlaves(config_helper.HasCPPLintFilter)
if ('CPP_LINT_ARGS' in config) and cpp_lint_slaves:
c['builders'].append(
BuilderConfig(name="cpplint-qlcplus",
slavenames=[s.name() for s in cpp_lint_slaves],
factory=cpp_lint_factory))
js_lint_slaves = slaves.GetSlaves(config_helper.HasJSLintFilter)
if ('JS_LINT_ARGS' in config) and js_lint_slaves:
c['builders'].append(
BuilderConfig(name="jslint-qlcplus",
slavenames=[s.name() for s in js_lint_slaves],
factory=js_lint_factory))
# tcmalloc_slaves = slaves.GetSlaves(config_helper.HasTCMalloc)
# if tcmalloc_slaves:
# c['builders'].append(
# BuilderConfig(name="leakchecker-qlcplus",
# slavenames=[s.name() for s in tcmalloc_slaves],
# factory=hc_factory))
doc_slaves = slaves.GetSlaves(config_helper.GenerateDoc)
if doc_slaves:
c['builders'].append(
BuilderConfig(name="doxygen-doc-generator",
slavenames=[s.name() for s in doc_slaves],
factory=doc_factory))
################################################################################
# SCHEDULERS
# Configure the Schedulers, which decide how to react to incoming changes. In
# this case, just kick off a 'buildcheck' build
c['schedulers'] = [
SingleBranchScheduler(
name="all",
change_filter=filter.ChangeFilter(branch='master'),
treeStableTimer=None,
builderNames=[b.name for b in c['builders']],
),
ForceScheduler(
name="force",
builderNames=[b.name for b in c['builders']],
),
Try_Userpass(
name='try',
builderNames=[b.name for b in c['builders']],
port=5556,
userpass=[('sampleuser', 'samplepass')],
),
]
################################################################################
# STATUS TARGETS
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
c['status'] = []
authz_cfg = authz.Authz(
# change any of these to True to enable; see the manual for more
# options
auth=auth.BasicAuth([("qlcplus", "qlcplus")]),
gracefulShutdown=False,
forceBuild='auth', # use this to test your slave once it is set up
forceAllBuilds=False,
pingBuilder=False,
stopBuild='auth',
stopAllBuilds=False,
cancelPendingBuild='auth',
)
c['status'].append(
html.WebStatus(
http_port=8020,
authz=authz_cfg,
revlink=("%s%s" % (config['BASE_URL'], config['REVLINKSTUB'])),))
if (('IRCSERVER' in config) and ('IRCBOTBASENAME' in config) and
('IRCBOTCHANNEL' in config)):
# IRC Bot, very chatty, in a configurable channel, probably it's own
c['status'].append(words.IRC(
host=config['IRCSERVER'],
nick=config['IRCBOTBASENAME'],
allowForce=True,
channels=[config['IRCBOTCHANNEL']],
notify_events={
'started': 1,
'finished': 1,
'success': 1,
'failure': 1,
'exception': 1,
'successToFailure': 1,
'failureToSuccess': 1,
})
)
################################################################################
# DB URL
c['db'] = {
'db_url': "sqlite:///state.sqlite",
}