読者です 読者をやめる 読者になる 読者になる

buildbotでgithubのperlプロジェクトをContinuous Integration

angelosの仕様も固まってきたので、Continuous Integration環境を整えて定期的にビルドできるようにしてみました。30分毎にgithubからチェックアウトして、make testしてます。

以下、buildbotのmaster.cfg

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

####### BUILDSLAVES
# the 'bots' list defines the set of allowable buildslaves. Each element is a
# tuple of bot-name and bot-password. 
c['bots'] = [("angelos-bot","xxx")]

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

####### SCHEDULERS
## configure the Schedulers.  When to run builds
from buildbot import scheduler
#daily = scheduler.Periodic("daily", ["angelos-builder"], 24*60*60)
daily = scheduler.Periodic("daily", ["angelos-builder"], 1*60*30)
code_changed = scheduler.Scheduler(name="code_changed",
    branch=None,
    treeStableTimer=10*60,
    builderNames=["angelos-builder"])
c['schedulers'] = [ daily,code_changed ]

####### BUILDERS
# How to build the software
repourl = "git://github.com/dann/angelos.git"
builders = []

from buildbot.process import factory
from buildbot.steps import shell

f1 = factory.BuildFactory()
f1.addStep(
    shell.ShellCommand, 
    description="clean out build dir", 
    command=["rm", "-rf", "angelos"],  
    workdir="angelos/dist")
f1.addStep(
    shell.ShellCommand, 
    description="checkout angelos", 
    command=["git","clone", repourl],  
    workdir="angelos/dist")
f1.addStep(
    shell.ShellCommand, 
    description="generate makefile", 
    command=["perl", "Makefile.PL"], 
    workdir="angelos/dist/angelos")
f1.addStep(
    shell.ShellCommand, 
    description="make",
    command=["make"], 
    name="make",
    workdir="angelos/dist/angelos")
f1.addStep(
    shell.ShellCommand,
    description="make test", 
    command=["make",
    "test", "TEST_VERBOSE=1"],
    workdir="angelos/dist/angelos")
angelos_builder = {'name': "angelos-builder",
      'slavename': "angelos-bot",
      'builddir': "Angelos",
      'factory': f1,
      }
c['builders'] = [angelos_builder]

####### STATUS TARGETS
from buildbot.status import html
from buildbot.status import words
htmlStatus = html.Waterfall(http_port=8010)
ircStatus = words.IRC(host="irc.freenode.net", nick="buildbot",
                              channels=["#angelos"])
c['status'] = [htmlStatus,ircStatus]

####### PROJECT IDENTITY
c['projectName'] = "Angelos"
c['projectURL'] = "http://github.com/dann/angelos/tree/master"
c['buildbotURL'] = "http://xxx:8010/"