Build with sccache, cache the sccache cache

This commit is contained in:
Simon Sapin 2018-09-18 19:28:34 +02:00
parent e5902fed9b
commit 860c827265
2 changed files with 31 additions and 29 deletions

View file

@ -23,8 +23,7 @@ tasks:
# Granted to role "repo:github.com/servo/servo-taskcluster-experiments:branch:master" # Granted to role "repo:github.com/servo/servo-taskcluster-experiments:branch:master"
- "queue:create-task:highest:aws-provisioner-v1/servo-*" - "queue:create-task:highest:aws-provisioner-v1/servo-*"
- "docker-worker:cache:cargo-registry-cache" - "docker-worker:cache:cargo-*"
- "docker-worker:cache:cargo-git-cache"
- "queue:route:index.project.servo.servo-taskcluster-experiments.*" - "queue:route:index.project.servo.servo-taskcluster-experiments.*"
payload: payload:

View file

@ -9,25 +9,6 @@ import os.path
from decisionlib import DecisionTask from decisionlib import DecisionTask
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/caches
CARGO_CACHE_SCOPES = [
"docker-worker:cache:cargo-registry-cache",
"docker-worker:cache:cargo-git-cache",
]
CARGO_CACHE = {
"cargo-registry-cache": "/root/.cargo/registry",
"cargo-git-cache": "/root/.cargo/git",
}
BUILD_ENV = {
"RUST_BACKTRACE": "1",
"RUSTFLAGS": "-Dwarnings",
"CARGO_INCREMENTAL": "0",
"SCCACHE_IDLE_TIMEOUT": "1200",
}
def main(): def main():
decision = DecisionTask( decision = DecisionTask(
project_name="Servo", # Used in task names project_name="Servo", # Used in task names
@ -43,20 +24,42 @@ def main():
decision.route_prefix = "project.servo.servo-taskcluster-experiments" decision.route_prefix = "project.servo.servo-taskcluster-experiments"
# ~ # ~
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/caches
cache_scopes = [
"docker-worker:cache:cargo-*",
]
build_caches = {
"cargo-registry-cache": "/root/.cargo/registry",
"cargo-git-cache": "/root/.cargo/git",
"cargo-rustup": "/root/.rustup",
"cargo-sccache": "/root/.cache/sccache",
}
build_env = {
"RUST_BACKTRACE": "1",
"RUSTFLAGS": "-Dwarnings",
"CARGO_INCREMENTAL": "0",
"SCCACHE_IDLE_TIMEOUT": "1200",
"CCACHE": "sccache",
"RUSTC_WRAPPER": "sccache",
}
build_kwargs = {
"max_run_time_minutes": 60,
"dockerfile": dockerfile("build-x86_64-linux"),
"env": build_env,
"scopes": cache_scopes,
"cache": build_caches,
}
decision.create_task_with_in_tree_dockerfile( decision.create_task_with_in_tree_dockerfile(
task_name="Linux x86_64: tidy + dev build + unit tests", task_name="Linux x86_64: tidy + dev build + unit tests",
command=""" command="""
sccache --version #./mach test-tidy --no-progress --all
./mach test-tidy --no-progress --all ./mach build --dev
#./mach build --dev
#./mach test-unit #./mach test-unit
#./mach test-tidy --no-progress --self-test #./mach test-tidy --no-progress --self-test
""", """,
env=BUILD_ENV, **build_kwargs
dockerfile=dockerfile("build-x86_64-linux"),
max_run_time_minutes=60,
scopes=CARGO_CACHE_SCOPES,
cache=CARGO_CACHE,
) )