Add support for daily builds

https://tools.taskcluster.net/hooks/project-servo/daily
This commit is contained in:
Simon Sapin 2018-09-24 15:28:04 +02:00
parent 67794b6146
commit 947c01ea25
3 changed files with 40 additions and 6 deletions

View file

@ -7,6 +7,10 @@ tasks:
then:
$if: 'event.ref in ["refs/heads/auto", "refs/heads/try"]'
then:
# NOTE: when updating this consider whether the daily hook needs similar changes:
# https://tools.taskcluster.net/hooks/project-servo/daily
taskGroupId: {$eval: as_slugid("decision_task")}
taskId: {$eval: as_slugid("decision_task")}
provisionerId: aws-provisioner-v1
@ -14,7 +18,7 @@ tasks:
created: {$fromNow: ''}
deadline: {$fromNow: '1 day'}
metadata:
name: "Servo: decision task"
name: "Servo: GitHub push decision task"
description: ""
owner: &task_owner ${event.pusher.name}@users.noreply.github.com
source: &task_source ${event.compare}
@ -36,11 +40,13 @@ tasks:
GIT_URL: ${event.repository.clone_url}
GIT_REF: ${event.ref}
GIT_SHA: ${event.after}
TASK_FOR: ${tasks_for}
TASK_OWNER: *task_owner
TASK_SOURCE: *task_source
command:
- /bin/bash
- '--login'
- '-e'
- '-c'
- >-
git init repo &&

View file

@ -4,14 +4,28 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os.path
import subprocess
from decisionlib import DecisionTask
def main():
linux_tidy_unit()
# linux_wpt()
task_for = os.environ["TASK_FOR"]
if task_for == "github-push":
linux_tidy_unit()
#linux_wpt()
# https://tools.taskcluster.net/hooks/project-servo/daily
elif task_for == "daily":
# Unlike when reacting to a GitHub event,
# the commit hash is not known until we clone the repository.
os.environ["GIT_SHA"] = \
subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("utf8").strip()
with_rust_nightly()
else:
raise ValueError("Unrecognized $TASK_FOR value: %r", task_for)
build_artifacts_expiry = "1 week"
@ -45,6 +59,18 @@ def linux_tidy_unit():
)
def with_rust_nightly():
return decision.create_task(
task_name="Linux x86_64: with Rust Nightly",
script="""
echo "nightly" > rust-toolchain
./mach build --dev
./mach test-unit
""",
**build_kwargs
)
def linux_wpt():
release_build_task = linux_release_build()
total_chunks = 2

View file

@ -15,6 +15,7 @@ Run the decision task with fake Taskcluster APIs, to catch Python errors before
import os
import sys
import collections
from unittest.mock import MagicMock
@ -30,7 +31,8 @@ class Index:
raise TaskclusterRestFailure
Queue = stringDate = fromNow = slugId = os.environ = MagicMock()
Queue = stringDate = fromNow = slugId = MagicMock()
os.environ = collections.defaultdict(str, TASK_FOR="github-push")
sys.modules["taskcluster"] = sys.modules[__name__]
sys.dont_write_bytecode = True
exec(open("decision-task.py").read())
exec(open(os.path.join(os.path.dirname(__file__), "decision-task.py")).read())