OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace / lib / buildbot-master.cfg

323 lines · cfg ref:
# -*- python -*-
# ex: set syntax=python:

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').

# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .


# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}

####### BUILDSLAVES

# the 'slaves' list defines the set of allowable buildslaves. Each element is
# a BuildSlave object, which is created with bot-name, bot-password.  These
# correspond to values given to the buildslave's mktap invocation.
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("localbuildslave", "")]

# to limit to two concurrent builds on a slave, use
#  c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)]


# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)

c['slavePortnum'] = 9991

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.

from buildbot.changes.pb import PBChangeSource
c['change_source'] = [PBChangeSource()]

# Damn, bzr poller is broken... check:
# http://github.com/buildbot/buildbot/tree/
#from bzr_buildbot import BzrPoller, SHORT
#c['change_source'] = [PBChangeSource(),
	#BzrPoller("lp:~opencog-dev/opencog",branch_name=SHORT)]

# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
#pb = ConfigurationSet([
#    (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)),
#    ])

# then you could use the following buildmaster Change Source to subscribe to
# the FreshCVS daemon and be notified on every commit:
#
#from buildbot.changes.freshcvs import FreshCVSSource
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar")
#c['change_source'] = fc_source

# or, use a PBChangeSource, and then have your repository's commit script run
# 'buildbot sendchange', or use contrib/svn_buildbot.py, or
# contrib/arch_buildbot.py :
#
#from buildbot.changes.pb import PBChangeSource
#c['change_source'] = PBChangeSource()

# If you wat to use SVNPoller, it might look something like
#  # Where to get source code changes
# from buildbot.changes.svnpoller import SVNPoller
# source_code_svn_url='https://svn.myproject.org/bluejay/trunk'
# svn_poller = SVNPoller(
#                    svnurl=source_code_svn_url,
#                    pollinterval=60*60, # seconds
#                    histmax=10,
#                    svnbin='/usr/bin/svn',
## )
# c['sources'] = [ svn_poller ]

####### SCHEDULERS

## configure the Schedulers

# if the bzr poller worked then this would be ideal
from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch=None,
                                 treeStableTimer=2*60,
                                 builderNames=["opencog-full"]))


# just build every 24 hours until bzr poller is fixed
from buildbot.scheduler import Periodic
daily = Periodic(name="daily",
	     builderNames=["opencog-full","doxygen"],
	     periodicBuildTimer=24*60*60)
c['schedulers'].append(daily)

from buildbot.scheduler import Nightly
nightly_cppcheck = Nightly(name="cppcheck",
	     builderNames=["cppcheck"],
	     hour=11, minute=0)
c['schedulers'].append(nightly_cppcheck)

####### BUILDERS

# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
#  name (required): the name used to describe this builder
#  slavename (required): which slave to use (must appear in c['bots'])
#  builddir (required): which subdirectory to run the builder in
#  factory (required): a BuildFactory to define how the build is run
#  periodicBuildTime (optional): if set, force a build every N seconds

# buildbot/process/factory.py provides several BuildFactory classes you can
# start with, which implement build processes for common targets (GNU
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the
# base class, and is configured with a series of BuildSteps. When the build
# is run, the appropriate buildslave is told to execute each Step in turn.

# the first BuildStep is typically responsible for obtaining a copy of the
# sources. There are source-obtaining Steps in buildbot/steps/source.py for
# CVS, SVN, and others.

from buildbot.process import factory
from buildbot.steps.source import Bzr
from buildbot.steps.shell import Compile
from buildbot.steps.shell import Configure
from buildbot.steps.shell import ShellCommand
from buildbot.steps.shell import Test
from buildbot.steps.python_twisted import Trial

c['builders'] = []

import os.path

#src_dir = "src"
cmake_build_dir = "bin"

