<commit_before># -*- python -*-
# ex: set syntax=python:

from buildbot.plugins import *
from buildbot.status.results import SUCCESS

from passwords import HTTP_USERNAME, HTTP_PASSWORD, SLAVE_PASSWORD, CHANGE_PASSWORD
from passwords import GITHUB_DOC_TOKEN, GITHUB_STATUS_TOKEN, HOMU_BUILDBOT_SECRET

SERVO_REPO = "https://github.com/servo/servo"
LINUX_RESERVED_SLAVES = ["servo-linux1", "servo-linux2"]
MAC_SLAVES = ["servo-mac1", "servo-mac2", "servo-mac3"]
CROSS_SLAVES = ["servo-linux-cross1", "servo-linux-cross2"]
WINDOWS_SLAVES = ["servo-windows1"]

c = BuildmasterConfig = {}
c['protocols'] = {'pb': {'port': 9001}}
c['caches'] = {
    'Changes': 1000,
    'Builds': 100,
    'chdicts': 1000,
}

####### BUILDSLAVES

c['slaves'] = []
for s in MAC_SLAVES + CROSS_SLAVES + LINUX_RESERVED_SLAVES + WINDOWS_SLAVES:
    c['slaves'].append(buildslave.BuildSlave(s, SLAVE_PASSWORD, max_builds=1))

####### CHANGESOURCES

c['change_source'] = []
c['change_source'].append(changes.PBChangeSource(passwd=CHANGE_PASSWORD))

####### SCHEDULERS

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

c['schedulers'] = []
c['schedulers'].append(schedulers.AnyBranchScheduler(
    name="servo-auto",
    treeStableTimer=None,
    builderNames=["linux-dev", "linux-rel", "mac-rel-wpt", "mac-dev-unit", "mac-rel-css", "android", "gonk", "arm32", "arm64", "windows"],
    change_filter=util.ChangeFilter(filter_fn=servo_auto_try_filter),
))
c['schedulers'].append(schedulers.SingleBranchScheduler(
    name="doc-push",
    treeStableTimer=None,
    builderNames=["doc"],
    change_filter=util.ChangeFilter(filter_fn=servo_master_filter),
))
c['schedulers'].append(schedulers.ForceScheduler(
    name="force",
    builderNames=["linux-dev", "linux-rel", "mac-rel-wpt", "mac-dev-unit", "mac-rel-css", "android", "gonk", "arm32", "arm64", "android-nightly", "windows"]
))
c['schedulers'].append(schedulers.Nightly(
    name="Nightly",
    branch="master",
    builderNames=["android-nightly"],
    hour=1,
    minute=0
))

####### BUILDERS

def create_factory(commands):
    factory = util.BuildFactory()
    for command in commands:
        factory.addStep(command)
    return factory


def create_servo_factory(commands):
    return create_factory([
        steps.Git(repourl=SERVO_REPO, mode="full", method="clobber"),
    ] + commands)


common_test_env = {
    'RUST_BACKTRACE': '1'
}

linux_test_env = dict({
    'DISPLAY': ':0',
    'CARGO_HOME': '{{ common.servo_home }}/.cargo',
    'CCACHE': '/usr/bin/ccache',
    'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo',
    'SHELL': '/bin/bash'
}, **common_test_env)
linux_headless_env = dict({'SERVO_HEADLESS': '1'}, **linux_test_env)

mac_test_env = dict({
    'CARGO_HOME': '{{ common.servo_home }}/.cargo',
    'CCACHE': '/usr/local/bin/ccache',
    'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo'
}, **common_test_env)

linux_dev_factory = create_servo_factory([
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress", "--self-test"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build", "--dev"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-compiletest"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-unit"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-cef"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-geckolib"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=linux_headless_env),
])

linux_rel_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--release"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-wpt-failure"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-wpt", "--release", "--processes", "24",
                                "--log-raw", "test-wpt.log"],
                       env=linux_headless_env, logfiles={"test-wpt.log": "test-wpt.log"}),
    #steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-wpt.log"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-css", "--release", "--processes", "16",
                                "--log-raw", "test-css.log"],
                       env=linux_headless_env, logfiles={"test-css.log": "test-css.log"}),
    #steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-css.log"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-cef", "--release"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-geckolib", "--release"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/check_no_unwrap.sh"], env=linux_headless_env),
])

