aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-11-13 15:30:50 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-11-15 17:38:21 +0100
commit1c7dbe1036dedce5577565abf26dd5fbe14318ee (patch)
treed29b7895d2d56592a40a4d1065f6ec6a061956a4
parent79bd98b67935869b48bc5869352be1d4cfdff566 (diff)
downloadservo-1c7dbe1036dedce5577565abf26dd5fbe14318ee.tar.gz
servo-1c7dbe1036dedce5577565abf26dd5fbe14318ee.zip
Taskcluster: Add dev build and unit tests on macOS
-rw-r--r--etc/taskcluster/decision_task.py71
-rw-r--r--etc/taskcluster/decisionlib.py55
2 files changed, 121 insertions, 5 deletions
diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py
index 509503123ce..faa07883547 100644
--- a/etc/taskcluster/decision_task.py
+++ b/etc/taskcluster/decision_task.py
@@ -13,7 +13,8 @@ def main(task_for, mock=False):
if CONFIG.git_ref in ["refs/heads/auto", "refs/heads/try", "refs/heads/try-taskcluster"]:
linux_tidy_unit()
android_arm32()
- windows_dev()
+ windows_unit()
+ macos_unit()
if mock:
windows_release()
linux_wpt()
@@ -40,12 +41,15 @@ build_env = {
"RUSTFLAGS": "-Dwarnings",
"CARGO_INCREMENTAL": "0",
}
-linux_build_env = {
+unix_build_env = {
"CCACHE": "sccache",
"RUSTC_WRAPPER": "sccache",
"SCCACHE_IDLE_TIMEOUT": "1200",
+}
+linux_build_env = {
"SHELL": "/bin/dash", # For SpiderMonkey’s build system
}
+macos_build_env = {}
windows_build_env = {
"LIB": "%HOMEDRIVE%%HOMEPATH%\\gst\\gstreamer\\1.0\\x86_64\\lib;%LIB%",
}
@@ -73,6 +77,15 @@ def linux_tidy_unit():
""").create()
+def macos_unit():
+ macos_build_task("macOS x64: dev build + unit tests").with_script("""
+ ./mach build --dev
+ ./mach test-unit
+ ./mach package --dev
+ ./etc/ci/lockfile_changed.sh
+ """).create()
+
+
def with_rust_nightly():
return linux_build_task("Linux x64: with Rust Nightly").with_script("""
echo "nightly" > rust-toolchain
@@ -123,7 +136,7 @@ def android_x86():
)
-def windows_dev():
+def windows_unit():
return (
windows_build_task("Windows x64: dev build + unit tests")
.with_script(
@@ -268,6 +281,14 @@ def windows_task(name):
return WindowsGenericWorkerTask(name).with_worker_type("servo-win2016")
+def macos_task(name):
+ return (
+ MacOsGenericWorkerTask(name)
+ .with_provisioner_id("proj-servo")
+ .with_worker_type("macos")
+ )
+
+
def linux_build_task(name):
return (
linux_task(name)
@@ -283,7 +304,7 @@ def linux_build_task(name):
.with_index_and_artifacts_expire_in(build_artifacts_expire_in)
.with_max_run_time_minutes(60)
.with_dockerfile(dockerfile_path("build"))
- .with_env(**build_env, **linux_build_env)
+ .with_env(**build_env, **unix_build_env, **linux_build_env)
.with_repo()
.with_index_and_artifacts_expire_in(build_artifacts_expire_in)
)
@@ -325,6 +346,48 @@ def windows_build_task(name):
)
+def macos_build_task(name):
+ return (
+ macos_task(name)
+ # Allow long runtime in case the cache expired for all those Homebrew dependencies
+ .with_max_run_time_minutes(60 * 2)
+ .with_env(**build_env, **unix_build_env, **macos_build_env)
+ .with_repo()
+ .with_python2()
+ .with_rustup()
+ .with_script("""
+ mkdir -p "$HOME/homebrew"
+ export PATH="$HOME/homebrew/bin:$PATH"
+ which homebrew || curl -L https://github.com/Homebrew/brew/tarball/master \
+ | tar xz --strip 1 -C "$HOME/homebrew"
+
+ time brew install automake autoconf@2.13 pkg-config cmake yasm llvm
+ time brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad \
+ gst-libav gst-rtsp-server \
+ --with-orc --with-libogg --with-opus --with-pango --with-theora --with-libvorbis
+ export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include"
+ export OPENSSL_LIB_DIR="$(brew --prefix openssl)/lib"
+ """)
+
+ .with_directory_mount(
+ "https://github.com/mozilla/sccache/releases/download/"
+ "0.2.7/sccache-0.2.7-x86_64-apple-darwin.tar.gz",
+ sha256="f86412abbbcce2d3f23e7d33305469198949f5cf807e6c3258c9e1885b4cb57f",
+ path="sccache",
+ )
+ # Early script in order to run with the initial $PWD
+ .with_early_script("""
+ export PATH="$PWD/sccache/sccache-0.2.7-x86_64-apple-darwin:$PATH"
+ """)
+ # sccache binaries requires OpenSSL 1.1 and are not compatible with 1.0.
+ # "Late" script in order to run after Homebrew is installed.
+ .with_script("""
+ time brew install openssl@1.1
+ export DYLD_LIBRARY_PATH="$HOME/homebrew/opt/openssl@1.1/lib"
+ """)
+ )
+
+
CONFIG.task_name_template = "Servo: %s"
CONFIG.index_prefix = "project.servo.servo"
CONFIG.docker_image_buil_worker_type = "servo-docker-worker"
diff --git a/etc/taskcluster/decisionlib.py b/etc/taskcluster/decisionlib.py
index 3dd1af32a3c..81b6ec6af25 100644
--- a/etc/taskcluster/decisionlib.py
+++ b/etc/taskcluster/decisionlib.py
@@ -27,7 +27,7 @@ import taskcluster
# Public API
__all__ = [
"CONFIG", "SHARED", "Task", "DockerWorkerTask",
- "GenericWorkerTask", "WindowsGenericWorkerTask",
+ "GenericWorkerTask", "WindowsGenericWorkerTask", "MacOsGenericWorkerTask",
]
@@ -496,6 +496,59 @@ class WindowsGenericWorkerTask(GenericWorkerTask):
.with_path_from_homedir("python2", "python2\\Scripts")
+class MacOsGenericWorkerTask(GenericWorkerTask):
+ """
+ Task definition for a `generic-worker` task running on macOS.
+
+ Scripts are interpreted with `bash`.
+ """
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.scripts = []
+
+ with_script = chaining(append_to_attr, "scripts")
+ with_early_script = chaining(prepend_to_attr, "scripts")
+
+ def build_command(self):
+ # generic-worker accepts multiple commands, but unlike on Windows
+ # the current directory and environment variables
+ # are not preserved across commands on macOS.
+ # So concatenate scripts and use a single `bash` command instead.
+ return [
+ [
+ "/bin/bash", "--login", "-x", "-e", "-c",
+ deindent("\n".join(self.scripts))
+ ]
+ ]
+
+ def with_repo(self):
+ """
+ Make a shallow clone the git repository at the start of the task.
+ This uses `CONFIG.git_url`, `CONFIG.git_ref`, and `CONFIG.git_sha`,
+ and creates the clone in a `repo` directory in the task’s directory.
+ """
+ return self \
+ .with_env(**git_env()) \
+ .with_early_script("""
+ git init repo
+ cd repo
+ git fetch --depth 1 "$GIT_URL" "$GIT_REF"
+ git reset --hard "$GIT_SHA"
+ """)
+
+ def with_python2(self):
+ return self.with_early_script("""
+ export PATH="$HOME/Library/Python/2.7/bin:$PATH"
+ python -m ensurepip --user
+ pip install --user virtualenv
+ """)
+
+ def with_rustup(self):
+ return self.with_early_script("""
+ export PATH="$HOME/.cargo/bin:$PATH"
+ which rustup || curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
+ """)
+
class DockerWorkerTask(Task):
"""