forked from Blockstream/green_ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
218 lines (199 loc) · 5.37 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
stages:
- format
- build
- sign
- deploy
- gcloud
- test
- store
# FORMAT
test_format:
stage: format
tags:
- fastosx
- osx
script:
- fastlane run swiftlint
# BUILD
build_unsigned_debug:
stage: build
when: manual
tags:
- mini
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
build_dev_release:
stage: build
tags:
- mini
artifacts:
name: "green-ios-dev-$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 build_unsigned_dev_release
build_prod_release:
stage: build
when: manual
tags:
- mini
artifacts:
name: "green-ios-$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
- fastlane build_unsigned_prod_release
# SIGN
sign_dev_release:
stage: sign
needs: ["build_dev_release"]
tags:
- osxsigner
artifacts:
name: "green-ios-dev-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- dev
script:
- fastlane sign_dev_release
after_script:
- rm -rf dev/Green.xcarchive
sign_prod_release:
stage: sign
needs: ["build_prod_release"]
tags:
- osxsigner
artifacts:
name: "green-ios-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- prod
script:
- fastlane sign_prod_release
after_script:
- rm -rf prod/Green.xcarchive
# DEPLOY
deploy_dev_release:
stage: deploy
needs: ["sign_dev_release"]
tags:
- osxsigner
artifacts:
name: "green-ios-dev-$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
script:
- mkdir tmp && unzip ./dev/Green-dev.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 {} \;
- LINK="https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev"
- ./tools/distribute.sh --app dev/Green-dev.ipa --dest dev --url $LINK
- echo "$LINK/index.html"
- echo "$LINK/index.html" | qrencode -t UTF8
deploy_prod_release:
stage: deploy
needs: ["sign_prod_release"]
tags:
- osxsigner
artifacts:
name: "green-ios-$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
script:
- mkdir tmp && unzip ./prod/Green.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 {} \;
- LINK="https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod"
- ./tools/distribute.sh --app prod/Green.ipa --dest prod --url $LINK
- echo "$LINK/index.html"
- echo "$LINK/index.html" | qrencode -t UTF8
# STORE
upload_apple_store:
when: manual
stage: store
needs: ["deploy_prod_release"]
tags:
- osxsigner
artifacts:
name: "green-ios-$CI_COMMIT_REF_NAME"
expire_in: 1 day
when: on_success
paths:
- prod
script:
- fastlane upload_apple_store
# TESTS
ui_tests:
stage: test
tags:
- osx
when: manual
needs: ["build_unsigned_debug"]
before_script:
- xcrun simctl boot "iPhone 11"
- xcrun simctl privacy "iPhone 11" grant all io.blockstream.green
script:
- cd $CI_PROJECT_DIR
- export LC_ALL=en_US.UTF-8
- export LANG=en_US.UTF-8
- ./tools/fetch_gdk_binaries.sh --simulator
- fastlane ui_tests
after_script:
- xcrun simctl shutdown "iPhone 11"
# GCLOUD
cp_gcloud_dev:
image: blockstream/gcloud-docker-tf:1.1.7
needs: ["deploy_dev_release"]
tags:
- ga
stage: gcloud
script:
- echo gs://green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev
- 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/dev gs://green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev
- echo "https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-dev/index.html"
cp_gcloud_prod:
image: blockstream/gcloud-docker-tf:1.1.7
needs: ["deploy_prod_release"]
tags:
- ga
stage: gcloud
script:
- echo gs://green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod
- 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/prod gs://green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod
- echo "https://storage.googleapis.com/green-ios-builds/$CI_PROJECT_NAME-$CI_COMMIT_SHA-prod/index.html"