f1 = factory.BuildFactory()
f1.workdir="opencogfull"
# set up repo
f1.addStep(Bzr(mode="copy", baseURL="lp:~opencog-dev/opencog/", defaultBranch="trunk"))
f1.addStep(ShellCommand(description=["copy","test config"],command=["cp", "../../opencog-test.conf", "lib/."]))
f1.addStep(ShellCommand(command=["mkdir","-p",
            cmake_build_dir],want_stdout=False,
            description="mkbuilddir"))
f1.addStep(Configure(workdir=os.path.join("build",cmake_build_dir), command=["cmake", "..", "-DBOOST_ROOT=/usr/local"]))
f1.addStep(Compile(workdir=os.path.join("build",cmake_build_dir),
            command=["make"]))
f1.addStep(Compile(workdir=os.path.join("build",cmake_build_dir),
            command=["make", "examples"],
            description=["compiling","examples"]))
f1.addStep(Compile(workdir=os.path.join("build",cmake_build_dir),
            command=["make", "tests"],
            description=["compiling","tests"]))
f1.addStep(Test(workdir=os.path.join("build",cmake_build_dir),timeout=5400))
#f1.addStep(Trial(testChanges=True, testpath="."))

b1 = {'name': "opencog-full",
      'slavenames': ["localbuildslave"],
      'builddir': "trunk",
      'factory': f1,
      }
c['builders'].append(b1)

from buildbot.steps.transfer import DirectoryUpload

f_doxygen = factory.BuildFactory()
f_doxygen.workdir="doxygen"
# Check out source and configure, just in case buildslave is *only* creating
# doxygen output
f_doxygen.addStep(Bzr(mode="copy",baseURL="lp:~opencog-dev/opencog/", defaultBranch="trunk"))
f_doxygen.addStep(ShellCommand(command=["mkdir","-p",
            cmake_build_dir],want_stdout=False,
            description="mkbuilddir"))
f_doxygen.addStep(Configure(workdir=os.path.join("build",cmake_build_dir), command=["cmake", "..", "-DBOOST_ROOT=/usr/local"]))
# Now run the actual doxygen stuff
f_doxygen.addStep(ShellCommand(workdir=os.path.join("build",cmake_build_dir),
            command=["make","doxygen"],want_stdout=True,want_stderr=True,
            description=["generate","doxygen"]))
# copy the output directory back to the master
f_doxygen.addStep(
        DirectoryUpload(slavesrc=os.path.join(cmake_build_dir,"doc"),
                        masterdest="public_html/doc"))

b_doxygen = {'name':"doxygen",
    'slavename':"localbuildslave",
    'builddir': "doxygen",
    'slavebuilddir': "doxygen",
    'factory': f_doxygen,
}
c['builders'].append(b_doxygen)

### cppcheck
f_cppcheck = factory.BuildFactory()
f_cppcheck.workdir="cppcheck"
# Check out source and configure, just in case buildslave is *only* running 
# cppcheck
f_cppcheck.addStep(Bzr(mode="copy",baseURL="lp:~opencog-dev/opencog/", defaultBranch="trunk"))
# Now run the actual cppcheck stuff
f_cppcheck.addStep(ShellCommand(workdir=os.path.join("build"),
            command=["cppcheck","opencog","--enable=all","--template","gcc"],
            want_stdout=True,want_stderr=True,
            description=["cppcheck"]))

b_cppcheck = {'name':"cppcheck",
    'slavename':"localbuildslave",
    'builddir': "cppcheck",
    'slavebuilddir': "cppcheck",
    'factory': f_cppcheck,
}
c['builders'].append(b_cppcheck)

### Coverage testing
f_lcov = factory.BuildFactory()
f_lcov.workdir="coverage"
cmake_build_dir = "bin_cov"
# Check out source and configure, just in case buildslave is *only* creating
# coverage
f_lcov.addStep(Bzr(mode="copy",baseURL="lp:~opencog-dev/opencog/", defaultBranch="trunk"))
f_lcov.addStep(ShellCommand(description=["copy","test config"],command=["cp", "../../opencog-test.conf", "lib/."]))
f_lcov.addStep(ShellCommand(command=["mkdir","-p",
            cmake_build_dir],want_stdout=False,
            description="mkbuilddir"))
