-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy path.taskcluster.yml
More file actions
184 lines (175 loc) · 7.31 KB
/
.taskcluster.yml
File metadata and controls
184 lines (175 loc) · 7.31 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
$let:
head_branch:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.ref}
else:
$if: 'tasks_for == "github-push"'
then:
# Strip ref branch prefix
$if: 'event.ref[0:11] == "refs/heads/"'
then: ${event.ref[11:]}
else: ${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}
channel:
$if: 'tasks_for == "github-push"'
then:
$if: 'event.ref in ["refs/heads/testing", "refs/heads/production"]'
then: ${event.ref[11:]}
else: "dev"
else: "dev"
provisionerId:
$if: 'taskcluster_root_url == "https://firefox-ci-tc.services.mozilla.com"'
then:
$if: 'tasks_for == "github-push"'
then: "code-analysis-3"
else: "code-analysis-1"
else: proj-relman
workerType:
$if: 'taskcluster_root_url == "https://firefox-ci-tc.services.mozilla.com"'
then: linux-gw-gcp
else: generic-worker-ubuntu-24-04
taskboot_image: "mozilla/taskboot:0.4.1"
python_image: "python:3.12"
in:
$if: '(tasks_for == "github-push" && (head_branch == "master" || head_branch == "production" || head_branch == "testing")) || (tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "synchronize"])'
then:
$flatten:
$match:
# Always run those tasks
"true":
- taskId: { $eval: as_slugid("check_lint") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: "${python_image}"
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
cd /src/bot && pip install --disable-pip-version-check --no-cache-dir --quiet -r requirements-dev.txt &&
cd /src && pre-commit run -a --show-diff-on-failure"
metadata:
name: "Code Coverage checks: linting"
description: Check code style with pre-commit hooks
owner: bastien@mozilla.com
source: https://github.com/mozilla/code-coverage
# Run only on firefoxci Taskcluster
'taskcluster_root_url == "https://firefox-ci-tc.services.mozilla.com"':
- taskId: { $eval: as_slugid("bot_check_tests") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: "${python_image}"
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
/src/bot/ci/bootstrap.sh &&
cd /src/bot && pip3 install --disable-pip-version-check --no-cache-dir --quiet . && pip3 install --disable-pip-version-check --no-cache-dir --quiet -r requirements-dev.txt &&
pytest -v"
metadata:
name: "Code Coverage Bot checks: unit tests"
description: Check python code with pytest
owner: bastien@mozilla.com
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("bot_build") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
expires: { $fromNow: "2 years" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("check_lint") }
- { $eval: as_slugid("bot_check_tests") }
payload:
maxRunTime: 3600
image: "${taskboot_image}"
env:
GIT_REPOSITORY: ${repository}
GIT_REVISION: ${head_rev}
command:
- taskboot
- build
- --image
- mozilla/code-coverage
- --tag
- "bot-${channel}"
- --tag
- "bot-${head_rev}"
- --write
- /bot.tar
- bot/Dockerfile
artifacts:
public/code-coverage-bot.tar.zst:
expires: { $fromNow: "2 years" }
path: /bot.tar.zst
type: file
routes:
$if: 'tasks_for == "github-pull-request"'
then:
- "index.code-analysis.v2.code-coverage-pr.revision.${head_rev}"
- "index.code-analysis.v2.code-coverage-pr.branch.${head_branch}"
else:
- "index.code-analysis.v2.code-coverage.revision.${head_rev}"
- "index.code-analysis.v2.code-coverage.branch.${head_branch}"
metadata:
name: Code Coverage Bot docker build
description: Build docker image with taskboot
owner: bastien@mozilla.com
source: https://github.com/mozilla/code-coverage
# Run only on community Taskcluster
'taskcluster_root_url == "https://community-tc.services.mozilla.com"':
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
then:
$let:
version: { $eval: "head_branch[10:]" }
in:
taskId: { $eval: as_slugid("release") }
dependencies:
- { $eval: as_slugid("check_lint") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
features:
# Needed for access to secret
taskclusterProxy: true
maxRunTime: 3600
image: "${taskboot_image}"
env:
TASKCLUSTER_SECRET: "project/relman/code-coverage/release"
command:
- taskboot
- github-release
- mozilla/code-coverage
- "${version}"
scopes:
- "secrets:get:project/relman/code-coverage/release"
metadata:
name: "Code Coverage Release ${version}"
description: Code Coverage Github automated release
owner: bastien@mozilla.com
source: https://github.com/mozilla/code-coverage