forked from mozilla-mobile/focus-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.taskcluster.yml
298 lines (298 loc) · 13 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
version: 1
policy:
pullRequests: public
tasks:
###############################################################################
# Task: Pull requests
#
# Triggered whenever a pull request is opened or updated.
#
# - Build the app (all flavors)
# - Run unit tests
# - Run code quality tools (spotbugs, lint, checkstyle etc.)
###############################################################################
- $if: 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "synchronize"]'
then:
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
provisionerId: aws-provisioner-v1
workerType: github-worker
scopes: []
routes: []
payload:
maxRunTime: 7200
image: mozillamobile/focus-android:1.4
command:
- /bin/bash
- --login
- -cx
- >-
git fetch ${event.pull_request.head.repo.clone_url} ${event.pull_request.head.ref}
&& git config advice.detachedHead false
&& git checkout ${event.pull_request.head.sha}
&& echo "--" > .adjust_token
&& python tools/l10n/check_locales.py
&& ./gradlew --no-daemon clean assembleFocusX86Debug assembleKlarX86Nightly assembleRelease detektCheck ktlint lintFocusX86Debug lintKlarX86Nightly pmd checkstyle spotbugs assembleFocusX86DebugAndroidTest testFocusX86DebugUnitTest testKlarX86NightlyUnitTest
&& pip install "compare-locales>=5.0.2,<6.0"
&& compare-locales --validate l10n.toml .
artifacts:
public:
type: directory
path: /opt/focus-android/app/build/reports
expires: {$fromNow: '1 week'}
metadata:
name: Focus for Android - Build - Pull Request
description: Building Focus for Android (via Gradle) - triggered by a pull request.
owner: ${event.pull_request.user.login}@users.noreply.github.com
source: ${event.repository.url}
###############################################################################
# Task: Builds on branches of the main repo
#
# Triggered whenever something is pushed/merged to the mozilla-mobile repo.
# Tags (which are considered to be pushes) are ignored.
#
# Creates the following task pipeline:
#
# Build -+--> Unit tests ----+- UI tests
# \-> Code quality -/
#
###############################################################################
- $if: 'tasks_for == "github-push"'
then:
$if: 'event.repository.fork == false && event.ref[:10] != "refs/tags/"'
then:
taskId: {$eval: as_slugid("decision_task")}
# The next line won't be needed anymore after https://github.com/taskcluster/taskcluster-github/pull/273
taskGroupId: {$eval: as_slugid("decision_task")}
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
provisionerId: aws-provisioner-v1
workerType: github-worker
routes:
- 'notify.irc-channel.#android-ci.on-any'
scopes:
- queue:create-task:aws-provisioner-v1/github-worker
- queue:scheduler-id:taskcluster-github
- secrets:get:project/focus/firebase
- secrets:get:project/focus/nimbledroid
- queue:route:notify.irc-channel.#android-ci.on-any
payload:
maxRunTime: 7200
image: mozillamobile/focus-android:1.4
features:
taskclusterProxy: true
env:
TASK_ID: {$eval: as_slugid("decision_task")}
MOBILE_HEAD_REPOSITORY: ${event.repository.clone_url}
MOBILE_HEAD_BRANCH: ${event.ref}
MOBILE_HEAD_REV: ${event.after}
command:
- /bin/bash
- --login
- -cx
- >-
git fetch origin
&& git config advice.detachedHead false
&& git checkout ${event.after}
&& python tools/taskcluster/schedule-master-build.py
artifacts:
public:
type: directory
path: /opt/focus-android/test_artifacts
expires: {$fromNow: '1 week'}
metadata:
name: (Focus for Android) Schedule tasks
description: Scheduling tasks for master push
owner: ${event.pusher.name}@users.noreply.github.com
source: ${event.repository.url}
###############################################################################
# Task: Release builds
#
# Triggered when a new GitHub release is created (in any branch)
#
# - Builds release versions of Focus and Klar
# - Signs the builds with the release key
# - Uploads the builds to the "alpha" track on Google Play
###############################################################################
- $if: 'tasks_for == "github-release"'
then:
$let:
decision_task_id: {$eval: as_slugid("decision_task")}
expires_in: {$fromNow: '1 year'}
repository: https://github.com/mozilla-mobile/focus-android
scheduler_id: taskcluster-github
in:
taskId: ${decision_task_id}
taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
expires: ${expires_in}
schedulerId: ${scheduler_id} # Must be explicit because of Chain of Trust
provisionerId: aws-provisioner-v1
workerType: gecko-focus # This workerType has ChainOfTrust enabled
requires: all-completed # Must be explicit because of Chain of Trust
priority: highest
retries: 5
scopes:
- queue:scheduler-id:${scheduler_id}
- queue:create-task:highest:aws-provisioner-v1/gecko-focus
- queue:create-task:highest:scriptworker-prov-v1/mobile-signing-v1
- queue:create-task:highest:scriptworker-prov-v1/mobile-pushapk-v1
- project:mobile:focus:releng:signing:cert:release-signing
- project:mobile:focus:releng:signing:format:autograph_focus
- project:mobile:focus:releng:googleplay:product:focus
- secrets:get:project/focus/tokens
- queue:route:index.project.mobile.focus.release.latest
routes:
- statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust
payload:
maxRunTime: 600 # Decision should remain fast enough to schedule a handful of tasks
image: mozillamobile/focus-android:1.4
features:
taskclusterProxy: true
chainOfTrust: true
env:
TASK_ID: ${decision_task_id}
SCHEDULER_ID: ${scheduler_id}
MOBILE_HEAD_REPOSITORY: ${repository}
MOBILE_HEAD_BRANCH: ${event.release.target_commitish}
MOBILE_HEAD_REV: ${event.release.tag_name}
MOBILE_TRIGGERED_BY: ${event.sender.login}
command:
- /bin/bash
- --login
- -cx
- >-
git fetch origin --tags
&& git config advice.detachedHead false
&& git checkout ${event.release.tag_name}
&& python tools/taskcluster/release.py \
--tag ${event.release.tag_name} \
--channel alpha \
--commit \
--output /opt/focus-android/app/build/outputs/apk \
--apk focusX86/release/app-focus-x86-release-unsigned.apk \
--apk klarX86/release/app-klar-x86-release-unsigned.apk \
--apk focusArm/release/app-focus-arm-release-unsigned.apk \
--apk klarArm/release/app-klar-arm-release-unsigned.apk \
--date ${now}
artifacts:
public/task-graph.json:
type: file
path: /opt/focus-android/task-graph.json
expires: ${expires_in}
public/actions.json:
type: file
path: /opt/focus-android/actions.json
expires: ${expires_in}
public/parameters.yml:
type: file
path: /opt/focus-android/parameters.yml
expires: ${expires_in}
extra:
tasks_for: ${tasks_for}
metadata:
name: (Focus for Android) Decision task (${event.release.tag_name})
description: Scheduling tasks for releasing Focus/Klar
owner: ${event.sender.login}@users.noreply.github.com
source: ${repository}/raw/${event.release.tag_name}/.taskcluster.yml
# Nighly builds
- $if: 'tasks_for == "cron"'
then:
$let:
decision_task_id: {$eval: as_slugid("decision_task")}
expires_in: {$fromNow: '1 year'}
repository: ${event.repository.html_url}
scheduler_id: focus-nightly-sched
is_mozilla_mobile_repo:
$eval: event.repository.html_url == 'https://github.com/mozilla-mobile/focus-android'
command_staging_flag:
$if: event.repository.html_url == 'https://github.com/mozilla-mobile/focus-android'
then: ''
else: '--staging'
in:
taskId: ${decision_task_id}
taskGroupId: ${decision_task_id} # Must be explicit because of Chain of Trust
created: {$fromNow: ''}
deadline: {$fromNow: '2 hours'}
expires: ${expires_in}
schedulerId: ${scheduler_id} # Must be explicit because of Chain of Trust
provisionerId: aws-provisioner-v1
workerType: gecko-focus # This workerType has ChainOfTrust enabled
requires: all-completed # Must be explicit because of Chain of Trust
priority: medium
retries: 5
scopes:
$flatten:
- queue:scheduler-id:${scheduler_id}
- queue:create-task:highest:aws-provisioner-v1/gecko-focus
- project:mobile:focus:releng:signing:format:autograph_focus
- $if: is_mozilla_mobile_repo
then:
- queue:create-task:highest:scriptworker-prov-v1/mobile-signing-v1
- queue:create-task:highest:scriptworker-prov-v1/mobile-pushapk-v1
- project:mobile:focus:releng:signing:cert:release-signing
- project:mobile:focus:releng:googleplay:product:focus
- secrets:get:project/focus/tokens
- queue:route:index.project.mobile.focus.signed-nightly.*
else:
- queue:create-task:highest:scriptworker-prov-v1/mobile-signing-dep-v1
- queue:create-task:highest:scriptworker-prov-v1/mobile-pushapk-dep-v1
- project:mobile:focus:releng:signing:cert:dep-signing
- project:mobile:focus:releng:googleplay:product:focus:dep
- secrets:get:garbage/staging/project/focus/tokens
- queue:route:index.project.mobile.focus.staging-signed-nightly.*
routes:
- statuses # Automatically added by taskcluster-github. It must be explicit because of Chain of Trust
payload:
maxRunTime: 600 # Decision should remain fast enough to schedule a handful of tasks
image: mozillamobile/focus-android:1.4
features:
taskclusterProxy: true
chainOfTrust: true
env:
TASK_ID: ${decision_task_id}
SCHEDULER_ID: ${scheduler_id}
MOBILE_HEAD_REPOSITORY: ${repository}
MOBILE_HEAD_BRANCH: ${event.release.target_commitish}
MOBILE_HEAD_REV: ${event.release.tag_name}
MOBILE_TRIGGERED_BY: ${event.sender.login}
command:
- /bin/bash
- --login
- -cx
- >-
cd ..
&& git clone ${repository} repository
&& cd repository
&& python tools/taskcluster/release.py \
--channel nightly \
--commit \
--output /opt/repository/app/build/outputs/apk \
--apk klarArm/nightly/app-klar-arm-nightly-unsigned.apk \
--apk klarX86/nightly/app-klar-x86-nightly-unsigned.apk \
--apk focusArm/nightly/app-focus-arm-nightly-unsigned.apk \
--apk focusX86/nightly/app-focus-x86-nightly-unsigned.apk \
--date ${now} \
${command_staging_flag}
artifacts:
public/task-graph.json:
type: file
path: /opt/repository/task-graph.json
expires: ${expires_in}
public/actions.json:
type: file
path: /opt/repository/actions.json
expires: ${expires_in}
public/parameters.yml:
type: file
path: /opt/repository/parameters.yml
expires: ${expires_in}
extra:
cron: {$json: {$eval: 'cron'}}
tasks_for: ${tasks_for}
metadata:
name: (Focus for Android) Focus/Klar Nightly Builds (Public)
description: Decision task scheduled by cron task [${cron.task_id}](https://tools.taskcluster.net/tasks/${cron.task_id})
owner: ${event.sender.login}@users.noreply.github.com
source: ${repository}/raw/${event.release.tag_name}/.taskcluster.yml