mac_rel_wpt_factory = create_servo_factory([
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress"]),
    steps.Compile(command=["./mach", "build", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-wpt-failure"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-wpt", "--release", "--processes", "4",
                                "--log-raw", "test-wpt.log"],
                       env=mac_test_env, logfiles={"test-wpt.log": "test-wpt.log"}),
    steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-wpt.log"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "build-cef", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

mac_dev_unit_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--dev"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-unit"], env=mac_test_env),
    steps.Compile(command=["./mach", "build-cef"], env=mac_test_env),
    steps.Compile(command=["./mach", "build-geckolib"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

mac_rel_css_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-css", "--release", "--processes", "4",
                                "--log-raw", "test-css.log"],
                       env=mac_test_env, logfiles={"test-css.log": "test-css.log"}),
    steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-css.log"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "build-geckolib", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

android_compile_env = dict({'ANDROID_SDK': '{{ common.servo_home }}/android/sdk/current/',
                            'ANDROID_NDK': '{{ common.servo_home }}/android/ndk/current/',
                            'ANDROID_TOOLCHAIN': '{{ common.servo_home }}/android/toolchain/current/',
                            'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:{{ common.servo_home }}/android/sdk/current/platform-tools:{{ common.servo_home }}/android/toolchain/current/bin'},
                           **linux_test_env)
android_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--android", "--dev"], env=android_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=android_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=android_compile_env),
    steps.ShellCommand(command=["python", "./etc/ci/check_dynamic_symbols.py"], env=android_compile_env),
])

android_nightly_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--android", "--release"], env=android_compile_env),
    steps.Compile(command=["./mach", "package", "-r"], env=android_compile_env),
    steps.ShellCommand(command=["s3cmd", "put",
                                "{{ common.servo_home }}/buildbot/slave/android-nightly/build/target/arm-linux-androideabi/release/servo.apk",
                                "s3://servo-rust/nightly/servo.apk"]),
])

gonk_compile_env = dict({'ANDROID_SDK': '{{ common.servo_home }}/android/sdk/current/',
                         'ANDROID_NDK': '{{ common.servo_home }}/android/ndk/current/',
                         'ANDROID_TOOLCHAIN': '{{ common.servo_home }}/android/toolchain/current/',
                         'GONKDIR': '{{ common.servo_home }}/B2G/',
                         'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:{{ common.servo_home }}/B2G/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin'},
                        **linux_test_env)

gonk_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build-gonk"], env=gonk_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=gonk_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=gonk_compile_env),
])

arm32_compile_env = dict({'PATH': '{{ common.servo_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
                          'BUILD_TARGET': 'arm-unknown-linux-gnueabihf',
                          'PKG_CONFIG_ALLOW_CROSS': '1',
                          'PKG_CONFIG_PATH': '/usr/lib/arm-linux-gnueabihf/pkgconfig',
                          'EXPAT_NO_PKG_CONFIG': '1',
                          'FREETYPE2_NO_PKG_CONFIG': '1',
                          'FONTCONFIG_NO_PKG_CONFIG': '1',
                          'CC': 'arm-linux-gnueabihf-gcc',
                          'CXX': 'arm-linux-gnueabihf-g++'},
                        **linux_test_env)
arm32_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--rel", "--target=arm-unknown-linux-gnueabihf"], env=arm32_compile_env),
])

arm64_compile_env = dict({'PATH': '{{ common.servo_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
                          'BUILD_TARGET': 'aarch64-unknown-linux-gnu',
                          'PKG_CONFIG_ALLOW_CROSS': '1',
                          'PKG_CONFIG_PATH': '/usr/lib/aarch64-linux-gnu/pkgconfig',
                          'EXPAT_NO_PKG_CONFIG': '1',
                          'FREETYPE2_NO_PKG_CONFIG': '1',
                          'FONTCONFIG_NO_PKG_CONFIG': '1',
                          'CC': 'aarch64-linux-gnu-gcc',
                          'SERVO_RUSTC_WITH_GOLD': 'False',
                          'CXX': 'aarch64-linux-gnu-g++'},
                        **linux_test_env)
