Taskcluster: Add support for trychoosers

This commit is contained in:
Simon Sapin 2018-12-12 12:25:27 +01:00
parent 8588e928e7
commit e7b493df18
2 changed files with 70 additions and 30 deletions

View file

@ -8,40 +8,75 @@ import os.path
from decisionlib import * from decisionlib import *
def main(task_for, mock=False): def main(task_for):
if task_for == "github-push": if task_for == "github-push":
# FIXME https://github.com/servo/servo/issues/22325 implement these:
macos_wpt = magicleap_dev = linux_arm32_dev = linux_arm64_dev = \
android_arm32_dev_from_macos = lambda: None
# FIXME still buggy:
linux_wpt = lambda: None # Shadows the existing top-level function
all_tests = [
linux_tidy_unit_docs,
windows_unit,
macos_unit,
magicleap_dev,
android_arm32_dev,
android_arm32_release,
android_x86_release,
linux_arm32_dev,
linux_arm64_dev,
linux_wpt,
macos_wpt,
]
by_branch_name = {
"auto": all_tests,
"try": all_tests,
"try-taskcluster": [
# Add functions here as needed, in your push to that branch
],
"master": [
# Also show these tasks in https://treeherder.mozilla.org/#/jobs?repo=servo-auto
lambda: CONFIG.treeherder_repository_names.append("servo-auto"),
upload_docs,
],
# The "try-*" keys match those in `servo_try_choosers` in Homus config:
# https://github.com/servo/saltfs/blob/master/homu/map.jinja
"try-mac": [macos_unit],
"try-linux": [linux_tidy_unit_docs],
"try-windows": [windows_unit],
"try-magicleap": [magicleap_dev],
"try-arm": [linux_arm32_dev, linux_arm64_dev],
"try-wpt": [linux_wpt],
"try-wpt-mac": [macos_wpt],
"try-wpt-android": [android_x86_wpt],
"try-android": [
android_arm32_dev,
android_arm32_dev_from_macos,
android_x86_wpt
],
}
assert CONFIG.git_ref.startswith("refs/heads/") assert CONFIG.git_ref.startswith("refs/heads/")
branch = CONFIG.git_ref[len("refs/heads/"):] branch = CONFIG.git_ref[len("refs/heads/"):]
CONFIG.treeherder_repository_names = ["servo-" + branch] CONFIG.treeherder_repository_names.append("servo-" + branch)
for function in by_branch_name.get(branch, []):
if branch in ["auto", "try", "try-taskcluster"]: function()
linux_tidy_unit_docs()
android_arm32_dev()
android_arm32_release()
android_x86_release()
windows_unit()
macos_unit()
# These are disabled in a "real" decision task,
# but should still run when testing this Python code. (See `mock.py`.)
if mock:
windows_release()
linux_wpt()
linux_build_task("Indexed by task definition").find_or_create()
android_x86_wpt()
if branch == "master":
# Also show these tasks in https://treeherder.mozilla.org/#/jobs?repo=servo-auto
CONFIG.treeherder_repository_names.append("servo-auto")
upload_docs()
# https://tools.taskcluster.net/hooks/project-servo/daily # https://tools.taskcluster.net/hooks/project-servo/daily
elif task_for == "daily": elif task_for == "daily":
daily_tasks_setup() daily_tasks_setup()
with_rust_nightly() with_rust_nightly()
else: # pragma: no cover
raise ValueError("Unrecognized $TASK_FOR value: %r", task_for) # These are disabled in a "real" decision task,
# but should still run when testing this Python code. (See `mock.py`.)
def mocked_only():
windows_release()
linux_wpt()
android_x86_wpt()
linux_build_task("Indexed by task definition").find_or_create()
ping_on_daily_task_failure = "SimonSapin, nox, emilio" ping_on_daily_task_failure = "SimonSapin, nox, emilio"

View file

@ -32,7 +32,7 @@ class Index:
__init__ = insertTask = lambda *_, **__: None __init__ = insertTask = lambda *_, **__: None
def findTask(self, path): def findTask(self, path):
if ".docs." in path: if decision_task.CONFIG.git_ref == "refs/heads/master":
return {"taskId": ""} return {"taskId": ""}
raise TaskclusterRestFailure raise TaskclusterRestFailure
@ -47,14 +47,19 @@ os.environ["GIT_REF"] = "refs/heads/auto"
import decision_task import decision_task
print("\n# Push:") print("\n# Push:")
decision_task.main("github-push", mock=True) decision_task.main("github-push")
print("\n# Push with hot caches:") print("\n# Push with hot caches:")
decision_task.main("github-push", mock=True) decision_task.main("github-push")
print("\n# Mocked only:")
decision_task.mocked_only()
print("\n# Push to master:") print("\n# Push to master:")
decision_task.CONFIG.git_ref = "refs/heads/master" decision_task.CONFIG.git_ref = "refs/heads/master"
decision_task.main("github-push", mock=True) decision_task.main("github-push")
print("\n# Daily:") print("\n# Daily:")
decision_task.main("daily", mock=True) decision_task.main("daily")
print()