forked from Blockstream/green_ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
315 lines (285 loc) · 7.54 KB
/
.gitlab-ci.yml
File metadata and controls
315 lines (285 loc) · 7.54 KB
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
stages:
- format
- build
- distribute_qa
- deploy
- e2e
# Global Variables
variables:
GCS_BUCKET: "green-ios-builds"
# FORMAT
.setup_env:
before_script:
- export LC_ALL=en_US.UTF-8
- export LANG=en_US.UTF-8
- ruby --version && gem --version && fastlane --version
check_format:
stage: format
extends: .setup_env
tags:
- mini
script:
- fastlane run swiftlint
check_localization:
stage: format
extends: .setup_env
needs: []
tags:
- mini
script:
- python3 tools/check_localization.py
# BUILD
build_strings:
stage: build
when: manual
artifacts:
name: "green-ios-strings-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- translations
tags:
- mini
variables:
TX_TOKEN: $TX_TOKEN
script:
- ./tools/transifex.sh -t ${TX_TOKEN}
- mkdir translations
- cp -rf gaios/*.lproj translations
- rm -rf translations/Base.lproj
qa_debug_simulator:
stage: build
when: manual
extends: .setup_env
tags:
- mini
artifacts:
name: "green-ios-debug-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- debug/Build/Products/Debug-iphonesimulator/gaios.app
variables:
GDK_COMMIT: latest
script:
- if [ "$GDK_COMMIT" != "latest" ]; then GDK_OPT="-c $GDK_COMMIT"; fi
- ./tools/fetch_gdk_binaries.sh $GDK_OPT
- fastlane build_unsigned_debug
development:
stage: build
extends: .setup_env
tags:
- osx-m4
artifacts:
name: "green-ios-development-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- dev
variables:
GDK_COMMIT: latest
script:
- if [ "$GDK_COMMIT" != "latest" ]; then GDK_OPT="-c $GDK_COMMIT"; fi
- ./tools/fetch_gdk_binaries.sh $GDK_OPT
- fastlane dev_release
production:
stage: build
when: manual
extends: .setup_env
tags:
- osx-m4
artifacts:
name: "green-ios-production-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- prod
variables:
GDK_COMMIT: latest
script:
- if [ "$GDK_COMMIT" != "latest" ]; then GDK_OPT="-c $GDK_COMMIT"; fi
- ./tools/fetch_gdk_binaries.sh $GDK_OPT
- ruby --version && gem --version && fastlane --version
- fastlane prod_release
# UPLOAD
.distribute: &distribute
- ./tools/distribute.sh --app **/*.ipa --dest $FOLDER --url $LINK
- echo "$LINK/index.html" | tee -a link | qrencode -t UTF8 && cat link
.upload_countly: &upload_countly
- mkdir tmp && unzip ./**/*.app.dSYM.zip -d tmp
- COUNTLY_UPLOADER=$(find ~/Library/Developer/Xcode/DerivedData -iname countly_dsym_uploader.sh | head -n 1)
- find ./tmp -name \*.dSYM -exec $COUNTLY_UPLOADER $COUNTLY_APP_HOST $COUNTLY_APP_KEY {} \;
distribute_development:
stage: distribute_qa
needs: ["development"]
tags:
- osx-m4
artifacts:
name: "green-ios-development-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- dev
variables:
COUNTLY_APP_KEY: $COUNTLY_APP_KEY_DEV
COUNTLY_APP_HOST: $COUNTLY_APP_HOST
FOLDER: "dev"
LINK: "https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev"
script:
- *upload_countly
- *distribute
distribute_production:
stage: distribute_qa
needs: ["production"]
tags:
- osx-m4
artifacts:
name: "green-ios-production-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- prod
variables:
COUNTLY_APP_KEY: $COUNTLY_APP_KEY_PROD
COUNTLY_APP_HOST: $COUNTLY_APP_HOST
FOLDER: "prod"
LINK: "https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod"
script:
- *upload_countly
- *distribute
# STORE
upload_apple_store:
when: manual
stage: deploy
needs: ["distribute_production"]
tags:
- osx-m4
artifacts:
name: "green-ios-production-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- prod
script:
- fastlane upload_apple_store --verbose
timeout: 2 hours
# GCLOUD
.cp_gcloud: &cp_gcloud
- echo gs://$URLPATH
- TMPF=$(mktemp) || exit 1
- echo $GCLOUD_PUSH_KEY > $TMPF
- export GOOGLE_APPLICATION_CREDENTIALS=$TMPF
- gcloud auth activate-service-account --key-file=$TMPF
- gsutil cp -r $CI_PROJECT_DIR/$FOLDER gs://$URLPATH
- echo "https://storage.googleapis.com/$URLPATH/index.html"
cp_gcloud_development:
image: blockstream/gcloud-docker-tf:1.1.7
needs: ["distribute_development"]
tags:
- ga
stage: deploy
variables:
FOLDER: "dev"
URLPATH: "green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev"
script:
- *cp_gcloud
cp_gcloud_production:
image: blockstream/gcloud-docker-tf:1.1.7
needs: ["distribute_production"]
tags:
- ga
stage: deploy
variables:
FOLDER: "prod"
URLPATH: "green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod"
script:
- *cp_gcloud
# ============================================
# E2E TEST TRIGGER WORKFLOWS
# ============================================
# E2E Build Template (Simulator .app for Maestro)
.e2e_build_template:
stage: build
extends: .setup_env
tags:
- osx-m4
variables:
GDK_COMMIT: latest
script:
- if [ "$GDK_COMMIT" != "latest" ]; then GDK_OPT="-c $GDK_COMMIT"; fi
- ./tools/fetch_gdk_binaries.sh $GDK_OPT
- fastlane build_unsigned_debug
- cd debug/Build/Products/Debug-iphonesimulator && zip -r ../../../../gaios.app.zip gaios.app
artifacts:
paths:
- gaios.app.zip
expire_in: 1 day
timeout: 45 minutes
# E2E Upload Template
.e2e_upload_template:
stage: e2e
image: blockstream/gcloud-docker-tf:1.1.7
tags:
- ga
script:
- TMPF=$(mktemp) || exit 1
- echo $GCLOUD_PUSH_KEY > $TMPF
- export GOOGLE_APPLICATION_CREDENTIALS=$TMPF
- gcloud auth activate-service-account --key-file=$TMPF
- gsutil cp gaios.app.zip "gs://${GCS_BUCKET}/${E2E_APP_NAME}"
- echo "https://storage.googleapis.com/${GCS_BUCKET}/${E2E_APP_NAME}"
# --- Nightly E2E Jobs ---
e2e:nightly:build:
extends: .e2e_build_template
needs: []
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
e2e:nightly:upload:
extends: .e2e_upload_template
needs: ["e2e:nightly:build"]
variables:
E2E_APP_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_SHA}-nightly.app.zip"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
e2e:nightly:trigger:
stage: e2e
needs:
- e2e:nightly:upload
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
trigger:
project: blockstream/green/maestro-blockstream
variables:
UPSTREAM_IOS_APP_URL: "https://storage.googleapis.com/${GCS_BUCKET}/${CI_PROJECT_NAME}-${CI_COMMIT_SHA}-nightly.app.zip"
UPSTREAM_IOS_APP_ID: "io.blockstream.greendev"
UPSTREAM_MODE: "full"
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
UPSTREAM_TYPE: "nightly"
# --- Release E2E Jobs ---
e2e:release:build:
extends: .e2e_build_template
needs: []
rules:
- if: $CI_COMMIT_TAG =~ /^release_\d+\.\d+\.\d+/
e2e:release:upload:
extends: .e2e_upload_template
needs: ["e2e:release:build"]
variables:
E2E_APP_NAME: "${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.app.zip"
rules:
- if: $CI_COMMIT_TAG =~ /^release_\d+\.\d+\.\d+/
e2e:release:trigger:
stage: e2e
needs:
- e2e:release:upload
rules:
- if: $CI_COMMIT_TAG =~ /^release_\d+\.\d+\.\d+/
trigger:
project: blockstream/green/maestro-blockstream
variables:
UPSTREAM_IOS_APP_URL: "https://storage.googleapis.com/${GCS_BUCKET}/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.app.zip"
UPSTREAM_IOS_APP_ID: "io.blockstream.greendev"
UPSTREAM_MODE: "full"
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA
UPSTREAM_COMMIT_TAG: $CI_COMMIT_TAG
UPSTREAM_TYPE: "release"