-
Notifications
You must be signed in to change notification settings - Fork 13
/
.taskcluster.yml
124 lines (118 loc) · 4.32 KB
/
.taskcluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
$let:
expires_in: {$fromNow: '1 year'}
user: ${event.sender.login}
# We define the following variable at the very top, because they are used in the
# default definition
head_branch:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.ref}
else:
$if: 'tasks_for == "github-push"'
then: ${event.ref}
else: ${event.release.target_commitish}
head_rev:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.sha}
else:
$if: 'tasks_for == "github-push"'
then: ${event.after}
else: ${event.release.tag_name}
repository:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.repo.html_url}
else: ${event.repository.html_url}
github_repository_full_name:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.base.repo.full_name}
else: ${event.repository.full_name}
in:
$let:
short_head_branch:
$if: 'head_branch[:10] == "refs/tags/"'
then: {$eval: 'head_branch[10:]'}
else:
$if: 'head_branch[:11] == "refs/heads/"'
then: {$eval: 'head_branch[11:]'}
else: ${head_branch}
assume_scope_prefix: assume:repo:github.com/${github_repository_full_name}
in:
$let:
default_task_definition:
schedulerId: taskcluster-github
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
expires: ${expires_in}
provisionerId: releng-t
workerType: linux-gcp
retries: 5
payload:
maxRunTime: 600
command:
- /bin/bash
- --login
- -cx
- >-
git clone ${repository} /build
&& cd /build
&& git config advice.detachedHead false
&& git checkout ${head_branch}
&& pip install tox
&& tox -e "$TOX_ENV"
env:
SKIP_NETWORK_TESTS: "0"
metadata:
owner: ${user}@users.noreply.github.com
source: ${repository}/raw/${head_rev}/.taskcluster.yml
routes:
- checks
in:
$flatten:
$map:
- short_name: py27
image_tag: '2.7'
- short_name: py37
image_tag: '3.7'
- short_name: py38
image_tag: '3.8'
- short_name: py39
image_tag: '3.9'
- short_name: py310
image_tag: '3.10'
- short_name: docs
image_tag: '3.10'
each(python_version):
$let:
python_task_definition:
payload:
image: python:${python_version.image_tag}
env:
TOX_ENV: ${python_version.short_name}
in:
- $if: 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "edited", "synchronize"]'
then:
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'python_task_definition'}
- scopes:
- ${assume_scope_prefix}:pull-request
metadata:
name: 'build-mar - ${python_version.short_name} (Pull Request #${event.pull_request.number})'
description: 'Triggered by [#${event.pull_request.number}](${event.pull_request.html_url})'
- $if: 'tasks_for == "github-push" && head_branch[:10] != "refs/tags/"'
then:
$mergeDeep:
- {$eval: 'default_task_definition'}
- {$eval: 'python_task_definition'}
- scopes:
- ${assume_scope_prefix}:branch:${short_head_branch}
metadata:
name: 'build-mar - ${python_version.short_name} (${head_rev})'
description: 'Triggered by ${head_rev}'