arm64_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--rel", "--target=aarch64-unknown-linux-gnu"], env=arm64_compile_env),
])

windows_compile_env = dict({'PATH': r'C:\msys64\mingw64\bin;C:\msys64\usr\bin\C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap',
                            'MSYSTEM': 'MINGW64',
                            'MSYS': 'winsymlinks=lnk'},
                           **common_test_env)

windows_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "-d", "-v"], env=windows_compile_env),
    steps.Compile(command=["./mach", "test-unit"], env=windows_compile_env),
])

doc_factory = create_servo_factory([
    steps.ShellCommand(command=["etc/ci/upload_docs.sh"],
                       env={'TOKEN': GITHUB_DOC_TOKEN,
                            'CARGO_HOME': '{{ common.servo_home }}/.cargo',
                            'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo',
                            'SHELL': '/bin/bash'},
                       # important not to leak token
                       logEnviron=False),
])

def branch_priority(builder, requests):
    for r in requests:
        if r.source.branch != "try":
            return r
    return requests[0]

c['builders'] = []<commit_msg>use bash to run the mach stuff<commit_after># -*- python -*-
# ex: set syntax=python:

from buildbot.plugins import *
from buildbot.status.results import SUCCESS

from passwords import HTTP_USERNAME, HTTP_PASSWORD, SLAVE_PASSWORD, CHANGE_PASSWORD
from passwords import GITHUB_DOC_TOKEN, GITHUB_STATUS_TOKEN, HOMU_BUILDBOT_SECRET

SERVO_REPO = "https://github.com/servo/servo"
LINUX_RESERVED_SLAVES = ["servo-linux1", "servo-linux2"]
MAC_SLAVES = ["servo-mac1", "servo-mac2", "servo-mac3"]
CROSS_SLAVES = ["servo-linux-cross1", "servo-linux-cross2"]
WINDOWS_SLAVES = ["servo-windows1"]

c = BuildmasterConfig = {}
c['protocols'] = {'pb': {'port': 9001}}
c['caches'] = {
    'Changes': 1000,
    'Builds': 100,
    'chdicts': 1000,
}

####### BUILDSLAVES

c['slaves'] = []
for s in MAC_SLAVES + CROSS_SLAVES + LINUX_RESERVED_SLAVES + WINDOWS_SLAVES:
    c['slaves'].append(buildslave.BuildSlave(s, SLAVE_PASSWORD, max_builds=1))

####### CHANGESOURCES

c['change_source'] = []
c['change_source'].append(changes.PBChangeSource(passwd=<PASSWORD>))

####### SCHEDULERS

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

c['schedulers'] = []
c['schedulers'].append(schedulers.AnyBranchScheduler(
    name="servo-auto",
    treeStableTimer=None,
    builderNames=["linux-dev", "linux-rel", "mac-rel-wpt", "mac-dev-unit", "mac-rel-css", "android", "gonk", "arm32", "arm64", "windows"],
    change_filter=util.ChangeFilter(filter_fn=servo_auto_try_filter),
))
c['schedulers'].append(schedulers.SingleBranchScheduler(
    name="doc-push",
    treeStableTimer=None,
    builderNames=["doc"],
    change_filter=util.ChangeFilter(filter_fn=servo_master_filter),
))
c['schedulers'].append(schedulers.ForceScheduler(
    name="force",
    builderNames=["linux-dev", "linux-rel", "mac-rel-wpt", "mac-dev-unit", "mac-rel-css", "android", "gonk", "arm32", "arm64", "android-nightly", "windows"]
))
c['schedulers'].append(schedulers.Nightly(
    name="Nightly",
    branch="master",
    builderNames=["android-nightly"],
    hour=1,
    minute=0
))

####### BUILDERS

