forked from mozilla-mobile/focus-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.taskcluster.yml
269 lines (269 loc) · 11.1 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
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'}
schedulerId: taskcluster-github
provisionerId: mobile-1
workerType: b-linux # We don't use decision because PRs just schedule a single task
scopes: []
routes: []
payload:
maxRunTime: 7200
image: mozillamobile/focus-android:1.5
command:
- /bin/bash
- --login
- -cx
- >-
git fetch ${event.pull_request.head.repo.clone_url} ${event.pull_request.head.ref}
&& git submodule update --init
&& 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 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.
#
# Creates the following task pipeline:
#
# Build -+--> Unit tests ----+- UI tests
# \-> Code quality -/
#
###############################################################################
- $if: 'tasks_for == "github-push"'
then:
$if: 'event.repository.fork == false'
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'}
schedulerId: taskcluster-github
provisionerId: mobile-3
workerType: decision
routes:
- 'notify.irc-channel.#android-ci.on-any'
scopes:
$let:
short_head_branch:
$if: 'event.ref[:11] == "refs/heads/"'
then: {$eval: 'event.ref[11:]'}
else: ${event.ref}
in:
- 'assume:repo:github.com/mozilla-mobile/focus-android:branch:${short_head_branch}'
payload:
maxRunTime: 7200
image: mozillamobile/focus-android:1.5
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 submodule update --init
&& 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 tag or release is published (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" && event["action"] == "published"'
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: mobile-3
workerType: decision
requires: all-completed # Must be explicit because of Chain of Trust
priority: highest
retries: 5
scopes:
- assume:repo:github.com/mozilla-mobile/focus-android:release
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.5
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 submodule update --init
&& 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 focusArm/release/app-focus-arm-release-unsigned.apk \
--apk focusAarch64/release/app-focus-aarch64-release-unsigned.apk \
--apk klarArm/release/app-klar-arm-release-unsigned.apk \
--apk klarAarch64/release/app-klar-aarch64-release-unsigned.apk
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
# Nightly builds
- $if: 'tasks_for == "cron"'
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: mobile-3
workerType: decision
requires: all-completed # Must be explicit because of Chain of Trust
priority: medium
retries: 5
scopes:
- assume:repo:github.com/mozilla-mobile/focus-android:cron: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.5
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
&& git reset --hard origin/master
&& git submodule update --init
&& python tools/taskcluster/release.py \
--channel nightly \
--commit \
--output /opt/focus-android/app/build/outputs/apk \
--apk focusArm/nightly/app-focus-arm-nightly-unsigned.apk \
--apk focusAarch64/nightly/app-focus-aarch64-nightly-unsigned.apk \
--apk klarArm/nightly/app-klar-arm-nightly-unsigned.apk \
--apk klarAarch64/nightly/app-klar-aarch64-nightly-unsigned.apk
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:
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