-
Notifications
You must be signed in to change notification settings - Fork 208
/
.gitlab-ci.yml
323 lines (296 loc) · 7.62 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
include:
- local: ".gitlab-ci.d/i18n.yml"
- project: "tpe/testmo-reporter"
file: '/scenarios/testmo-script.yml'
- component: gitlab.protontech.ch/proton/devops/cicd-components/kits/devsecops/[email protected]
inputs:
allowed-to-fail: false
run-gitleaks-no-git-scan: false
stage: scan
- component: gitlab.protontech.ch/tpe/test-scripts/[email protected]
# - component: gitlab.protontech.ch/proton/devops/cicd-components/kubernetes/atlas-deploy/[email protected]
# inputs:
# cleanup-stage: cleanup
# - component: gitlab.protontech.ch/proton/devops/cicd-components/kubernetes/atlas-deploy/[email protected]
# inputs:
# cleanup-stage: cleanup
# deploy: manual
# cleanup: manual
# images: $IMAGES
# key: customenv$CI_PIPELINE_ID
# suffix: ":custom"
variables:
LANG: "en_US.UTF-8"
MINT_PATH: "$CI_PROJECT_DIR/ci-cache/mint"
ATLAS_DEPLOY_LIST: ""
ATLAS_LINK_APP: mail
GIT_SUBMODULE_STRATEGY: recursive
IMAGES: $IMAGES
# See https://confluence.protontech.ch/pages/viewpage.action?pageId=121918293
stages:
- i18n
- scan
# - deploy
- build
- test
- report
# - cleanup
- distribute
- bot
.setup_project: &setup_project
- echo -e "machine gitlab.protontech.ch\n login gitlab-ci-token\n password $CI_JOB_TOKEN\n\n" > ~/.netrc
- chmod 0600 ~/.netrc
- mint bootstrap
- cd ProtonMail
- bundle install
- ./xcodeGenHelper.sh
- cd ..
.macos_job:
image: team-mail:1
cache:
- key:
files:
- Mintfile
paths:
- ci-cache/mint
when: always
- key:
files:
- ProtonMail/Gemfile.lock
paths:
- bundler-cache
when: always
- key:
files:
- ProtonMail/ProtonMail.xcworkspace/xcshareddata/swiftpm/Package.resolved
paths:
- ci-cache/spm
when: always
before_script:
- *setup_project
tags:
- mail-tart
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: $CI_COMMIT_BRANCH == "develop"
build:debug:for-testing:
extends: .macos_job
stage: build
allow_failure: false
interruptible: true
artifacts:
when: on_success
paths:
- test_output/Build/Products/Debug-iphonesimulator/ProtonMail.app
- test_output/Build/Products/Debug-iphonesimulator/ProtonMailUITests-Runner.app
- build_job_pwd.txt
expire_in: 1 day
script:
- cd ProtonMail
- bundle exec fastlane build_for_testing
# record the current directory so that it can be used by the test jobs to calculate code coverage if they run on a different runner
- echo ${PWD#/private} >> ../build_job_pwd.txt
test:unit:
extends: .macos_job
stage: test
coverage: '/Test Coverage: \d*.\d*%/'
only:
- master
- main
- develop
- /^release\/.*$/
- merge_requests
except:
- schedules
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: test_output/slatherOutput/cobertura.xml
paths:
- test_output/slatherOutput/
script:
- brew bundle --force
- cd ProtonMail
- bundle exec fastlane unit_test
- ../Scripts/generate_code_coverage_report.sh
tags:
- iOS_GENERAL
.test:ui:
extends: .macos_job
dependencies:
# - atlas:deploy:pipenv
- build:debug:for-testing
stage: test
artifacts:
when: always
name: "test-report"
paths:
- test_output/TestResults
expire_in: 10 days
reports:
junit:
- test_output/TestResults/report.xml
before_script:
- defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0 # Fixed UI tests failing on secure field
- brew bundle --force
- *setup_project
tags:
- iOS_UITEST
# test:ui:smoke:
# extends: .test:ui
# except:
# - schedules
# only:
# refs:
# - master
# - main
# - develop
# - /^release\/.*$/
# - merge_requests
# artifacts:
# reports:
# coverage_report:
# coverage_format: cobertura
# path: test_output/slatherOutput/cobertura.xml
# script:
# - echo DYNAMIC_DOMAIN="${DYNAMIC_DOMAIN}"
# - cd ProtonMail
# - bundle exec fastlane ui_test testplan:"SmokeTests" concurrent_workers:"2"
# - ../Scripts/generate_code_coverage_report.sh
# tags:
# - iOS_GENERAL
test:ui:sanity:
extends: .test:ui
rules:
# Allow job to run automatically on each scheduled job with sanity test type
- if: '$CI_PIPELINE_SOURCE == "schedule" && $TEST_TYPE == "sanity"'
when: always
- when: manual
script:
- echo DYNAMIC_DOMAIN="${DYNAMIC_DOMAIN}"
- cd ProtonMail
- bundle exec fastlane ui_test testplan:"SanityTests" concurrent_workers:"4"
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: test_output/slatherOutput/cobertura.xml
allow_failure: true
test:ui:feature:
extends: .test:ui
rules:
- if: '$TEST_TYPE == "feature"'
when: always
script:
- cd ProtonMail
- bundle exec fastlane ui_test testplan:$TEST_PLAN concurrent_workers:$NUMBER_OF_DEVICES
test:ui:regression:
extends: .test:ui
timeout: 4 hours
rules:
# Allow job to run automatically on each scheduled job with regression test type
- if: '$CI_PIPELINE_SOURCE == "schedule" && $TEST_TYPE == "regression"'
when: always
- when: manual
script:
- cd ProtonMail
- bundle exec fastlane ui_test testplan:RegressionTests concurrent_workers:$NUMBER_OF_DEVICES
allow_failure: true
test:ui:monkey:
extends: .test:ui
timeout: 2 hours
rules:
- if: '$TEST_TYPE == "monkey"'
artifacts:
name: "monkey-report"
script:
- cd ProtonMail
- bundle exec fastlane ui_test testplan:MonkeyTests concurrent_workers:1
.report:slack:
stage: report
extends:
- .reporting:slack
variables:
FOLDER_PATH: "test_output/TestResults/"
PLATFORM: "ios"
allow_failure: true
tags:
- shared-small
report:slack:feature:
dependencies:
- test:ui:feature
- test:ui:regression
extends: .report:slack
rules:
- if: '$TEST_TYPE == "regression" || $TEST_TYPE == "feature"'
when: always
variables:
SLACK_CHANNEL: "$SLACK_CHANNEL"
JOB_NAME: "$TEST_PLAN"
report:slack:monkey:
dependencies:
- test:ui:monkey
extends: .report:slack
rules:
- if: '$TEST_TYPE == "monkey"'
when: always
variables:
SLACK_CHANNEL: "mail-ios-uitests"
JOB_NAME: "Mail-iOS-Monkey-tests"
.report:testmo:
extends: .testmo-upload
stage: report
rules:
- when: manual
before_script:
- echo "$MILESTONE"
- 'if [ -z $MILESTONE ]; then echo "Testmo MILESTONE is not provided. Failing the job."; exit 1; fi'
variables:
PROJECT_ID: "7"
MILESTONE: "$MILESTONE"
TAGS: "$CI_COMMIT_REF_SLUG"
SOURCE: "ios"
RESULT_FOLDER: "./test_output/TestResults/*.xml"
allow_failure: true
tags:
- shared-small
report:testmo:regression:
dependencies:
- test:ui:regression
extends: .report:testmo
variables:
NAME: "$TEST_PLAN"
report:testmo:sanity:
needs:
- test:ui:sanity
extends: .report:testmo
variables:
NAME: "SanityTests"
.testflight:
extends: .macos_job
dependencies: []
needs: []
stage: distribute
rules:
- if: '$CI_PIPELINE_SOURCE != "schedule"'
when: manual
allow_failure: true
script:
- brew bundle --force
- cd ProtonMail
- base64 -D -o Certificates.p12 <<< $DISTRIBUTION_CERTIFICATE
- bundle exec fastlane distribute scheme:"$SCHEME"
- ./fastlane/add_git_tag.sh
tags:
- iOS_RELEASE_BUILD
testflight:qa:
extends: .testflight
variables:
SCHEME: "Adhoc"
testflight:release:
extends: .testflight
variables:
SCHEME: "ProtonMail"