Taskcluster: run tidy on PRs

This commit is contained in:
Simon Sapin 2019-01-03 18:55:52 +01:00
parent 0700aeb4f7
commit 5d0dbd6355
3 changed files with 128 additions and 65 deletions

View file

@ -10,11 +10,11 @@ from decisionlib import CONFIG, SHARED
def main(task_for):
assert CONFIG.git_ref.startswith("refs/heads/")
branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_name = "servo-" + (
branch if not branch.startswith("try-") else "try"
)
if CONFIG.git_ref.startswith("refs/heads/"):
branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_name = "servo-" + (
branch if not branch.startswith("try-") else "try"
)
if task_for == "github-push":
# FIXME https://github.com/servo/servo/issues/22325 implement these:
@ -72,6 +72,16 @@ def main(task_for):
for function in by_branch_name.get(branch, []):
function()
elif task_for == "github-pull-request":
CONFIG.treeherder_repository_name = "servo-prs"
# We want the merge commit that GitHub creates for the PR.
# The event does contain a `pull_request.merge_commit_sha` key, but it is wrong:
# https://github.com/servo/servo/pull/22597#issuecomment-451518810
CONFIG.git_sha_is_current_head()
tidy_untrusted()
# https://tools.taskcluster.net/hooks/project-servo/daily
elif task_for == "daily":
daily_tasks_setup()
@ -120,6 +130,22 @@ windows_sparse_checkout = [
]
def tidy_untrusted():
return (
decisionlib.DockerWorkerTask("Tidy")
.with_worker_type("servo-docker-untrusted")
.with_treeherder("Linux x64", "Tidy")
.with_max_run_time_minutes(60)
.with_dockerfile(dockerfile_path("build"))
.with_env(**build_env, **unix_build_env, **linux_build_env)
.with_repo()
.with_script("""
./mach test-tidy --no-progress --all
""")
.create()
)
def linux_tidy_unit_docs():
return (
linux_build_task("Tidy + dev build + unit tests + docs")
@ -452,7 +478,7 @@ def daily_tasks_setup():
"expires": SHARED.from_now_json(log_artifacts_expire_in),
})
# Unlike when reacting to a GitHub event,
# Unlike when reacting to a GitHub push event,
# the commit hash is not known until we clone the repository.
CONFIG.git_sha_is_current_head()
@ -511,7 +537,6 @@ def linux_build_task(name, *, build_env=build_env):
.with_dockerfile(dockerfile_path("build"))
.with_env(**build_env, **unix_build_env, **linux_build_env)
.with_repo()
.with_index_and_artifacts_expire_in(build_artifacts_expire_in)
)