def create_factory(commands):
    factory = util.BuildFactory()
    for command in commands:
        factory.addStep(command)
    return factory


def create_servo_factory(commands):
    return create_factory([
        steps.Git(repourl=SERVO_REPO, mode="full", method="clobber"),
    ] + commands)


common_test_env = {
    'RUST_BACKTRACE': '1'
}

linux_test_env = dict({
    'DISPLAY': ':0',
    'CARGO_HOME': '{{ common.servo_home }}/.cargo',
    'CCACHE': '/usr/bin/ccache',
    'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo',
    'SHELL': '/bin/bash'
}, **common_test_env)
linux_headless_env = dict({'SERVO_HEADLESS': '1'}, **linux_test_env)

mac_test_env = dict({
    'CARGO_HOME': '{{ common.servo_home }}/.cargo',
    'CCACHE': '/usr/local/bin/ccache',
    'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo'
}, **common_test_env)

linux_dev_factory = create_servo_factory([
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress", "--self-test"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build", "--dev"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-compiletest"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-unit"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-cef"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-geckolib"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=linux_headless_env),
])

linux_rel_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--release"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-wpt-failure"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-wpt", "--release", "--processes", "24",
                                "--log-raw", "test-wpt.log"],
                       env=linux_headless_env, logfiles={"test-wpt.log": "test-wpt.log"}),
    #steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-wpt.log"], env=linux_headless_env),
    steps.ShellCommand(command=["./mach", "test-css", "--release", "--processes", "16",
                                "--log-raw", "test-css.log"],
                       env=linux_headless_env, logfiles={"test-css.log": "test-css.log"}),
    #steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-css.log"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-cef", "--release"], env=linux_headless_env),
    steps.Compile(command=["./mach", "build-geckolib", "--release"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=linux_headless_env),
    steps.ShellCommand(command=["bash", "./etc/ci/check_no_unwrap.sh"], env=linux_headless_env),
])

mac_rel_wpt_factory = create_servo_factory([
    steps.ShellCommand(command=["./mach", "test-tidy", "--no-progress"]),
    steps.Compile(command=["./mach", "build", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-wpt-failure"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-wpt", "--release", "--processes", "4",
                                "--log-raw", "test-wpt.log"],
                       env=mac_test_env, logfiles={"test-wpt.log": "test-wpt.log"}),
    steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-wpt.log"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "build-cef", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

mac_dev_unit_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--dev"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-unit"], env=mac_test_env),
    steps.Compile(command=["./mach", "build-cef"], env=mac_test_env),
    steps.Compile(command=["./mach", "build-geckolib"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

mac_rel_css_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "test-css", "--release", "--processes", "4",
                                "--log-raw", "test-css.log"],
                       env=mac_test_env, logfiles={"test-css.log": "test-css.log"}),
    steps.ShellCommand(command=["pkill", "-x", "servo"], decodeRC={0: SUCCESS, 1: SUCCESS}),
    steps.ShellCommand(command=["gzip", "test-css.log"], env=mac_test_env),
    steps.ShellCommand(command=["./mach", "build-geckolib", "--release"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=mac_test_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=mac_test_env),
])

android_compile_env = dict({'ANDROID_SDK': '{{ common.servo_home }}/android/sdk/current/',
                            'ANDROID_NDK': '{{ common.servo_home }}/android/ndk/current/',
                            'ANDROID_TOOLCHAIN': '{{ common.servo_home }}/android/toolchain/current/',
                            'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:{{ common.servo_home }}/android/sdk/current/platform-tools:{{ common.servo_home }}/android/toolchain/current/bin'},
                           **linux_test_env)
android_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--android", "--dev"], env=android_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=android_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=android_compile_env),
    steps.ShellCommand(command=["python", "./etc/ci/check_dynamic_symbols.py"], env=android_compile_env),
])

android_nightly_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--android", "--release"], env=android_compile_env),
    steps.Compile(command=["./mach", "package", "-r"], env=android_compile_env),
    steps.ShellCommand(command=["s3cmd", "put",
                                "{{ common.servo_home }}/buildbot/slave/android-nightly/build/target/arm-linux-androideabi/release/servo.apk",
                                "s3://servo-rust/nightly/servo.apk"]),
])

