BuildBot: various changes to support building branches.
[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=''):
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)
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 # generic builder
81
82
83 def generic_builder(id, libdir='', branch=''):
84     filename = 'buildbot_upload_' + id + '.zip'
85     compile_script = '../blender/build_files/buildbot/slave_compile.py'
86     test_script = '../blender/build_files/buildbot/slave_test.py'
87     pack_script = '../blender/build_files/buildbot/slave_pack.py'
88     unpack_script = 'master_unpack.py'
89
90     f = BuildFactory()
91     f.addStep(svn_step(branch))
92     if libdir != '':
93         f.addStep(lib_svn_step(libdir))
94
95     f.addStep(Compile(command=['python', compile_script, id]))
96     f.addStep(Test(command=['python', test_script, id]))
97     f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged'))
98     if id.find('cmake') != -1:
99         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
100     else:
101         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
102     f.addStep(MasterShellCommand(name='unpack', command=['python', unpack_script, filename], description='unpacking', descriptionDone='unpacked'))
103     return f
104
105 # builders
106
107 add_builder(c, 'mac_x86_64_scons', 'darwin-9.x.universal', generic_builder)
108 add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad')
109 add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder)
110 add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder)
111 #add_builder(c, 'linux_x86_64_cmake', '', generic_builder)
112 add_builder(c, 'linux_i386_scons', '', generic_builder)
113 add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad')
114 add_builder(c, 'linux_x86_64_scons', '', generic_builder)
115 add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad')
116 add_builder(c, 'win32_scons', 'windows', generic_builder)
117 add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
118 #add_builder(c, 'freebsd_i386_cmake', '', generic_builder)
119 #add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder)
120
121 # SCHEDULERS
122 #
123 # Decide how to react to incoming changes.
124
125 # from buildbot.scheduler import Scheduler
126 from buildbot.schedulers import timed
127
128 c['schedulers'] = []
129 #c['schedulers'].append(Scheduler(name="all", branch=None,
130 #                                 treeStableTimer=None,
131 #                                 builderNames=[]))
132 #c['schedulers'].append(timed.Periodic(name="nightly",
133 #                        builderNames=buildernames,
134 #                        periodicBuildTimer=24*60*60))
135
136 c['schedulers'].append(timed.Nightly(name='nightly',
137     builderNames=buildernames,
138     hour=3,
139     minute=0))
140
141 # STATUS TARGETS
142 #
143 # 'status' is a list of Status Targets. The results of each build will be
144 # pushed to these targets. buildbot/status/*.py has a variety to choose from,
145 # including web pages, email senders, and IRC bots.
146
147 c['status'] = []
148
149 from buildbot.status import html
150 from buildbot.status.web import authz
151
152 authz_cfg = authz.Authz(
153     # change any of these to True to enable; see the manual for more
154     # options
155     gracefulShutdown=False,
156     forceBuild=True,  # use this to test your slave once it is set up
157     forceAllBuilds=False,
158     pingBuilder=False,
159     stopBuild=False,
160     stopAllBuilds=False,
161     cancelPendingBuild=True,
162 )
163
164 c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
165
166 # PROJECT IDENTITY
167
168 c['projectName'] = "Blender"
169 c['projectURL'] = "http://www.blender.org"
170
171 # the 'buildbotURL' string should point to the location where the buildbot's
172 # internal web server (usually the html.WebStatus page) is visible. This
173 # typically uses the port number set in the Waterfall 'status' entry, but
174 # with an externally-visible host name which the buildbot cannot figure out
175 # without some help.
176
177 c['buildbotURL'] = "http://builder.blender.org/"
178
179 # DB URL
180 #
181 # This specifies what database buildbot uses to store change and scheduler
182 # state.  You can leave this at its default for all but the largest
183 # installations.
184
185 c['db_url'] = "sqlite:///state.sqlite"