-
Notifications
You must be signed in to change notification settings - Fork 85
/
.taskcluster.yml
529 lines (507 loc) · 22 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
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"
channel_short:
# Special case where naming is limited:
# * for the frontend upload on AWS S3, where the production bucket is named 'prod'
# * on Heroku for the events runtime, where the production app is named 'prod'
$if: 'tasks_for == "github-push"'
then:
$if: 'event.ref == "refs/heads/production"'
then: "prod"
else: ${event.ref[11:]}
else: "dev"
backend_url:
$if: 'tasks_for == "github-push"'
then:
$if: 'event.ref == "refs/heads/testing"'
then: "https://api.coverage.testing.moz.tools"
else: "https://api.coverage.moz.tools"
else: "https://api.coverage.moz.tools"
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"
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:3.9
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/backend && 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: [email protected]
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:3.9
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
/src/bot/ci/bootstrap.sh &&
cd /src/tools && python3 setup.py install &&
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: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("bot_build") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("check_lint") }
- { $eval: as_slugid("bot_check_tests") }
payload:
features:
dind: true
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: "6 months" }
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: [email protected]
source: https://github.com/mozilla/code-coverage
# Run only on community Taskcluster
'taskcluster_root_url == "https://community-tc.services.mozilla.com"':
- taskId: { $eval: as_slugid("backend_check_tests") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: python:3.9
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
cd /src/tools && python setup.py install &&
cd /src/backend && pip install --disable-pip-version-check --no-cache-dir --quiet . && pip install --disable-pip-version-check --no-cache-dir --quiet -r requirements-dev.txt &&
pytest -v"
metadata:
name: "Code Coverage Backend checks: unit tests"
description: Check python code with pytest
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("events_check_tests") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: python:3.9
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
cd /src/events && pip install --disable-pip-version-check --no-cache-dir --quiet -q -r requirements.txt && pip install --disable-pip-version-check --no-cache-dir --quiet . && pip install --disable-pip-version-check --no-cache-dir --quiet -r requirements-dev.txt &&
pytest -v"
metadata:
name: "Code Coverage Events checks: unit tests"
description: Check python code with pytest
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("report_check_tests") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
features:
taskclusterProxy: true
maxRunTime: 3600
image: python:3.9
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b checks &&
cd /src/report && ./ci-test.sh"
metadata:
name: "Code Coverage Report checks: unit tests"
description: Check python code with unittest
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("backend_build") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("check_lint") }
- { $eval: as_slugid("backend_check_tests") }
payload:
capabilities:
privileged: true
maxRunTime: 3600
image: "${taskboot_image}"
env:
GIT_REPOSITORY: ${repository}
GIT_REVISION: ${head_rev}
command:
- taskboot
- build
- --image
- mozilla/code-coverage/backend
- --tag
- "${channel}"
- --tag
- "${head_rev}"
- --write
- /backend.tar
- backend/Dockerfile
artifacts:
public/code-coverage-backend.tar.zst:
expires: { $fromNow: "2 weeks" }
path: /backend.tar.zst
type: file
scopes:
- docker-worker:capability:privileged
metadata:
name: Code Coverage Backend docker build
description: Build docker image with taskboot
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("events_build") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("check_lint") }
- { $eval: as_slugid("events_check_tests") }
payload:
capabilities:
privileged: true
maxRunTime: 3600
image: "${taskboot_image}"
env:
GIT_REPOSITORY: ${repository}
GIT_REVISION: ${head_rev}
command:
- taskboot
- build
- --image
- mozilla/code-coverage
- --tag
- "events-${channel}"
- --tag
- "events-${head_rev}"
- --write
- /events.tar
- events/Dockerfile
artifacts:
public/code-coverage-events.tar.zst:
expires: { $fromNow: "2 weeks" }
path: /events.tar.zst
type: file
scopes:
- docker-worker:capability:privileged
metadata:
name: Code Coverage Events docker build
description: Build docker image with taskboot
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("addon_build") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: node:20-alpine
command:
- sh
- -lxce
- "apk add --quiet --update git python3 &&
git clone --quiet ${repository} /src && cd /src/addon && git checkout ${head_rev} -b build &&
npm install --no-progress &&
npm run lint &&
npm run build &&
npm run test &&
npm run export"
artifacts:
public/addon:
expires: { $fromNow: "2 weeks" }
path: /src/addon/web-ext-artifacts
type: directory
metadata:
name: Code Coverage Addon build
description: Build code-coverage webextension
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- taskId: { $eval: as_slugid("frontend_build") }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
payload:
maxRunTime: 3600
image: node:20
env:
BACKEND_URL: "${backend_url}"
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src/frontend && git checkout ${head_rev} -b build &&
npm install --no-progress && npm run release"
artifacts:
public/frontend:
expires: { $fromNow: "2 weeks" }
path: /src/frontend/dist
type: directory
metadata:
name: Code Coverage Frontend build
description: Build web single page application
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- $if: 'channel in ["testing", "production"]'
then:
taskId: { $eval: as_slugid("backend_deploy") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("backend_build") }
payload:
features:
taskclusterProxy: true
maxRunTime: 3600
image: "${taskboot_image}"
command:
- taskboot
- deploy-heroku
- --heroku-app
- "code-coverage-${channel}"
- web:public/code-coverage-backend.tar.zst
env:
TASKCLUSTER_SECRET: "project/relman/code-coverage/deploy-${channel}"
scopes:
- "secrets:get:project/relman/code-coverage/deploy-${channel}"
metadata:
name: "Code Coverage Backend deployment (${channel})"
description: Deploy docker image on Heroku
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- $if: 'channel in ["testing", "production"]'
then:
taskId: { $eval: as_slugid("events_deploy") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("events_build") }
payload:
features:
taskclusterProxy: true
maxRunTime: 3600
image: "${taskboot_image}"
command:
- taskboot
- deploy-heroku
- --heroku-app
- "code-coverage-events-${channel_short}"
- worker:public/code-coverage-events.tar.zst
env:
TASKCLUSTER_SECRET: "project/relman/code-coverage/deploy-${channel}"
scopes:
- "secrets:get:project/relman/code-coverage/deploy-${channel}"
metadata:
name: "Code Coverage Events deployment (${channel})"
description: Deploy docker image on Heroku
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- $if: 'channel in ["testing", "production"]'
then:
taskId: { $eval: as_slugid("frontend_deploy") }
created: { $fromNow: "" }
deadline: { $fromNow: "1 hour" }
provisionerId: "${provisionerId}"
workerType: "${workerType}"
dependencies:
- { $eval: as_slugid("frontend_build") }
payload:
features:
# Needed for access to secret
taskclusterProxy: true
maxRunTime: 3600
image: "${taskboot_image}"
env:
TASKCLUSTER_SECRET: "project/relman/code-coverage/deploy-${channel}"
command:
- taskboot
- deploy-s3
- --artifact-folder
- public/frontend
- --bucket
- "codecoverage-${channel_short}-site-static-website"
scopes:
- "secrets:get:project/relman/code-coverage/deploy-${channel}"
metadata:
name: "Code Coverage Frontend deploy (${channel})"
description: Deploy frontend build on environment
owner: [email protected]
source: https://github.com/mozilla/code-coverage
- $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("addon_build") }
- { $eval: as_slugid("backend_build") }
- { $eval: as_slugid("frontend_build") }
- { $eval: as_slugid("report_check_tests") }
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: [email protected]
source: https://github.com/mozilla/code-coverage
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
then:
taskId: { $eval: as_slugid("report_deploy_pypi") }
dependencies:
- { $eval: as_slugid("report_check_tests") }
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:
- sh
- -lxce
- "git clone ${repository} /project && cd /project && git checkout ${head_rev} -b release &&
taskboot --target=/project/report deploy-pypi"
scopes:
- "secrets:get:project/relman/code-coverage/release"
metadata:
name: "Code Coverage Report: publish on pypi"
description: Code Coverage Github Pypi publication for report
owner: [email protected]
source: https://github.com/mozilla/code-coverage