mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Add a run task separate from the build task
This commit is contained in:
parent
c31b4ad095
commit
b05a445284
4 changed files with 68 additions and 41 deletions
2
child-task.sh → build-task.sh
Executable file → Normal file
2
child-task.sh → build-task.sh
Executable file → Normal file
|
@ -4,5 +4,5 @@ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
cd something-rust
|
cd something-rust
|
||||||
cargo run --release
|
cargo build --release
|
||||||
gzip -c target/release/something-rust > something-rust.gz
|
gzip -c target/release/something-rust > something-rust.gz
|
6
decision-task/curl-artifact.sh
Normal file
6
decision-task/curl-artifact.sh
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
curl \
|
||||||
|
--retry 5 \
|
||||||
|
--connect-timeout 10 \
|
||||||
|
--location
|
||||||
|
https://queue.taskcluster.net/v1/task/$1/artifacts/$2
|
|
@ -11,45 +11,61 @@ import taskcluster
|
||||||
event = json.loads(os.environ["GITHUB_EVENT"])
|
event = json.loads(os.environ["GITHUB_EVENT"])
|
||||||
print("GitHub event:\n%s\n" % json.dumps(event, sort_keys=True, indent=4, separators=(',', ': ')))
|
print("GitHub event:\n%s\n" % json.dumps(event, sort_keys=True, indent=4, separators=(',', ': ')))
|
||||||
|
|
||||||
task_id = taskcluster.slugId()
|
|
||||||
payload = {
|
|
||||||
"taskGroupId": os.environ["DECISION_TASK_ID"],
|
|
||||||
"dependencies": [os.environ["DECISION_TASK_ID"]],
|
|
||||||
"schedulerId": "taskcluster-github", # FIXME: can we avoid hard-coding this?
|
|
||||||
"provisionerId": "aws-provisioner-v1",
|
|
||||||
"workerType": "github-worker",
|
|
||||||
"created": taskcluster.fromNowJSON(""),
|
|
||||||
"deadline": taskcluster.fromNowJSON("1 hour"),
|
|
||||||
"metadata": {
|
|
||||||
"name": "Taskcluster experiments for Servo: Child task",
|
|
||||||
"description": "",
|
|
||||||
"owner": event["pusher"]["name"] + "@users.noreply.github.com",
|
|
||||||
"source": event["compare"],
|
|
||||||
},
|
|
||||||
"payload": {
|
|
||||||
"maxRunTime": 600,
|
|
||||||
"image": "buildpack-deps:bionic",
|
|
||||||
"command": [
|
|
||||||
"/bin/bash",
|
|
||||||
"--login",
|
|
||||||
"-c",
|
|
||||||
"""
|
|
||||||
git clone {event[repository][clone_url]} repo &&
|
|
||||||
cd repo &&
|
|
||||||
git checkout {event[after]} &&
|
|
||||||
./child-task.sh
|
|
||||||
""".format(event=event),
|
|
||||||
],
|
|
||||||
"artifacts": {
|
|
||||||
"public/executable.gz": {
|
|
||||||
"type": "file",
|
|
||||||
"path": "/repo/something-rust/something-rust.gz",
|
|
||||||
"expires": taskcluster.fromNowJSON("1 week"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
|
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
|
||||||
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
|
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
|
||||||
queue.createTask(task_id, payload)
|
|
||||||
print("new task scheduled: " + task_id)
|
command_prefix = """
|
||||||
|
git clone {event[repository][clone_url]} repo &&
|
||||||
|
cd repo &&
|
||||||
|
git checkout {event[after]} &&
|
||||||
|
""".format(event=event)
|
||||||
|
|
||||||
|
def create_task(name, command, artifacts=None, dependencies=None):
|
||||||
|
task_id = taskcluster.slugId()
|
||||||
|
payload = {
|
||||||
|
"taskGroupId": os.environ["DECISION_TASK_ID"],
|
||||||
|
"dependencies": [os.environ["DECISION_TASK_ID"]] + (dependencies or []),
|
||||||
|
"schedulerId": "taskcluster-github",
|
||||||
|
"provisionerId": "aws-provisioner-v1",
|
||||||
|
"workerType": "github-worker",
|
||||||
|
"created": taskcluster.fromNowJSON(""),
|
||||||
|
"deadline": taskcluster.fromNowJSON("1 hour"),
|
||||||
|
"metadata": {
|
||||||
|
"name": "Taskcluster experiments for Servo: " + name,
|
||||||
|
"description": "",
|
||||||
|
"owner": event["pusher"]["name"] + "@users.noreply.github.com",
|
||||||
|
"source": event["compare"],
|
||||||
|
},
|
||||||
|
"payload": {
|
||||||
|
"maxRunTime": 600,
|
||||||
|
"image": "buildpack-deps:bionic",
|
||||||
|
"command": [
|
||||||
|
"/bin/bash",
|
||||||
|
"--login",
|
||||||
|
"-c",
|
||||||
|
command_prefix + command
|
||||||
|
],
|
||||||
|
"artifacts": {
|
||||||
|
"public/" + artifact_name: {
|
||||||
|
"type": "file",
|
||||||
|
"path": path,
|
||||||
|
"expires": taskcluster.fromNowJSON("1 week"),
|
||||||
|
}
|
||||||
|
for artifact_name, path in artifacts or []
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
queue.createTask(task_id, payload)
|
||||||
|
print("Scheduled %s: %s" % (name, task_id))
|
||||||
|
return task_id
|
||||||
|
|
||||||
|
build_task = create_task(
|
||||||
|
"build task",
|
||||||
|
"./build-task.sh",
|
||||||
|
artifacts=[("executable.gz", "/repo/something-rust/something-rust.gz")],
|
||||||
|
)
|
||||||
|
create_task(
|
||||||
|
"run task",
|
||||||
|
"./run-task.sh",
|
||||||
|
dependencies=[build_task],
|
||||||
|
)
|
||||||
|
|
5
run-task.sh
Normal file
5
run-task.sh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
./curl-artifact.sh $BUILD_TASK_ID public/executable.gz -o executable.gz
|
||||||
|
gunzip executable.gz
|
||||||
|
./executable
|
Loading…
Add table
Add a link
Reference in a new issue