Further tweaks to buildbot
[blender.git] / build_files / buildbot / master.cfg
1 # -*- python -*-
2 # ex: set syntax=python:
3
4 # <pep8 compliant>
5
6 # Dictionary that the buildmaster pays attention to.
7 c = BuildmasterConfig = {}
8
9 # BUILD SLAVES
10 #
11 # We load the slaves and their passwords from a separator file, so we can have
12 # this one in SVN.
13
14 from buildbot.buildslave import BuildSlave
15 import master_private
16
17 c['slaves'] = []
18
19 for slave in master_private.slaves:
20     c['slaves'].append(BuildSlave(slave['name'], slave['password']))
21
22 # TCP port through which slaves connect
23
24 c['slavePortnum'] = 9989
25
26 # CHANGE SOURCES
27
28 from buildbot.changes.svnpoller import SVNPoller
29
30 c['change_source'] = SVNPoller(
31        'https://svn.blender.org/svnroot/bf-blender/trunk/',
32        pollinterval=1200)
33
34 # BUILDERS
35 #
36 # The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
37 # what steps, and which slaves can execute them.  Note that any particular build will
38 # only take place on one slave.
39
40 from buildbot.process.factory import BuildFactory
41 from buildbot.steps.source import SVN
42 from buildbot.steps.shell import ShellCommand
43 from buildbot.steps.shell import Compile
44 from buildbot.steps.shell import Test
45 from buildbot.steps.transfer import FileUpload
46 # from buildbot.steps.transfer import FileDownload
47 from buildbot.steps.master import MasterShellCommand
48 from buildbot.config import BuilderConfig
49
50 # add builder utility
51
52 c['builders'] = []
53 buildernames = []
54
55
56 def add_builder(c, name, libdir, factory, branch='', rsync=False):
57     slavenames = []
58
59     for slave in master_private.slaves:
60         if name in slave['builders']:
61             slavenames.append(slave['name'])
62
63     if len(slavenames) > 0:
64         f = factory(name, libdir, branch, rsync)
65         c['builders'].append(BuilderConfig(name=name, slavenames=slavenames, factory=f, category='blender'))
66         buildernames.append(name)
67
68 # common steps
69
70
71 def svn_step(branch=''):
72     if branch:
73         return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/branches/%%BRANCH%%', mode='update', defaultBranch=branch, workdir='blender')
74     else:
75         return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender')
76
77 def lib_svn_step(dir):
78     return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
79
80 def rsync_step(id, branch, rsync_script):
81     return ShellCommand(name='rsync', command=['python', rsync_script, id, branch], description='uploading', descriptionDone='uploaded', workdir='install')
82
83 # generic builder
84
85
86 def generic_builder(id, libdir='', branch='', rsync=False):
87     filename = 'uploaded/buildbot_upload_' + id + '.zip'
88     compile_script = '../blender/build_files/buildbot/slave_compile.py'
89     test_script = '../blender/build_files/buildbot/slave_test.py'
90     pack_script = '../blender/build_files/buildbot/slave_pack.py'
91     rsync_script = '../blender/build_files/buildbot/slave_rsync.py'
92     unpack_script = 'master_unpack.py'
93
94     f = BuildFactory()
95     f.addStep(svn_step(branch))
96     if libdir != '':
97         f.addStep(lib_svn_step(libdir))
98
99     f.addStep(Compile(command=['python', compile_script, id], timeout=3600))
100     f.addStep(Test(command=['python', test_script, id]))
101     f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged'))
102     if rsync:
103         f.addStep(rsync_step(id, branch, rsync_script))
104     elif id.find('cmake') != -1:
105         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
106     else:
107         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
108     f.addStep(MasterShellCommand(name='unpack', command=['python', unpack_script, filename], description='unpacking', descriptionDone='unpacked'))
109     return f
110
111 # builders
112
113 add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder, '', True)
114 add_builder(c, 'mac_x86_64_10_5_scons', '', generic_builder, '', True)
115 #add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad')
116 add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder)
117 add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder)
118 #add_builder(c, 'linux_x86_64_cmake', '', generic_builder)
119 #add_builder(c, 'linux_glibc27_i386_scons', '', generic_builder)
120 add_builder(c, 'linux_glibc211_i386_scons', '', generic_builder)
121 #add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad')
122 #add_builder(c, 'linux_glibc27_x86_64_scons', '', generic_builder)
123 add_builder(c, 'linux_glibc211_x86_64_scons', '', generic_builder)
124 #add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad')
125 add_builder(c, 'win32_scons', 'windows', generic_builder)
126 #add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
127 add_builder(c, 'win64_scons', 'win64', generic_builder)
128 add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder)
129 add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder)
130 #add_builder(c, 'freebsd_i386_cmake', '', generic_builder)
131 #add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder)
132
133 # SCHEDULERS
134 #
135 # Decide how to react to incoming changes.
136
137 # from buildbot.scheduler import Scheduler
138 from buildbot.schedulers import timed
139
140 c['schedulers'] = []
141 #c['schedulers'].append(Scheduler(name="all", branch=None,
142 #                                 treeStableTimer=None,
143 #                                 builderNames=[]))
144 #c['schedulers'].append(timed.Periodic(name="nightly",
145 #                        builderNames=buildernames,
146 #                        periodicBuildTimer=24*60*60))
147
148 schedule_cycle = 4
149
150 for i in range(0, schedule_cycle):
151     names = []
152     for j in range(0, len(buildernames)):
153         if j % schedule_cycle == i:
154             names += [buildernames[j]]
155
156     print(names)
157     c['schedulers'].append(timed.Nightly(name='nightly' + str(i),
158         builderNames=names,
159         hour=3+i,
160         minute=0))
161
162 # STATUS TARGETS
163 #
164 # 'status' is a list of Status Targets. The results of each build will be
165 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
166 # including web pages, email senders, and IRC bots.
167
168 c['status'] = []
169
170 from buildbot.status import html
171 from buildbot.status.web import authz
172
173 authz_cfg = authz.Authz(
174     # change any of these to True to enable; see the manual for more
175     # options
176     gracefulShutdown=False,
177     forceBuild=True,  # use this to test your slave once it is set up
178     forceAllBuilds=False,
179     pingBuilder=False,
180     stopBuild=True,
181     stopAllBuilds=False,
182     cancelPendingBuild=True,
183 )
184
185 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
186
187 # PROJECT IDENTITY
188
189 c['projectName'] = "Blender"
190 c['projectURL'] = "http://www.blender.org"
191
192 # the 'buildbotURL' string should point to the location where the buildbot's
193 # internal web server (usually the html.WebStatus page) is visible. This
194 # typically uses the port number set in the Waterfall 'status' entry, but
195 # with an externally-visible host name which the buildbot cannot figure out
196 # without some help.
197
198 c['buildbotURL'] = "http://builder.blender.org/"
199
200 # DB URL
201 #
202 # This specifies what database buildbot uses to store change and scheduler
203 # state.  You can leave this at its default for all but the largest
204 # installations.
205
206 c['db_url'] = "sqlite:///state.sqlite"