/
master.cfg
466 lines (357 loc) · 15.9 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
#!/usr/bin/env python
# -*- python -*-
# vim: syntax=python
import time
# basis for the revision string
base_rev_major = "0."
base_rev = base_rev_major
master_repo = 'https://github.com/springlobby/springlobby.git'
WIN_STRIP = "/home/buildbot/buildbot/springlobby/mxe/build/mxe/usr/bin/i686-w64-mingw32.static.posix-strip"
WIN_EXE_DIR = "build-msw-default/src/"
from buildbot.plugins import util
from admin_users import users as admins
class SpringAuth(util.CustomAuth):
def check_credentials(self, user, password):
if user in admins.keys():
if password == admins[user]:
return True
else:
return False
authz = util.Authz(
allowRules=[
util.AnyControlEndpointMatcher(role="admins"),
],
roleMatchers=[
util.RolesFromEmails(admins=["turboss","abma"]),
]
)
c = BuildmasterConfig = {}
c['workers'] = []
c['builders'] = []
c['schedulers'] = []
c['status'] = []
c['buildbotNetUsageData'] = None
c['db_url'] = "sqlite:///state.sqlite"
c['www'] = {
'port': 8010,
'avatar_methods': [],
'auth': SpringAuth(),
'authz':authz,
'plugins': {
'waterfall_view': {},
'console_view': {},
'grid_view': {}
}
}
# WORKERS #
from buildbot.worker import Worker
# import the pw vars from another file. this way we can keep config in git
import pw
c['workers'].append(Worker("testbot", pw.test, max_builds=1))
# CONFIGS #
# maybe see: /opt/mingw32/usr/i686-w64-mingw32/share/cmake/mxe-conf.cmake
common_win_opts = [
'-DCMAKE_BUILD_TYPE=RelWithDebInfo',
'-DAUX_VERSION=msw',
'-DCMAKE_INSTALL_PREFIX:PATH=.',
]
no_opti = ['-DCMAKE_CXX_FLAGS:STRING=-O0']
common_nix_opts = []
build_configs = dict() # name -> options_string
build_configs['msw-default'] = common_win_opts + ['-DCMAKE_CXX_FLAGS:STRING=-DNDEBUG']
build_configs['msw-debug'] = common_win_opts + ['-DCMAKE_BUILD_TYPE=DEBUG', '-DCMAKE_CXX_FLAGS:STRING=-g3 -ggdb -O0']
build_configs['msw-no-optionals'] = common_win_opts + no_opti
build_configs['linux-default'] = no_opti + common_nix_opts
build_configs['linux-no-optionals'] = ['-DCMAKE_BUILD_TYPE=PROFILE'] + no_opti + common_nix_opts
common_mac_opts = "-DCMAKE_TOOLCHAIN_FILE:STRING=../cmake/Toolchain-osx.cmake"
# build_configs['osx-default'] = ' ' + common_mac_opts
# builds with extra env file sourced
build_env_configs = dict() # name -> options_string
# disabled cause compiler segfaults
# build_env_configs['gcc-svn-linux-default'] = "-DCMAKE_CXX_COMPILER=/opt/gcc-svn/bin/g++ -DCMAKE_C_COMPILER=/opt/gcc-svn/bin/gcc -DCMAKE_LINKER=/opt/gcc-svn/bin/ld" + no_opti + common_nix_opts
build_env_configs['wx2.9-linux-default'] = no_opti + common_nix_opts
build_env_configs['clang-linux-default'] = [
'-DCMAKE_CXX_COMPILER=/opt/llvm/bin/clang++',
'-DCMAKE_C_COMPILER=/opt/llvm/bin/clang',
'-DCMAKE_LINKER=/opt/llvm/bin/llvm-ld'] + no_opti + common_nix_opts
env_builds = []
# env_builds.append( ( "/opt/gcc-svn.PATH", "gcc-svn-linux-default" ) )
env_builds.append(("/opt/wx2.9.PATH", "wx2.9-linux-default"))
env_builds.append(("/opt/llvm.PATH", "clang-linux-default"))
# CHANGESOURCES #
def changeIsImportant(change):
for name in change.files:
if (name.endswith('.cpp') or name.endswith('.c') or
name.endswith('.hpp') or name.endswith('.h') or
name.endswith('.cmake') or name.endswith('.hh') or
name.endswith('.inl') or name.endswith('CMakeLists.txt')):
return True
return False
from buildbot.changes.pb import PBChangeSource
c['change_source'] = []
c['change_source'].append(PBChangeSource())
# SCHEDULERS #
from buildbot.schedulers.filter import ChangeFilter
from buildbot.schedulers.basic import AnyBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.schedulers import timed
c['schedulers'].append(AnyBranchScheduler(
name="develop_Scheduler",
# change_filter=ChangeFilter(category_re = '.*develop.*'),
treeStableTimer=60,
fileIsImportant=changeIsImportant,
builderNames=["release"]))
c['schedulers'].append(ForceScheduler(
name='force_sched',
builderNames=["docs", "release", "mxe"]))
# BUILDERS #
from buildbot.process.factory import BuildFactory
from buildbot.steps.source.git import Git
from buildbot.steps.shell import Compile, ShellCommand, WithProperties
class SyncSubmodules(ShellCommand):
name = "syncsubmodules"
description = 'syncing .gitmodules with .git/config'
descriptionDone = 'synced submodule paths'
command = ['git', 'submodule', 'sync', '--recursive']
class InitSubmodules(ShellCommand):
name = "submodules"
description = 'updating submodules'
descriptionDone = 'updated submodules'
command = ['git', 'submodule', 'update', '--init', '--recursive']
class BuildDocs(ShellCommand):
name = "execute doxygen"
description = ["generating doxygen documentation"]
descriptionDone = ["docs generated"]
command = ["/bin/sh", "./tools/update-docs.sh"]
class WindowsBinary(ShellCommand):
name = "windows binary"
description = ["making windows binary"]
descriptionDone = ["windows binary"]
command = ["zip", "-jr", WithProperties("build-msw-default/springlobby-" + base_rev + "%(buildnumber)s-win32.zip"),
"build-msw-default/wininst"]
class WindowsLocales(ShellCommand):
name = "windows locale"
description = ["adding locales to win zip"]
descriptionDone = ["windows locale added"]
command = ["/bin/sh", "./tools/buildbot-add-locale-win-zip.sh",
WithProperties("springlobby-" + base_rev + "%(buildnumber)s-win32.zip")]
class UpdateEbuild(ShellCommand):
name = "update ebuild"
description = "updating ebuild"
descriptionDone = "updated ebuild"
command = ["/bin/bash", "./tools/update-ebuilds.sh", WithProperties(base_rev + "%(buildnumber)s")]
class UpdateTranslations(ShellCommand):
name = "update translations"
description = "updating translations"
descriptionDone = "updated translations"
command = ["/bin/bash", "./tools/update-translations-buildbot.sh"]
class UploadBuild(ShellCommand):
name = "upload"
def __init__(self, configname='linux-default', **kwargs):
self.configname = configname
ShellCommand.__init__(self, **kwargs)
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.description = "uploading exe"
self.descriptionDone = "uploaded exe"
self.command = ["./tools/upload-build.py", "build-%s" % configname, WithProperties("%s", "branch")]
# common build config steps ---------------------------------------------@
class buildConfig(Compile):
name = 'buildConfig'
def __init__(self, configname='linux-default', jobs=1, release=False, **kwargs):
self.configname = configname
self.release = release
Compile.__init__(self, **kwargs)
self.haltOnFailure = True
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.addFactoryArguments(jobs=jobs)
self.addFactoryArguments(release=release)
# self.name = self.configname + " build"
self.description = ["building " + self.configname + " config"]
self.descriptionDone = ["built " + self.configname + " config"]
if self.release:
self.command = ['make', 'BUILDBOT_RELEASE=1', '-k', '-j%d' % jobs, '-C', 'build-%s' % (self.configname)]
else:
self.command = ['make', '-k', '-j%d' % jobs, '-C', 'build-%s' % (self.configname)]
class buildEnvConfig(Compile):
name = 'buildConfig'
def __init__(self, env_file, configname, jobs=1, release=False, **kwargs):
self.configname = configname
self.release = release
self.env_file = env_file
Compile.__init__(self, **kwargs)
self.haltOnFailure = True
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.addFactoryArguments(jobs=jobs)
self.addFactoryArguments(release=release)
self.addFactoryArguments(env_file=env_file)
if 'gcc-svn' in configname:
self.addFactoryArguments(flunkOnFailure=False)
self.addFactoryArguments(haltOnFailure=False)
# self.name = self.configname + " build"
self.description = ["building " + self.configname + " config"]
self.descriptionDone = ["built " + self.configname + " config"]
if self.release:
self.command = ' '.join(
['source', self.env_file, '&&', 'make', 'BUILDBOT_RELEASE=1', '-k', '-j%d' % jobs, '-C',
'build-%s' % (self.configname)])
else:
self.command = ' '.join(
['source', self.env_file, '&&', 'make', '-k', '-j%d' % jobs, '-C', 'build-%s' % (self.configname)])
# TODO fail and stop the build if this fails
class CreateBuildDir(ShellCommand):
name = "build dir create"
def __init__(self, configname='linux-default', **kwargs):
self.configname = configname
ShellCommand.__init__(self, **kwargs)
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.haltOnFailure = True
self.description = ["creating dir %s" % (self.configname)]
self.descriptionDone = ["%s dir created" % (self.configname)]
self.command = ["/bin/bash", "./buildbot/create-build-dirs.sh", self.configname,
WithProperties(base_rev + "%(buildnumber)s"), ] + build_configs[self.configname]
class CreateEnvBuildDir(ShellCommand):
name = "build dir create"
def __init__(self, env_file, configname='linux-default', **kwargs):
self.configname = configname
self.env_file = env_file
ShellCommand.__init__(self, **kwargs)
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.addFactoryArguments(env_file=env_file)
self.haltOnFailure = True
self.description = ["creating dir %s" % (self.configname)]
self.descriptionDone = ["%s dir created" % (self.configname)]
self.command = ["source", self.env_file, "&&", "/bin/bash", "./buildbot/create-build-dirs.sh", self.configname,
str(time.time()), build_env_configs[self.configname]]
class CreateWinInstaller(ShellCommand):
name = "create win installer"
def __init__(self, configname='msw-default', **kwargs):
self.configname = configname
ShellCommand.__init__(self, **kwargs)
# mandatory for later (automatic) re-creation of step object
self.addFactoryArguments(configname=configname)
self.haltOnFailure = True
self.description = ["creating dir %s" % (self.configname)]
self.descriptionDone = ["%s dir created" % (self.configname)]
self.command = ["installer/make_installer.sh",
WithProperties("build-msw-default/springlobby-%(commit-description)s-win32.zip")]
# common build config steps ---------------------------------------------@
JOBS = '-j2'
class ReleaseFactory(BuildFactory):
def __init__(self):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo, getDescription={"tags": True}))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
self.addStep(CreateBuildDir('msw-default'))
self.addStep(buildConfig(configname='msw-default', jobs=2, release=True))
self.addStep(Compile(command=["make", 'BUILDBOT_RELEASE=1', JOBS, "-C", "build-msw-default", "pack", "dist"]))
self.addStep(CreateWinInstaller())
self.addStep(UploadBuild(configname='msw-default'))
class FullBuildFactory(BuildFactory):
def __init__(self, dude):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
for name in set(build_configs.keys()) - set(['osx-default']):
self.addStep(CreateBuildDir(name))
self.addStep(buildConfig(configname=name, jobs=2))
for env in env_builds:
self.addStep(CreateEnvBuildDir(env[0], env[1]))
self.addStep(buildEnvConfig(env[0], env[1], jobs=2))
self.addStep(Compile(command=["make", "-j2", "-C", "build-linux-default", "distcheck"]))
class TestBuildFactory(BuildFactory):
def __init__(self, dude):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
for env in env_builds:
self.addStep(CreateEnvBuildDir(env[0], env[1]))
self.addStep(buildEnvConfig(env[0], env[1], jobs=2))
class WinTempBuildFactory(BuildFactory):
def __init__(self, who):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
self.addStep(CreateBuildDir('msw-default'))
self.addStep(buildConfig(configname='msw-default', jobs=2))
self.addStep(UploadBuild(configname='msw-default'))
class WinTempDebugBuildFactory(BuildFactory):
def __init__(self, who):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
self.addStep(CreateBuildDir('msw-debug'))
self.addStep(buildConfig(configname='msw-debug', jobs=2))
self.addStep(UploadBuild(configname='msw-debug'))
class OSXBuildFactory(BuildFactory):
def __init__(self, who):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo))
self.addStep(SyncSubmodules())
self.addStep(InitSubmodules())
self.addStep(CreateBuildDir('osx-default'))
self.addStep(buildConfig(configname='osx-default', jobs=1))
self.addStep(UploadBuild(configname='osx-default'))
class CreateMXEBuildDir(ShellCommand):
name = "createmxebuilddir"
description = 'creating build dir'
descriptionDone = 'created build dir'
command = ['tools/mxe_create_builddir.sh']
class CompileMXEBuildDir(ShellCommand):
name = "createmxebuilddir"
description = 'compiling mxe'
descriptionDone = 'compiled mxe'
command = ['tools/mxe_compile.sh']
class MXEFactory(BuildFactory):
def __init__(self):
BuildFactory.__init__(self)
self.addStep(Git(repourl=master_repo, mode="full"))
self.addStep(CreateMXEBuildDir())
self.addStep(CompileMXEBuildDir())
win32buildenv = {
'CMAKE': '/home/buildbot/workers/springlobby/mxe/build/mxe/usr/bin/i686-w64-mingw32.static.posix-cmake',
'CMAKE_PARAMS': '-DCMAKE_STRIP:PATH=/home/buildbot/workers/springlobby/mxe/build/mxe/usr/bin/i686-w64-mingw32.static.posix-strip',
"LC_ALL": "C",
}
f2 = BuildFactory()
f2.addStep(Git(repourl=master_repo))
f2.addStep(BuildDocs())
c['builders'].append(
{'name': "release",
'workernames': ["testbot"],
'builddir': "release",
'factory': ReleaseFactory(),
'env': win32buildenv
})
c['builders'].append({
'name': "docs",
'workernames': ["testbot"],
'builddir': "docs",
'factory': f2,
})
c['builders'].append({
'name': 'mxe',
'workernames': ["testbot"],
'builddir': 'mxe',
'factory': MXEFactory()
})
# CHANGE SOURCE #
from buildbot.changes.gitpoller import GitPoller
c['change_source'].append(GitPoller(master_repo, branches=['master']))
c['protocols'] = {'pb': {'port': 9999}}
####### DEBUGGING OPTIONS
# c['debugPassword'] = "debugpassword"
# c['manhole'] = buildbot.manhole.PasswordManhole("tcp:9999:interface=127.0.0.1", "admin", "password")
####### PROJECT IDENTITY
c['projectName'] = "SpringLobby"
c['projectURL'] = "https://springlobby.springrts.org/"
c['buildbotURL'] = "https://springlobby.springrts.com/buildbot/"