-
Notifications
You must be signed in to change notification settings - Fork 91
/
.gitlab-ci.yml
222 lines (199 loc) · 6.61 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
stages:
- prepare
- i18n
- github
- trigger
##
## ---- Variables
##
variables:
ATLAS_DEPLOY_ENV: "true"
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
# We use this variable when we run publish-github jobs
RELEASE_GITHUB_REPOSITORY: [email protected]:ProtonVPN/ios-mac-app.git
# Folder where jobs put their output like build binaries, test results, etc.
JOBS_OUTPUT_PATH: "output"
# Default tart settings
TART_EXECUTOR_ALWAYS_PULL: "false"
TART_EXECUTOR_HEADLESS: "false"
DESCRIBE_DIR: "apple-vpn-ci"
PIPELINE_TEMPLATE: "gitlab-pipeline.yml"
IMAGES: $IMAGES
default:
image: "team-vpn-macos-14.6.1-xcode-15.4"
# Only start a pipeline if it's for a merge request, if the pipeline has been scheduled, if this is a merge result onto
# the develop branch, or if this is a tag which begins with a recognized tag prefix like `mac` or `ios`.
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" ||
$CI_PIPELINE_SOURCE == "schedule" ||
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ||
$CI_COMMIT_TAG =~ /mac|ios|tv\/\d+/ ||
$CI_COMMIT_BRANCH == "jkb/feat/VPNAPPL-1507-new-ci"
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'
# Generate a dynamic pipeline for each build train (platform) we support. This pipeline is based off of the template
# at Integration/Templates/gitlab-pipeline.yml, and builds, tests, and publishes all necessary artifacts.
#
# Jobs that do not require running multiple times for each build train should remain in .gitlab-ci.yml.
# - component: gitlab.protontech.ch/proton/devops/cicd-components/community/git-lhc/describe (not in the catalog yet)
- project: 'proton/devops/cicd-components/community/git-lhc'
file: templates/describe.yml
ref: 0.8.0-alpha.10
inputs:
output_directory: apple-vpn-ci
cmd_prefix: "mint run "
templates: "$PIPELINE_TEMPLATE pages.docc fastlane slack-message.txt sparkle-item.xml issue-hashes.txt"
trains: "ios mac tv"
##
## ---- Job templates shamefully stolen from Integration/Templates/gitlab-pipeline.yml
##
.job_template:
before_script:
- Integration/Scripts/pipeline_setup.sh
.mint_cache:
variables:
MINT_PATH: $CI_PROJECT_DIR/.caches/mint
MINT_LINK_PATH: $MINT_PATH/bin
MINT_CACHE_POLICY: pull-push
cache:
- key: mint-$CI_COMMIT_REF_SLUG
fallback_keys:
- mint-$CI_DEFAULT_BRANCH
paths:
- $MINT_PATH
policy: $MINT_CACHE_POLICY
##
## ---- Translations
##
# Jobs come from the generator inside gitlab translations/generator
# Config for the project itself (i18n config) is inside translations/config-app
i18n-crowdin-upload:
stage: i18n
variables:
I18N_SYNC_CROWDIN_PROJECT: 'apple-vpn'
extends: .i18n-sync-crowdin-shared-apple
i18n-crowdin-download:
stage: i18n
variables:
I18N_COMMIT_CROWDIN_PROJECT: 'apple-vpn'
extends: .i18n-commit-locales-shared-apple
i18n-tv-upload:
stage: i18n
variables:
I18N_SYNC_CROWDIN_PROJECT: 'apple-vpn-tv'
extends: .i18n-sync-crowdin-shared-apple
i18n-tv-download:
stage: i18n
variables:
I18N_COMMIT_CROWDIN_PROJECT: 'apple-vpn-tv'
extends: .i18n-commit-locales-shared-apple
##
## ---- Linting/pipeline generation
##
# Lint the project, then generate the pipeline.
prepare:
extends:
- .job_template
- .mint_cache
variables:
GIT_DEPTH: 200
GIT_SUBMODULE_STRATEGY: none
stage: prepare
tags:
- vpn-apple-xs
before_script:
- !reference [.job_template, before_script]
- !reference [.lhc_describe, before_script]
script:
- |
# Lint commits, code quality, and translations on branches only (not tags)
if [ -z "$CI_COMMIT_TAG" ] && [ "$CI_MERGE_REQUEST_EVENT_TYPE" != "merge_train" ]; then
mint run git-lhc lint --verbose --train ios # Lint commit history
Integration/Scripts/code_quality.sh # Lint code quality
Integration/Scripts/lint_translations.sh # Lint string files
fi
- !reference [.lhc_describe, script] # Generate child pipelines
- | # Use template output to fetch workflow information, and update the repo (don't require success)
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
Integration/Scripts/update_workflow_metadata.sh || true
elif [ -n "$CI_COMMIT_TAG" ]; then
Integration/Scripts/update_workflow_metadata.sh "$DESCRIBE_DIR/release/issue-hashes.txt" || true
else
Integration/Scripts/update_workflow_metadata.sh \
"$DESCRIBE_DIR/mac/issue-hashes.txt" \
"$DESCRIBE_DIR/ios/issue-hashes.txt" \
"$DESCRIBE_DIR/tv/issue-hashes.txt" \
|| true
fi
# Don't fail if push doesn't work, there will be plenty of opportunities to update in a later pipeline
git push origin refs/notes/proton/attrs || true
rules:
- if: $CI_MERGE_REQUEST_TITLE =~ /^Draft:/ # Don't run pipelines automatically for draft MRs
when: manual
- if: $I18N_SCHEDULES_FILTER == "commit-translations" # Don't run pipelines when syncing from crowdin
when: never
- when: always
artifacts:
expire_in: 5 days
paths:
- apple-vpn-ci/*/*
- codequality_report.json
reports:
codequality: codequality_report.json
##
## ---- Trigger dynamic pipelines
##
# If a tag was pushed, then only one pipeline was created. Otherwise, LHC generated one pipeline for each build train,
# and we need to trigger each one in a matrix.
# Trigger the pipeline generated by the describe job, for one or all trains as necessary.
.trigger_template:
stage: trigger
variables:
# For tagging commits with the pipeline id
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
# For fetching job artifacts (avoids a bug [!366870] in Gitlab dependencies)
PARENT_JOB_ID: $CI_JOB_ID
trigger:
strategy: depend
forward:
pipeline_variables: true
yaml_variables: true
.trigger_deploy:
stage: deploy
strategy: depend
variables:
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
trigger:tag:
extends:
- .trigger_template
trigger:
include:
- artifact: "$DESCRIBE_DIR/release/$PIPELINE_TEMPLATE"
job: prepare
rules:
- if: $CI_COMMIT_TAG
when: on_success
- when: never
trigger:branch:
extends:
- .trigger_template
parallel:
matrix:
- TRAIN: [ios, mac, tv]
trigger:
include:
- artifact: "$DESCRIBE_DIR/$TRAIN/$PIPELINE_TEMPLATE"
job: prepare
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $I18N_SCHEDULES_FILTER == "commit-translations"
when: never
- when: on_success