macOS CI: use a cache of github.com/servo/servo

Relies on https://github.com/servo/taskcluster-config/pull/6
This commit is contained in:
Simon Sapin 2019-11-16 15:46:22 +01:00
parent 657fead0ce
commit 0dad48f54f
2 changed files with 26 additions and 8 deletions

View file

@ -595,7 +595,7 @@ def update_wpt():
"etc/taskcluster/macos/Brewfile-gstreamer",
])
# Pushing the new changes to the git remote requires a full repo clone.
.with_repo(shallow=False)
.with_repo(shallow=False, alternate_object_dir="/var/cache/servo.git/objects")
.with_curl_artifact_script(build_task, "target.tar.gz")
.with_script("""
export PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig/"
@ -631,19 +631,26 @@ def macos_wpt():
def macos_run_task(name):
task = macos_task(name).with_python2()
return with_homebrew(task, ["etc/taskcluster/macos/Brewfile-gstreamer"])
wpt_chunks("macOS x64", macos_run_task, build_task, repo_dir="repo",
total_chunks=6, processes=4)
wpt_chunks(
"macOS x64",
macos_run_task,
build_task,
repo_dir="repo",
repo_kwargs=dict(alternate_object_dir="/var/cache/servo.git/objects"),
total_chunks=6,
processes=4,
)
def wpt_chunks(platform, make_chunk_task, build_task, total_chunks, processes,
repo_dir, chunks="all"):
repo_dir, chunks="all", repo_kwargs={}):
if chunks == "all":
chunks = [n + 1 for n in range(total_chunks)]
for this_chunk in chunks:
task = (
make_chunk_task("WPT chunk %s / %s" % (this_chunk, total_chunks))
.with_treeherder(platform, "WPT-%s" % this_chunk)
.with_repo()
.with_repo(**repo_kwargs)
.with_curl_artifact_script(build_task, "target.tar.gz")
.with_script("tar -xzf target.tar.gz")
.with_index_and_artifacts_expire_in(log_artifacts_expire_in)
@ -887,7 +894,7 @@ def macos_build_task(name):
# https://github.com/servo/servo/issues/24735
.with_max_run_time_minutes(60 * 2)
.with_env(**build_env, **unix_build_env, **macos_build_env)
.with_repo()
.with_repo(alternate_object_dir="/var/cache/servo.git/objects")
.with_python2()
.with_rustup()
# Since macOS workers are long-lived and ~/.rustup kept across tasks:

View file

@ -579,7 +579,7 @@ class UnixTaskMixin(Task):
super().__init__(*args, **kwargs)
self.curl_scripts_count = 0
def with_repo(self, shallow=True):
def with_repo(self, shallow=True, alternate_object_dir=None):
"""
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`
@ -592,14 +592,25 @@ class UnixTaskMixin(Task):
`git` and `ca-certificate` need to be installed in the Docker image.
"""
# Not using $GIT_ALTERNATE_OBJECT_DIRECTORIES since it causes
# "object not found - no match for id" errors when Cargo fetches git dependencies
if alternate_object_dir:
self.with_env(ALTERNATE_OBJDIR=alternate_object_dir)
return self \
.with_env(**git_env()) \
.with_early_script("""
git init repo
cd repo
{alternate}
time git fetch --no-tags {depth} "$GIT_URL" "$GIT_REF"
time git reset --hard "$GIT_SHA"
""".format(depth="--depth 30" if shallow else ""))
""".format(
depth="--depth 30" if shallow else "",
alternate=(
"""echo "$ALTERNATE_OBJDIR" > .git/objects/info/alternates"""
if alternate_object_dir else ""
)
))
def with_curl_script(self, url, file_path):
self.curl_scripts_count += 1