f_lcov.addStep(Configure(workdir=os.path.join("build",cmake_build_dir),
            command=["cmake", "-DCMAKE_BUILD_TYPE=Coverage", ".."]))
# Now run the tests
f_lcov.addStep(Compile(workdir=os.path.join("build",cmake_build_dir),
            command=["make"]))
f_lcov.addStep(Compile(workdir=os.path.join("build",cmake_build_dir),
            command=["make", "tests"],
            description=["compiling","tests"]))
f_lcov.addStep(Test(workdir=os.path.join("build",cmake_build_dir),
            description=["testing","w. coverage"],warnOnFailure=True,haltOnFailure=False,timeout=5400))
#f_lcov.addStep(ShellCommand(workdir=os.path.join("build",cmake_build_dir),
#            command=["make","test"],want_stdout=True,want_stderr=False,
#            description=["testing","w. coverage"],warnOnFailure=True,haltOnFailure=False))
# Combining the coverage output and generating html
f_lcov.addStep(ShellCommand(workdir=os.path.join("build",cmake_build_dir),
            command=["../scripts/combine_lcov.sh"],want_stdout=True,want_stderr=True,
            description=["generating","html"],timeout=3600))
# copy the output directory back to the master
f_lcov.addStep(
        DirectoryUpload(slavesrc=os.path.join(cmake_build_dir,"lcov"),
                        masterdest="public_html/lcov"))

b_lcov = {'name':"coverage",
    'slavename':"localbuildslave",
    'builddir': "lcov",
    'slavebuilddir': "lcov",
    'factory': f_lcov,
}
c['builders'].append(b_lcov)



####### 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'] = []

# Use allowForce=True (boolean, not a string. ie: not 'True') to allow
# Forcing Builds in the Web User Interface. The default is False.
from buildbot.status import html
c['status'].append(html.WebStatus(http_port=8010,allowForce=True))

# from buildbot.status import mail
# c['status'].append(mail.MailNotifier(fromaddr="buildbot@localhost",
#                                      extraRecipients=["builds@example.com"],
#                                      sendToInterestedUsers=False))
#
from buildbot.status import words
c['status'].append(words.IRC(host="irc.freenode.org", nick="ocbuild",
                              channels=["#opencog"]))
#
from buildbot.status import client
c['status'].append(client.PBListener(9988))


####### DEBUGGING OPTIONS

# if you set 'debugPassword', then you can connect to the buildmaster with
# the diagnostic tool in contrib/debugclient.py . From this tool, you can
# manually force builds and inject changes, which may be useful for testing
# your buildmaster without actually committing changes to your repository (or
# before you have a functioning 'sources' set up). The debug tool uses the
# same port number as the slaves do: 'slavePortnum'.

#c['debugPassword'] = "debugpassword"

# if you set 'manhole', you can ssh into the buildmaster and get an
# interactive python shell, which may be useful for debugging buildbot
# internals. It is probably only useful for buildbot developers. You can also
# use an authorized_keys file, or plain telnet.
#from buildbot import manhole
#c['manhole'] = manhole.PasswordManhole("tcp:9999:interface=127.0.0.1",
#                                       "admin", "password")


####### PROJECT IDENTITY

# the 'projectName' string will be used to describe the project that this
# buildbot is working on. For example, it is used as the title of the
# waterfall HTML page. The 'projectURL' string will be used to provide a link
# from buildbot HTML pages to your project's home page.

c['projectName'] = "OpenCog"
c['projectURL'] = "http://opencog.org/"

# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server (usually the html.Waterfall page) is visible. This
# typically uses the port number set in the Waterfall 'status' entry, but
# with an externally-visible host name which the buildbot cannot figure out
# without some help.

c['buildbotURL'] = "http://buildbot.opencog.org/"