gonk_compile_env = dict({'ANDROID_SDK': '{{ common.servo_home }}/android/sdk/current/',
                         'ANDROID_NDK': '{{ common.servo_home }}/android/ndk/current/',
                         'ANDROID_TOOLCHAIN': '{{ common.servo_home }}/android/toolchain/current/',
                         'GONKDIR': '{{ common.servo_home }}/B2G/',
                         'PATH': '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:{{ common.servo_home }}/B2G/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin'},
                        **linux_test_env)

gonk_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build-gonk"], env=gonk_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/lockfile_changed.sh"], env=gonk_compile_env),
    steps.ShellCommand(command=["bash", "./etc/ci/manifest_changed.sh"], env=gonk_compile_env),
])

arm32_compile_env = dict({'PATH': '{{ common.servo_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
                          'BUILD_TARGET': 'arm-unknown-linux-gnueabihf',
                          'PKG_CONFIG_ALLOW_CROSS': '1',
                          'PKG_CONFIG_PATH': '/usr/lib/arm-linux-gnueabihf/pkgconfig',
                          'EXPAT_NO_PKG_CONFIG': '1',
                          'FREETYPE2_NO_PKG_CONFIG': '1',
                          'FONTCONFIG_NO_PKG_CONFIG': '1',
                          'CC': 'arm-linux-gnueabihf-gcc',
                          'CXX': 'arm-linux-gnueabihf-g++'},
                        **linux_test_env)
arm32_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--rel", "--target=arm-unknown-linux-gnueabihf"], env=arm32_compile_env),
])

arm64_compile_env = dict({'PATH': '{{ common.servo_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin',
                          'BUILD_TARGET': 'aarch64-unknown-linux-gnu',
                          'PKG_CONFIG_ALLOW_CROSS': '1',
                          'PKG_CONFIG_PATH': '/usr/lib/aarch64-linux-gnu/pkgconfig',
                          'EXPAT_NO_PKG_CONFIG': '1',
                          'FREETYPE2_NO_PKG_CONFIG': '1',
                          'FONTCONFIG_NO_PKG_CONFIG': '1',
                          'CC': 'aarch64-linux-gnu-gcc',
                          'SERVO_RUSTC_WITH_GOLD': 'False',
                          'CXX': 'aarch64-linux-gnu-g++'},
                        **linux_test_env)
arm64_factory = create_servo_factory([
    steps.Compile(command=["./mach", "build", "--rel", "--target=aarch64-unknown-linux-gnu"], env=arm64_compile_env),
])

windows_compile_env = dict({'PATH': r'C:\msys64\mingw64\bin;C:\msys64\usr\bin\C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap',
                            'MSYSTEM': 'MINGW64',
                            'MSYS': 'winsymlinks=lnk'},
                           **common_test_env)

windows_factory = create_servo_factory([
    steps.Compile(command=["bash", "-l", "-c", "./mach build -d -v"], env=windows_compile_env),
    steps.Compile(command=["bash", "-l", "-c", "./mach test-unit"], env=windows_compile_env),
])

doc_factory = create_servo_factory([
    steps.ShellCommand(command=["etc/ci/upload_docs.sh"],
                       env={'TOKEN': GITHUB_DOC_TOKEN,
                            'CARGO_HOME': '{{ common.servo_home }}/.cargo',
                            'SERVO_CACHE_DIR': '{{ common.servo_home }}/.servo',
                            'SHELL': '/bin/bash'},
                       # important not to leak token
                       logEnviron=False),
])

def branch_priority(builder, requests):
    for r in requests:
        if r.source.branch != "try":
            return r
    return requests[0]

c['builders'] = []
{'fraction_non_alphanumeric': 0.1911094224924012, 'fraction_numerical': 0.008206686930091186, 'mean_word_length': 3.329823984207929, 'pattern_counts': {'":': 12, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5614678', 'n_tokens_mistral': 9410, 'n_tokens_neox': 9089, 'n_words': 1166}