Initial port over 0.9.x branch
[blender-buildbot.git] / master.cfg
1 # -*- python -*-
2 # ex: set syntax=python:
3
4 # <pep8 compliant>
5
6 # List of the branches being built automatically overnight
7 NIGHT_SCHEDULE_BRANCHES = [None, "blender2.8"]
8
9 # List of the branches available for force build
10 FORCE_SCHEDULE_BRANCHES = ["master", "blender2.8", "experimental-build"]
11
12 # Dictionary that the buildmaster pays attention to.
13 c = BuildmasterConfig = {}
14
15 # BUILD WORKERS
16 #
17 # We load the slaves and their passwords from a separator file, so we can have
18 # this one in SVN.
19
20 from buildbot.worker import Worker
21 import master_private
22
23 c['workers'] = []
24 for slave in master_private.slaves:
25     c['workers'].append(Worker(slave['name'], slave['password']))
26
27 # TCP port through which slaves connect
28 c['protocols'] = {'pb': {'port': 9989}}
29
30 # CHANGE SOURCES
31
32 from buildbot.changes.svnpoller import SVNPoller
33 from buildbot.changes.gitpoller import GitPoller
34
35 c['change_source'] = GitPoller('git://git.blender.org/blender.git',
36                                pollinterval=1200)
37
38 # CODEBASES
39 #
40 # Allow to control separately things like branches for each repo and submodules.
41
42 all_repositories = {
43     r'git://git.blender.org/blender.git': 'blender',
44     r'git://git.blender.org/blender-translations.git': 'blender-translations',
45     r'git://git.blender.org/blender-addons.git': 'blender-addons',
46     r'git://git.blender.org/blender-addons-contrib.git': 'blender-addons-contrib',
47     r'git://git.blender.org/blender-dev-tools.git': 'blender-dev-tools',
48     r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
49 }
50
51
52 def codebaseGenerator(chdict):
53     return all_repositories[chdict['repository']]
54
55 c['codebaseGenerator'] = codebaseGenerator
56
57
58 # SCHEDULERS
59 #
60 # Decide how to react to incoming changes.
61
62 # from buildbot.scheduler import Scheduler
63 from buildbot.schedulers import timed, forcesched
64
65 c['schedulers'] = []
66
67
68 def schedule_force_build(name):
69     c['schedulers'].append(forcesched.ForceScheduler(name='force_' + name,
70         builderNames=[name],
71         codebases=[forcesched.CodebaseParameter(
72                 codebase="blender",
73                 branch=forcesched.ChoiceStringParameter(
74                     name="branch", choices=FORCE_SCHEDULE_BRANCHES, default="master"),
75                 # Do not hide revision, can be handy!
76                 repository=forcesched.FixedParameter(name="repository", default="", hide=True),
77                 project=forcesched.FixedParameter(name="project", default="", hide=True)),
78             # For now, hide other codebases.
79             forcesched.CodebaseParameter(hide=True, codebase="blender-translations"),
80             forcesched.CodebaseParameter(
81                 codebase="blender-addons",
82                 branch=forcesched.ChoiceStringParameter(
83                     name="branch", choices=["master", "blender2.8"], default="master"),
84                 repository=forcesched.FixedParameter(name="repository", default="", hide=True),
85                 project=forcesched.FixedParameter(name="project", default="", hide=True),
86                 revision=forcesched.FixedParameter(name="revision", default="", hide=True),
87             ),
88             forcesched.CodebaseParameter(hide=True, codebase="blender-addons-contrib"),
89             forcesched.CodebaseParameter(hide=True, codebase="blender-dev-tools"),
90             forcesched.CodebaseParameter(hide=True, codebase="lib svn")],
91         properties=[]))
92
93
94 def schedule_build(name, hour, minute=0):
95     for current_branch in NIGHT_SCHEDULE_BRANCHES:
96         scheduler_name = "nightly " + name
97         if current_branch:
98             scheduler_name += ' ' + current_branch
99         # Use special addons submodule branch when building blender2.8 branch.
100         addons_branch = "master"
101         if current_branch == "blender2.8":
102             addons_branch = "blender2.8"
103         c['schedulers'].append(timed.Nightly(name=scheduler_name,
104             codebases={
105                 "blender": {"repository": ""},
106                 "blender-translations": {"repository": "", "branch": "master"},
107                 "blender-addons": {"repository": "", "branch": addons_branch},
108                 "blender-addons-contrib": {"repository": "", "branch": "master"},
109                 "blender-dev-tools": {"repository": "", "branch": "master"},
110                 "lib svn": {"repository": "", "branch": "trunk"}},
111             branch=current_branch,
112             builderNames=[name],
113             hour=hour,
114             minute=minute))
115
116
117 # BUILDERS
118 #
119 # The 'builders' list defines the Builders, which tell Buildbot how to
120 # perform a build: what steps, and which slaves can execute them.
121 # Note that any particular build will only take place on one slave.
122
123 from buildbot.config import BuilderConfig
124 from buildbot.plugins import steps, util
125 from buildbot.process.factory import BuildFactory
126 from buildbot.process.properties import Interpolate
127 from buildbot.steps.shell import ShellCommand
128 from buildbot.steps.shell import Compile
129 from buildbot.steps.shell import Test
130 from buildbot.steps.transfer import FileUpload
131 from buildbot.steps.master import MasterShellCommand
132
133 # add builder utility
134
135 c['builders'] = []
136 buildernames = []
137
138
139 def add_builder(c, name, libdir, factory, branch='',
140                 rsync=False, hour=3, minute=0):
141     workernames = []
142
143     for slave in master_private.slaves:
144         if name in slave['builders']:
145             workernames.append(slave['name'])
146
147     if workernames:
148         f = factory(name, libdir, branch, rsync)
149         c['builders'].append(BuilderConfig(name=name,
150                                            workernames=workernames,
151                                            factory=f,
152                                            tags=['blender']))
153         buildernames.append(name)
154
155         schedule_build(name, hour, minute)
156         schedule_force_build(name)
157
158 # common steps
159
160
161 def git_submodule_step(submodule):
162     return steps.Git(name=submodule + '.git',
163                      repourl='git://git.blender.org/' + submodule + '.git',
164                      mode='incremental',
165                      codebase=submodule,
166                      workdir=submodule + '.git')
167
168
169 def git_step(branch=''):
170     if branch:
171         return steps.Git(name='blender.git',
172                          repourl='git://git.blender.org/blender.git',
173                          mode='incremental',
174                          branch=branch,
175                          codebase='blender',
176                          workdir='blender.git',
177                          submodules=True)
178     else:
179         return steps.Git(name='blender.git',
180                          repourl='git://git.blender.org/blender.git',
181                          mode='incremental',
182                          codebase='blender',
183                          workdir='blender.git',
184                          submodules=True)
185
186
187 def git_submodules_update():
188     command = ['git', 'submodule', 'update', '--remote']
189     return ShellCommand(name='Submodules Update',
190                         command=command,
191                         description='updating',
192                         descriptionDone='up to date',
193                         workdir='blender.git')
194
195
196 def lib_svn_step(dir):
197     return steps.SVN(name='lib svn',
198                      repourl=util.Interpolate('https://svn.blender.org/svnroot/bf-blender/%(src::branch)s/lib/' + dir),
199                      codebase='lib svn',
200                      mode='incremental',
201                      workdir='lib/' + dir)
202
203
204 def rsync_step(id, branch, rsync_script):
205     return ShellCommand(name='rsync',
206                         command=['python', rsync_script, id, branch],
207                         description='uploading',
208                         descriptionDone='uploaded',
209                         workdir='install')
210
211 # generic builder
212
213
214 def generic_builder(id, libdir='', branch='', rsync=False):
215     filename = 'uploaded/buildbot_upload_' + id + '.zip'
216     compile_script = '../blender.git/build_files/buildbot/slave_compile.py'
217     test_script = '../blender.git/build_files/buildbot/slave_test.py'
218     pack_script = '../blender.git/build_files/buildbot/slave_pack.py'
219     rsync_script = '../blender.git/build_files/buildbot/slave_rsync.py'
220     unpack_script = 'master_unpack.py'
221
222     f = BuildFactory()
223     if libdir != '':
224         f.addStep(lib_svn_step(libdir))
225
226     for submodule in ('blender-translations',
227                       'blender-addons',
228                       'blender-addons-contrib',
229                       'blender-dev-tools'):
230         f.addStep(git_submodule_step(submodule))
231
232     f.addStep(git_step(branch))
233     f.addStep(git_submodules_update())
234
235     f.addStep(Compile(command=['python', compile_script, id], timeout=3600))
236     f.addStep(Test(command=['python', test_script, id]))
237     f.addStep(ShellCommand(name='package',
238                            command=['python', pack_script, id, branch or Interpolate('%(src:blender:branch)s')],
239                            description='packaging',
240                            descriptionDone='packaged'))
241     if rsync:
242         f.addStep(rsync_step(id, branch, rsync_script))
243     else:
244         f.addStep(FileUpload(name='upload',
245                              workersrc='buildbot_upload.zip',
246                              masterdest=filename,
247                              maxsize=180 * 1024 * 1024,
248                              workdir='install'))
249     f.addStep(MasterShellCommand(name='unpack',
250                                  command=['python2.7', unpack_script, filename],
251                                  description='unpacking',
252                                  descriptionDone='unpacked'))
253     return f
254
255 # Builders
256
257 add_builder(c, 'mac_x86_64_10_9_cmake', 'darwin', generic_builder, hour=1)
258 add_builder(c, 'linux_glibc219_i686_cmake', '', generic_builder, hour=2)
259 add_builder(c, 'linux_glibc219_x86_64_cmake', '', generic_builder, hour=1)
260 add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=1)
261 add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=2)
262 add_builder(c, 'win32_cmake_vc2015', 'windows_vc14', generic_builder, hour=3)
263 add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=4)
264
265 # WWW
266 c['www'] = dict(port=8010)
267
268 # PROJECT IDENTITY
269 c['projectName'] = "Blender"
270 c['projectURL'] = "http://www.blender.org"
271
272 # Buildbot information
273 c['buildbotURL'] = "http://builder.blender.org/"
274 c['buildbotNetUsageData'] = 'basic'
275
276 # Various
277 c['db_url'] = "sqlite:///state.sqlite"