Skip to content

Commit

Permalink
Add buildbot config
Browse files Browse the repository at this point in the history
  • Loading branch information
lwinkler committed Oct 14, 2022
1 parent f43d654 commit 24948b5
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
2 changes: 2 additions & 0 deletions buildbot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
masterdir
workerdir
32 changes: 32 additions & 0 deletions buildbot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
MASTER_DIR=masterdir
WORKER_DIR=workerdir

MASTERHOST=localhost
PORT=9989
WORKERNAME=poplite-worker
PASSWORD=pass

prepare:
pip install -r requirements.txt

create-master:
buildbot create-master -r ${MASTER_DIR}
echo "Please copy master.cfg once to ${MASTER_DIR}"

create-worker:
buildbot-worker create-worker ${WORKER_DIR} ${MASTERHOST}:${PORT} ${WORKERNAME} ${PASSWORD}

start-master:
buildbot start ${MASTER_DIR}

stop-master:
buildbot start ${MASTER_DIR}

start-worker:
buildbot-worker start ${WORKER_DIR}

stop-worker:
buildbot-worker stop ${WORKER_DIR}

update-master:
buildbot reconfig ${MASTER_DIR}
140 changes: 140 additions & 0 deletions buildbot/master.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# -*- python -*-
# ex: set filetype=python:

from buildbot.plugins import *

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.

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

repo_url = "https://github.com/lwinkler/poplite.git"

####### WORKERS

# The 'workers' list defines the set of recognized workers. Each element is
# a Worker object, specifying a unique worker name and password. The same
# worker name and password must be configured on the worker.
c['workers'] = [worker.Worker("poplite-worker", "pass")]

# 'protocols' contains information about protocols which master will use for
# communicating with workers. You must define at least 'port' option that workers
# could connect to your master with this protocol.
# 'port' must match the value configured into the workers (with their
# --master option)
c['protocols'] = {'pb': {'port': 9989}}

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Here we point to the buildbot version of a python hello-world project.

c['change_source'] = []
c['change_source'].append(changes.GitPoller(
repo_url,
workdir='gitpoller-workdir', branch='master',
pollInterval=300))

####### SCHEDULERS

# Configure the Schedulers, which decide how to react to incoming changes. In this
# case, just kick off a 'runtests' build

c['schedulers'] = []
c['schedulers'].append(schedulers.SingleBranchScheduler(
name="all",
change_filter=util.ChangeFilter(branch='master'),
treeStableTimer=None,
builderNames=["runtests"]))
c['schedulers'].append(schedulers.ForceScheduler(
name="force",
builderNames=["runtests"]))

####### BUILDERS

# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
# what steps, and which workers can execute them. Note that any particular build will
# only take place on one worker.

factory = util.BuildFactory()

# check out the source
factory.addStep(steps.Git(
repourl=repo_url,
workdir="src",
mode='incremental')
)
# run the tests (note that this will require that 'trial' is installed)
# factory.addStep(steps.ShellCommand(command=["trial", "hello"],
# env={"PYTHONPATH": "."}))

factory.addStep(steps.CMake(
# generator='Ninja',
workdir="build",
path="../src",
definitions={
# 'CMAKE_BUILD_TYPE': Property('BUILD_TYPE')
},
options=[
# '-Wno-dev'
]
)
)
factory.addStep(steps.Compile(
name = 'build project',
workdir = 'build',
haltOnFailure = True,
warnOnWarnings = True,
command = ["cmake", "--build", ".", "-j6"])
)
factory.addStep(steps.ShellCommand(
name = 'run tests',
workdir = 'build',
haltOnFailure = True,
command = ['ctest'])
)

c['builders'] = []
c['builders'].append(
util.BuilderConfig(name="runtests",
workernames=["poplite-worker"],
factory=factory))

####### BUILDBOT SERVICES

# 'services' is a list of BuildbotService items like reporter targets. The
# status of each build will be pushed to these targets. buildbot/reporters/*.py
# has a variety to choose from, like IRC bots.

c['services'] = []

####### PROJECT IDENTITY

# the 'title' string will appear at the top of this buildbot installation's
# home pages (linked to the 'titleURL').

c['title'] = "Poplite"
c['titleURL'] = repo_url

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

c['buildbotURL'] = "http://localhost:8010/"

# minimalistic config to activate new web UI
c['www'] = dict(port=8010,
plugins=dict(waterfall_view={}, console_view={}, grid_view={}))

####### DB URL

c['db'] = {
# This specifies what database buildbot uses to store its state.
# It's easy to start with sqlite, but it's recommended to switch to a dedicated
# database, such as PostgreSQL or MySQL, for use in production environments.
# http://docs.buildbot.net/current/manual/configuration/global.html#database-specification
'db_url' : "sqlite:///state.sqlite",
}
6 changes: 6 additions & 0 deletions buildbot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
buildbot
buildbot-worker
buildbot-www
buildbot-waterfall-view
buildbot-console-view
buildbot-grid-view

0 comments on commit 24948b5

Please sign in to comment.