diff --git a/buildbot/github_buildbot.py b/buildbot/github_buildbot.py index 6845e495..5dcd4b9e 100755 --- a/buildbot/github_buildbot.py +++ b/buildbot/github_buildbot.py @@ -110,9 +110,7 @@ def render_POST(self, request): repo = payload['repository']['name'] repo_url = payload['repository']['url'] self.private = payload['repository']['private'] - project = request.args.get('project', None) - if project: - project = project[0] + project = repo_url.replace("https://github.com/","") self.process_change(payload, user, repo, repo_url, project, request) return server.NOT_DONE_YET diff --git a/buildbot/master/master.cfg b/buildbot/master/master.cfg index 95b55762..77951f36 100644 --- a/buildbot/master/master.cfg +++ b/buildbot/master/master.cfg @@ -10,8 +10,14 @@ LINUX_SLAVES = ["servo-linux1", "servo-linux2", "servo-linux3"] MAC_SLAVES = ["servo-mac1", "servo-mac2", "servo-mac3"] ANDROID_SLAVES = ["servo-linux-android1"] -c = BuildmasterConfig = {} +# These will lock a project to a single platform +MAC_ONLY_PROJECTS = ['servo/io-surface-rs'] +LINUX_ONLY_PROJECTS = [] +# By default, cargo projects are not build on android. Put them here to add android +ANDROID_PROJECTS = ['mozjs', 'rust-mozjs'] +c = BuildmasterConfig = {} +c['protocols'] = {'pb': {'port': 9001}} c['caches'] = { 'Changes': 1000, 'Builds': 100, @@ -19,59 +25,61 @@ c['caches'] = { } ####### BUILDSLAVES + from buildbot.buildslave import BuildSlave -c['slavePortnum'] = 9001 c['slaves'] = [] for s in LINUX_SLAVES + MAC_SLAVES + ANDROID_SLAVES + HEAD_SLAVES: c['slaves'].append(BuildSlave(s, SLAVE_PASSWORD, max_builds=1)) ####### CHANGESOURCES -from buildbot.changes.pb import PBChangeSource -#def branch_filter(b): -# # grab bors-servo-integration-* and master -# if b == 'refs/heads/master' or b.startswith('refs/heads/bors-servo-integration-'): -# return True -# return False +from buildbot.changes.pb import PBChangeSource c['change_source'] = [] -# DISABLED PbChangeSource because homu generates commit-less pushes to 'auto', -# which the github webhook drops -# c['change_source'].append(PBChangeSource(passwd=CHANGE_PASSWORD)) - -from buildbot.changes.gitpoller import GitPoller -all_branches = ["auto", "master", "try"] -c['change_source'].append(GitPoller( - SERVO_REPO, - workdir='gitpoller-workdir', - branches=all_branches, - pollinterval=60 -)) +c['change_source'].append(PBChangeSource(passwd=CHANGE_PASSWORD)) ####### SCHEDULERS + from buildbot.schedulers.basic import AnyBranchScheduler, SingleBranchScheduler from buildbot.schedulers.forcesched import ForceScheduler from buildbot.schedulers.timed import Nightly from buildbot.changes.filter import ChangeFilter -def bors_filter(c): - if (c.who.startswith('bors-servo') or c.who.startswith('larsbergstrom')) and \ - (c.branch in ["auto", "try"] or c.branch.startswith("bors-servo-integration-")): +def servo_auto_try_filter(c): + if c.project == 'servo/servo' and c.who.startswith('bors-servo') and c.branch in ["auto", "try"]: + return True + return False + +def servo_master_filter(c): + if c.project == 'servo/servo' and c.who.startswith('bors-servo') and c.branch == "master": + return True + return False + +def cargo_linux_filter(c): + if c.project != 'servo/servo' and c.who.startswith('bors-servo') \ + and c.branch == 'auto' and c.project not in MAC_ONLY_PROJECTS: + return True + return False + +def cargo_mac_filter(c): + if c.project != 'servo/servo' and c.who.startswith('bors-servo') \ + and c.branch == 'auto' and c.project not in LINUX_ONLY_PROJECTS: return True return False -def bors_master_filter(c): - if c.who.startswith('bors-servo') and c.branch == "master": +def cargo_android_filter(c): + if c.project != 'servo/servo' and c.who.startswith('bors-servo') \ + and c.branch == 'auto' and c.project in ANDROID_PROJECTS: return True return False c['schedulers'] = [] c['schedulers'].append(AnyBranchScheduler( - name="auto", + name="servo_auto", treeStableTimer=None, builderNames=["linux1", "linux2", "linux3", "mac1", "mac2", "mac3", "android", "gonk"], - change_filter=ChangeFilter(filter_fn=bors_filter), + change_filter=ChangeFilter(filter_fn=bors_auto_try_filter), )) c['schedulers'].append(SingleBranchScheduler( name="doc-push", @@ -90,12 +98,34 @@ c['schedulers'].append(Nightly( hour=1, minute=0 )) +c['schedulers'].append(SingleBranchScheduler( + name="cargo_linux_auto", + treeStableTimer=None, + builderNames=["cargo_linux"], + change_filter=ChangeFilter(filter_fn=cargo_linux_filter) +)] +c['schedulers'].append(SingleBranchScheduler( + name="cargo_mac_auto", + treeStableTimer=None, + builderNames=["cargo_mac"], + change_filter=ChangeFilter(filter_fn=cargo_mac_filter) +)] +# TODO: +# c['schedulers'].append(SingleBranchScheduler( +# name="cargo_android_auto", +# treeStableTimer=None, +# builderNames=["cargo_android"], +# change_filter=ChangeFilter(filter_fn=cargo_android_filter) +# )] + ####### BUILDERS + from buildbot.process.factory import BuildFactory from buildbot.steps.source.git import Git from buildbot.steps.shell import Compile, ShellCommand from buildbot.steps.slave import RemoveDirectory from buildbot.status.builder import SUCCESS +from buildbot.util import Property common_test_env = { 'RUST_BACKTRACE': '1' @@ -253,6 +283,68 @@ mac2_factory_rel.addStep(ShellCommand(command=["./mach", "test-ref", "--kind", " mac2_factory_rel.addStep(ShellCommand(command=["./mach", "test-wpt", "--processes", "4", "--total-chunks", "2", "--this-chunk", "2", "--log-raw", "wpt_raw.log"], env=common_test_env, logfiles={"wpt_raw.log": "wpt_raw.log"})) + +# Cargo builds +# NOTE: We use this instead of Travis CI for some projects, either for platform reasons or because +# Travis CI can't handle them. + +cargo_linux_env = {'PATH': ['${HOME}/.rust/bin', '${PATH}'], + 'LD_LIBRARY_PATH': '${HOME}/.rust/lib'} +cargo_mac_env = {'PATH': ['${HOME}/.rust/bin', '${PATH}'], + 'DYLIB_LIBRARY_PATH': '${HOME}/.rust/lib'} + +cargo_linux_factory = BuildFactory() +cargo_linux_factory.addStep(Git(repourl=Property('repository'), mode="full", method="clobber")) +cargo_linux_factory.addStep(ShellCommand( + name="download rustup", + command=["curl","-sL","https://static.rust-lang.org/rustup.sh","-o","/tmp/rustup.sh"] +)) +cargo_linux_factory.addStep(ShellCommand( + name="install rust", + command=["sh", "/tmp/rustup.sh", "--prefix=~/buildbot/rust", "--channel=nightly", "-y", "--disable-sudo", "--save"], + want_stderr=False +)) +cargo_linux_factory.addStep(ShellCommand( + name="cargo build", + command=["cargo","build","--verbose"], + env=cargo_linux_env +)) +cargo_linux_factory.addStep(ShellCommand( + name="cargo test", + command=["cargo","test","--verbose"], + env=cargo_linux_env +)) +cargo_linux_factory.addStep(RemoveDirectory( + name="cleanup", + dir="~/buildbot/rust" +)) + +cargo_mac_factory = BuildFactory() +cargo_mac_factory.addStep(Git(repourl=Property('repository'), mode="full", method="clobber")) +cargo_mac_factory.addStep(ShellCommand( + name="download rustup", + command=["curl","-sL","https://static.rust-lang.org/rustup.sh","-o","/tmp/rustup.sh"] +)) +cargo_mac_factory.addStep(ShellCommand( + name="install rust", + command=["sh", "/tmp/rustup.sh", "--prefix=~/buildbot/rust", "--channel=nightly", "-y", "--disable-sudo", "--save"], + want_stderr=False +)) +cargo_mac_factory.addStep(ShellCommand( + name="cargo build", + command=["cargo","build","--verbose"], + env=cargo_mac_env +)) +cargo_mac_factory.addStep(ShellCommand( + name="cargo test", + command=["cargo","test","--verbose"], + env=cargo_mac_env +)) +cargo_mac_factory.addStep(RemoveDirectory( + name="cleanup", + dir="~/buildbot/rust" +)) + from buildbot.config import BuilderConfig def branch_priority(builder, requests): @@ -360,8 +452,23 @@ c['builders'].append(BuilderConfig( nextBuild=branch_priority, category="auto", )) +c['builders'].append(BuilderConfig( + name="cargo-linux", + slavenames=LINUX_SLAVES, + factory=cargo_linux_factory, + nextBuild=branch_priority, + category="cargo_auto" +)) +c['builders'].append(BuilderConfig( + name="cargo-mac", + slavenames=MAC_SLAVES, + factory=cargo_mac_factory, + nextBuild=branch_priority, + category="cargo_auto" +)) ####### STATUS TARGETS + from buildbot.status.status_push import HttpStatusPush c['status'] = [] @@ -386,13 +493,13 @@ authz_cfg=authz.Authz( c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) ####### PROJECT IDENTITY + c['title'] = "Servo" c['titleURL'] = "http://github.com/servo/servo" c['buildbotURL'] = "http://build.servo.org/" ####### DB URL + c['db'] = { - # This specifies what database buildbot uses to store its state. You can leave - # this at its default for all but the largest installations. 'db_url': "sqlite:///state.sqlite", }