forked from ProtonMail/proton-mail-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
361 lines (326 loc) · 8.96 KB
/
.gitlab-ci.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
default:
image: $CI_REGISTRY/protonvpn/android/android-app-new:latest
before_script:
- export JAVA_TOOL_OPTIONS="-Dhttp.proxyHost=$( echo ${http_proxy##http://} | cut -d':' -f1 ) -Dhttp.proxyPort=$( echo ${http_proxy##http://} | cut -d':' -f2 ) -Dhttps.proxyHost=$( echo ${https_proxy##http://} | cut -d':' -f1 ) -Dhttps.proxyPort=$( echo ${https_proxy##http://} | cut -d':' -f2 ) -Dhttp.nonProxyHosts=\"$( echo $no_proxy | tr ',' '|' )\""
# - echo -e "y\ny\ny\ny\ny\ny\ny\ny\n" | $ANDROID_HOME/tools/bin/sdkmanager --licenses --proxy=http --proxy_host=$( echo ${https_proxy##http://} | cut -d':' -f1 ) --proxy_port=$( echo ${https_proxy##http://} | cut -d':' -f2 )
- export GRADLE_USER_HOME=`pwd`/.gradle
- export VERSION_NAME=$(grep -E "versionName " buildSrc/src/main/kotlin/ProtonMail.kt | awk '{print $5}' | sed s/\"//g)
- export VERSION_CODE=$(grep -E "versionCode " buildSrc/src/main/kotlin/ProtonMail.kt | awk '{print $5}' | sed s/\"//g)
- echo "App version name ${VERSION_NAME}"
- echo "App version name ${VERSION_CODE}"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle
- '**/build'
- '**/**/build'
- '**/**/**/build'
stages:
- manual-release
- analyze
- build
- test
- bot-i18n
- bot-release
#####################
.detekt-analysis-common:
stage: analyze
tags:
- medium
script:
- ./gradlew detekt
artifacts:
reports:
codequality: config/detekt/reports/detekt.txt
detekt analysis release:
extends: .detekt-analysis-common
allow_failure: true
only:
- release
- prerelease
- tags
except:
- schedules
detekt analysis:
extends: .detekt-analysis-common
only:
refs:
- merge_requests
- branches
- schedules
except:
- release
- prerelease
- tags
.build-debug-common:
stage: build
only:
- merge_requests
- branches
- schedules
tags:
- large
script:
- ./gradlew assembleBetaDebug
- ./gradlew assembleBetaDebugAndroidTest
artifacts:
expire_in: 1 week
paths:
- app/build/outputs/apk
build debug:
extends: .build-debug-common
needs:
- job: detekt analysis
except:
- develop
- release
- prerelease
- tags
- schedules
build debug develop:
extends: .build-debug-common
needs:
- job: detekt analysis
only:
- develop
script:
- ./gradlew clean
- ./gradlew assembleBetaDebug
- ./gradlew assembleBetaDebugAndroidTest
build debug uitests:
extends: .build-debug-common
only:
- schedules
script:
- ./gradlew clean
- ./gradlew assembleBetaDebug
- ./gradlew assembleBetaDebugAndroidTest
build debug release:
extends: .build-debug-common
only:
- release
- prerelease
- tags
build prerelease:
stage: build
except:
- schedules
only:
- prerelease
- tags
tags:
- large
script:
- ./gradlew clean
- ./gradlew assembleProductionRelease
artifacts:
expire_in: 3 week
paths:
- app/build/outputs
build release:
stage: build
except:
- schedules
only:
- release
tags:
- large
script:
- ./gradlew clean
- ./gradlew assembleProductionRelease
artifacts:
expire_in: 4 week
paths:
- app/build/outputs
.unit-tests-common:
stage: test
only:
- merge_requests
- branches
except:
- schedules
tags:
- large
script:
- ./gradlew -Pci --console=plain allTest
unit tests:
extends: .unit-tests-common
needs:
- job: build debug
except:
- develop
- release
- prerelease
- tags
- schedules
unit tests develop:
extends: .unit-tests-common
needs:
- job: build debug develop
only:
- develop
unit tests release:
extends: .unit-tests-common
only:
- release
- prerelease
- tags
.firebase-tests-common:
stage: test
only:
- merge_requests
- branches
except:
- schedules
tags:
- medium
script:
- wget --quiet --output-document=/tmp/google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
- mkdir -p /opt
- tar zxf /tmp/google-cloud-sdk.tar.gz --directory /opt
- /opt/google-cloud-sdk/install.sh --quiet
- source /opt/google-cloud-sdk/path.bash.inc
- gcloud components update
- echo $CLOUD_PROJECT_ID_MAIL
- gcloud config set project $CLOUD_PROJECT_ID_MAIL
- echo $SERVICE_ACCOUNT_MAIL > /tmp/service-account.json
- gcloud auth activate-service-account --key-file /tmp/service-account.json
- gcloud --quiet firebase test android run
--app app/build/outputs/apk/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug.apk
--test app/build/outputs/apk/androidTest/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug-androidTest.apk
--device model=Pixel2,version=28
--test-targets "class ch.protonmail.android.uitests.tests.suites.SmokeSuite"
--use-orchestrator
--num-flaky-test-attempts=1
--timeout 45m
firebase tests:
extends: .firebase-tests-common
needs:
- job: build debug
except:
- develop
- release
- prerelease
- tags
- schedules
firebase tests develop:
extends: .firebase-tests-common
needs:
- job: build debug develop
only:
- develop
firebase tests release:
extends: .firebase-tests-common
only:
- release
- prerelease
- tags
firebase feature tests:
stage: test
needs:
- job: build debug uitests
rules:
- if: '$TEST_TYPE == "feature" || $TEST_TYPE == "regression"'
tags:
- medium
variables:
MODEL: ""
script:
- if [ -z ${DEVICE_MODEL+x} ]; then MODEL="Pixel2"; else MODEL=$DEVICE_MODEL; fi
- wget --quiet --output-document=/tmp/google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
- mkdir -p /opt
- tar zxf /tmp/google-cloud-sdk.tar.gz --directory /opt
- /opt/google-cloud-sdk/install.sh --quiet
- source /opt/google-cloud-sdk/path.bash.inc
- gcloud components update --quiet
- echo $CLOUD_PROJECT_ID_MAIL
- gcloud config set project $CLOUD_PROJECT_ID_MAIL --quiet
- echo $SERVICE_ACCOUNT_MAIL > /tmp/service-account.json
- gcloud auth activate-service-account --key-file /tmp/service-account.json --quiet
- export CLOUDSDK_CORE_DISABLE_PROMPTS=1
- gcloud beta firebase test android run
--quiet
--app app/build/outputs/apk/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug.apk
--test app/build/outputs/apk/androidTest/beta/debug/ProtonMail-Android-${VERSION_NAME}-beta-debug-androidTest.apk
--device model=$MODEL,version=$API_LEVEL
--test-targets "class ch.protonmail.android.uitests.tests.$TEST_CLASS"
--use-orchestrator
--num-flaky-test-attempts=1
--timeout 45m
--client-details testType=$TEST_TYPE,testSuite=$TEST_CLASS,commitBranch=$CI_COMMIT_BRANCH,gitlabJobUrl=$CI_JOB_URL
include:
- project: 'translations/generator'
ref: master
file: '/jobs/sync-crowdin.gitlab-ci.yml'
- project: 'translations/generator'
ref: master
file: '/jobs/commit-locales.gitlab-ci.yml'
- project: 'translations/spellcheck'
ref: master
file: '/jobs/android.gitlab-ci.yml'
- project: 'agarroux/publish-github'
ref: master
file: '/jobs/release.gitlab-ci.yml'
i18n-sync-crowdin:
stage: bot-i18n
variables:
I18N_SYNC_CROWDIN_PROJECT: 'android-mail'
extends: .i18n-sync-crowdin-shared
except:
variables:
- $TEST_TYPE == "feature" || $TEST_TYPE == "regression"
i18n-commit-locales:
stage: bot-i18n
variables:
I18N_COMMIT_CROWDIN_PROJECT: 'android-mail'
extends: .i18n-commit-locales-shared
except:
variables:
- $TEST_TYPE == "feature" || $TEST_TYPE == "regression"
i18n-spellcheck:
stage: analyze
extends: .spellcheck-common
variables:
I18N_MAIN_BRANCH: develop
release-publish-github:
stage: manual-release
when: 'manual'
variables:
RELEASE_SYNC_PUBLIC_URL: [email protected]:ProtonMail/proton-mail-android.git
RELEASE_SYNC_TO_BRANCH: 'release'
RELEASE_SYNC_FROM_BRANCH: 'release'
extends: .release-sync-commit-shared
tags:
- small
release-publish-github-tags:
needs:
- job: build prerelease
artifacts: true
stage: bot-release
variables:
RELEASE_SYNC_PUBLIC_URL: [email protected]:ProtonMail/proton-mail-android.git
RELEASE_SYNC_TO_BRANCH: 'release'
RELEASE_SYNC_FROM_BRANCH: 'release'
extends: .release-sync-tags-shared
tags:
- small
publish-github:
stage: bot-release
needs:
- job: build prerelease
artifacts: true
variables:
RELEASE_APP: android-mail
RELEASE_GITHUB_REPOSITORY: ProtonMail/proton-mail-android
RELEASE_GITHUB_BRANCH: 'release'
extends: .release-make-release
tags:
- small
check for fixups:
stage: analyze
only:
- merge_requests
script:
- git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- git fetch origin "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- git log --pretty=%s "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME..origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" | awk '$0 ~ /^fixup/ {find = 1}; END { exit find }'