-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
328 lines (309 loc) · 8.72 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
include:
- project: 'sysadm-docker/ubuntu-sshclient'
ref: 'master'
file: 'gitlab-ci-template.yml'
- project: 'security/security-tools'
ref: 'v2'
file: 'adapter/sdk/security-tools-store-android-sdk.yml'
variables:
SAST_EXPERIMENTAL_FEATURES: "true"
image: $CI_IMAGE
stages:
- generate_keystore
- build
- lint
- test
- security scan
- report_upload
- publish
- deploy
- linking
#
#generate android keystore:
# tags:
# - devops
# stage: generate_keystore
# script:
# - echo $STORE_FILE | base64 -di > xsolla.keystore
# - echo "keystorePath=../xsolla.keystore" > signing.properties
# - echo "keystorePassword=$STORE_PASSWORD" >> signing.properties
# - echo "keyAlias=$KEY_ALIAS" >> signing.properties
# - echo "keyPassword=$KEY_PASSWORD" >> signing.properties
# artifacts:
# paths:
# - xsolla.keystore
# - signing.properties
# expire_in: 2 hours
generate maven keystore:
tags:
- devops
stage: generate_keystore
only:
- /^v.*/
script:
- echo $GPG_FILE | base64 -di > gpg.gpg
- echo "signing.secretKeyRingFile=./../gpg.gpg" >> maven.properties
- echo "signing.keyId=$SIGNING_KEY_ID" >> maven.properties
- echo "signing.password=$SIGNING_PASSWORD" >> maven.properties
- echo "ossrhUsername=$OSSRH_USERNAME" >> maven.properties
- echo "ossrhPassword=$OSSRH_PASSWORD" >> maven.properties
artifacts:
paths:
- gpg.gpg
- maven.properties
expire_in: 2 hours
build:
tags:
- devops
stage: build
script:
- echo $STORE_FILE | base64 -di > xsolla.keystore
- echo "keystorePath=../xsolla.keystore" > signing.properties
- echo "keystorePassword=$STORE_PASSWORD" >> signing.properties
- echo "keyAlias=$KEY_ALIAS" >> signing.properties
- echo "keyPassword=$KEY_PASSWORD" >> signing.properties
- ./gradlew assembleRelease
- mkdir -p artifacts
- touch ./artifacts/info.txt
- echo "Build date $(date)" >> ./artifacts/info.txt
- echo "Git tag ${CI_COMMIT_REF_NAME}" >> ./artifacts/info.txt
- echo "Git commit ${CI_COMMIT_SHA}" >> ./artifacts/info.txt
- echo "Gitlab pipeline ${CI_PIPELINE_ID}" >> ./artifacts/info.txt
- mv app/build/outputs/apk/release/app-release.apk ./artifacts/SampleApp-Default.apk
artifacts:
expire_in: 24 hours
paths:
- artifacts
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
lint:
tags:
- devops
stage: lint
script:
- ./gradlew lint
artifacts:
expire_in: 24 hours
paths:
- app/build/reports/
- app-core/build/reports/
- xsolla-googleplay-sdk/build/reports/
- xsolla-inventory-sdk/build/reports/
- xsolla-login-sdk/build/reports/
- xsolla-login-sdk-facebook/build/reports/
- xsolla-login-sdk-google/build/reports/
- xsolla-login-sdk-qq/build/reports/
- xsolla-login-sdk-wechat/build/reports/
- xsolla-payments-sdk/build/reports/
- xsolla-store-sdk/build/reports/
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
dependency check:
allow_failure: true
tags:
- devops
stage: lint
script:
- echo $OWASP_SUPPRESS >> owasp-suppress.xml
- ./gradlew dependencyCheckAnalyze
artifacts:
expire_in: 24 hours
paths:
- app/build/reports/
- app-core/build/reports
- xsolla-googleplay-sdk/build/reports/
- xsolla-inventory-sdk/build/reports/
- xsolla-login-sdk/build/reports/
- xsolla-login-sdk-facebook/build/reports/
- xsolla-login-sdk-google/build/reports/
- xsolla-login-sdk-qq/build/reports/
- xsolla-login-sdk-wechat/build/reports/
- xsolla-payments-sdk/build/reports/
- xsolla-store-sdk/build/reports/
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
Inventory Test:
tags:
- devops
stage: test
script:
- ./gradlew :xsolla-inventory-sdk:setupTestVariables && ./gradlew :xsolla-inventory-sdk:test
artifacts:
when: always
expire_in: 24 hours
paths:
- xsolla-inventory-sdk/build/reports/
reports:
junit:
- xsolla-inventory-sdk/build/test-results/testReleaseUnitTest/TEST-*.xml
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
Login Test:
tags:
- devops
stage: test
script:
- ./gradlew :xsolla-login-sdk:setupTestVariables && ./gradlew :xsolla-login-sdk:test
artifacts:
when: always
expire_in: 24 hours
paths:
- xsolla-login-sdk/build/reports/
reports:
junit:
- xsolla-login-sdk/build/test-results/testReleaseUnitTest/TEST-*.xml
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
Store Test:
tags:
- devops
stage: test
script:
- ./gradlew :xsolla-store-sdk:setupTestVariables && ./gradlew :xsolla-store-sdk:test
artifacts:
when: always
expire_in: 24 hours
paths:
- xsolla-store-sdk/build/reports/
reports:
junit:
- xsolla-store-sdk/build/test-results/testReleaseUnitTest/TEST-*.xml
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
#generateReleaseApp:
# tags:
# - devops
# stage: publish
# before_script:
# - mkdir -p artifacts
# - touch ./artifacts/info.txt
# - echo "Build date $(date)" >> ./artifacts/info.txt
# - echo "Git tag ${CI_COMMIT_REF_NAME}" >> ./artifacts/info.txt
# - echo "Git commit ${CI_COMMIT_SHA}" >> ./artifacts/info.txt
# - echo "Gitlab pipeline ${CI_PIPELINE_ID}" >> ./artifacts/info.txt
# script:
# - mv app/build/outputs/apk/release/app-release.apk ./artifacts/SampleApp-Default.apk
# artifacts:
# expire_in: 24 hours
# paths:
# - artifacts
publishLogin:
tags:
- devops
stage: publish
when: manual
only:
- /^v.*/
script:
- ./gradlew :xsolla-login-sdk:build -x test && ./gradlew :xsolla-login-sdk:publishReleasePublicationToSonatypeRepository
- ./gradlew :xsolla-login-sdk-facebook:build -x test && ./gradlew :xsolla-login-sdk-facebook:publishReleasePublicationToSonatypeRepository
- ./gradlew :xsolla-login-sdk-google:build -x test && ./gradlew :xsolla-login-sdk-google:publishReleasePublicationToSonatypeRepository
- ./gradlew :xsolla-login-sdk-qq:build -x test && ./gradlew :xsolla-login-sdk-qq:publishReleasePublicationToSonatypeRepository
- ./gradlew :xsolla-login-sdk-wechat:build -x test && ./gradlew :xsolla-login-sdk-wechat:publishReleasePublicationToSonatypeRepository
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
publishStore:
tags:
- devops
stage: publish
when: manual
only:
- /^v.*/
script:
- ./gradlew :xsolla-store-sdk:build -x test && ./gradlew :xsolla-store-sdk:publishReleasePublicationToSonatypeRepository
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
publishInventory:
tags:
- devops
stage: publish
when: manual
only:
- /^v.*/
script:
- ./gradlew :xsolla-inventory-sdk:build -x test && ./gradlew :xsolla-inventory-sdk:publishReleasePublicationToSonatypeRepository
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
publishPayments:
tags:
- devops
stage: publish
when: manual
only:
- /^v.*/
script:
- ./gradlew :xsolla-payments-sdk:build -x test && ./gradlew :xsolla-payments-sdk:publishReleasePublicationToSonatypeRepository
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/*
build doc:
tags:
- devops
stage: build
script:
- ./gradlew dokkaHtmlMultiModule
- git clone https://[email protected]/xsolla/sdk-reference-parser-android.git
- mkdir -p sdk-reference-parser-android/src/htmlMultiModule
- mkdir -p sdk-reference-parser-android/dist
- mv -v build/dokka/htmlMultiModule/* sdk-reference-parser-android/src/htmlMultiModule
- cd sdk-reference-parser-android
- sudo apt update
- sudo apt-get install curl
- curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
- sudo apt install nodejs
- npm install
- npm start
- mv -v dist/htmlMultiModule/* dist >/dev/null
- cd dist && zip -r $CI_PROJECT_DIR/build.zip * >/dev/null
artifacts:
expire_in: 24 hours
paths:
- build.zip
deploy doc:
stage: deploy
extends: .deploy doc
only:
- /^v.*/
dependencies:
- build doc
environment:
name: doc/$CI_COMMIT_REF_SLUG
url: https://$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.doc.srv.local/$URL_SLUG
on_stop: stop doc
when: manual
current doc:
extends: .current doc
only:
- /^v.*/
dependencies:
- deploy doc
environment:
name: doc/current
url: https://developers.xsolla.com/sdk-code-references/android-store
stop doc:
extends: .stop doc
only:
- /^v.*/
environment:
name: doc/$CI_COMMIT_REF_SLUG
action: stop
dependencies: []