forked from evernym/verity-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
353 lines (324 loc) · 9.42 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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
image: gitlab.corp.evernym.com:4567/dev/containers/build-sdk:134b350a
stages:
- test
- package
- doc
- publish
- publish-docker
variables:
DEV_BASE_VERSION: "0.4.7"
DEV_VERSION: '$DEV_BASE_VERSION-$CI_COMMIT_SHORT_SHA'
.java-common:
cache:
paths:
- .m2/repository
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
before_script:
- cd sdk/java-sdk/
- mvn versions:set -DnewVersion=$DEV_VERSION
java-test:
stage: test
tags:
- docker-machine
- large
extends:
- .java-common
script:
- mvn pmd:check # Java SDK linting
- mvn pmd:cpd-check # Java SDK linting
- mvn test # Java SDK unit tests
java-package:
stage: package
tags:
- docker-machine
- micro
extends:
- .java-common
script:
- mvn package -DskipTests
java-doc:
stage: doc
tags:
- docker-machine
- micro
extends:
- .java-common
script:
- mvn javadoc:javadoc
java-publish:
stage: publish
tags:
- docker-machine
- micro
extends:
- .java-common
script:
- mvn --errors deploy --settings ./settings.xml -DskipTests
when: on_success
only:
refs:
- "master@dev/verity/verity-sdk"
changes:
- sdk/java-sdk/**/*
- .gitlab-ci.yml
java-release:
stage: publish
tags:
- s3docs
- docker-machine
extends:
- .java-common
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- gpg --batch --passphrase $OSSHR_GPG_PASSPHRASE --import $OSSRH_GPG_SIGNING_KEY # set GPG key to keyring
- mvn versions:set -DnewVersion=$RELEASE_VERSION # set version to tagged version
- mvn clean deploy --settings ./settings.xml -DskipTests -P release # deploy to sonatype OSSRH repo
- mvn javadoc:javadoc # build javadoc
- aws s3 sync doc/_build s3://developer.evernym.com/doc/java/$RELEASE_VERSION # upload javadoc to s3
allow_failure: true
only:
refs:
- tags@dev/verity/verity-sdk
.python-common:
variables:
DEV_VERSION: '$DEV_BASE_VERSION.$CI_COMMIT_SHORT_SHA'
before_script:
- cd sdk/python-sdk/
- echo "VERSION = '$DEV_VERSION'" > verity_sdk/version.py
python-test:
stage: test
tags:
- docker-machine
- micro
extends:
- .python-common
script:
- make lint # Python SDK linting
- pytest # Python SDK unit tests
python-package:
stage: package
tags:
- docker-machine
- micro
extends:
- .python-common
script:
- make build-artifacts
python-doc:
stage: doc
tags:
- docker-machine
- micro
extends:
- .python-common
script:
- make doc-build
python-publish:
stage: publish
tags:
- docker-machine
- micro
extends:
- .python-common
script:
- make upload
only:
refs:
- "master@dev/verity/verity-sdk"
changes:
- sdk/python-sdk/**/*
- .gitlab-ci.yml
python-release:
stage: publish
tags:
- s3docs
- docker-machine
extends:
- .python-common
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- echo "VERSION = '$RELEASE_VERSION'" > verity_sdk/version.py # set version to tagged version
- echo "$RELEASE_VERSION"
- make upload-to-pypi # upload to pypi
- make doc-build # build doc
- aws s3 sync doc/_build s3://developer.evernym.com/doc/python/$RELEASE_VERSION # upload javadoc to s3
allow_failure: true
only:
refs:
- tags@dev/verity/verity-sdk
.nodejs-common:
before_script:
- cd sdk/nodejs-sdk/
- npm version --no-git-tag-version $DEV_VERSION
nodejs-test:
stage: test
tags:
- docker-machine
- micro
extends:
- .nodejs-common
script:
- npm install
- npm run lint # Node.js linting
- npm test # Node.js testing
nodejs-doc:
stage: doc
tags:
- docker-machine
- micro
extends:
- .nodejs-common
script:
- npm install
- npm run doc-build
nodejs-publish:
stage: publish
tags:
- docker-machine
- micro
extends:
- .nodejs-common
script:
- npm run package
- npm run publish
only:
refs:
- master@dev/verity/verity-sdk
changes:
- sdk/nodejs-sdk/**/*
- .gitlab-ci.yml
nodejs-release:
stage: publish
tags:
- s3docs
- docker-machine
extends:
- .nodejs-common
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- npm version --no-git-tag-version $RELEASE_VERSION # set version to tagged version
- echo '//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}' > .npmrc # set rc file to use auth token
- npm install # pre for publish
- npm publish # publish to npm
- npm run doc-build # build doc
- aws s3 sync doc/_build s3://developer.evernym.com/doc/nodejs/$RELEASE_VERSION # upload javadoc to s3
allow_failure: true
only:
refs:
- tags@dev/verity/verity-sdk
.dotnet-common:
before_script:
- cd sdk/dotnet-sdk/src/
dotnet-test:
stage: test
tags:
- docker-machine
- large
extends:
- .dotnet-common
script:
- cd VeritySDK.Test
- dotnet restore -p:Configuration=Release
- dotnet build -c Release /warnaserror # DotNet SDK build with warning as error
- dotnet test # DotNet SDK tests
dotnet-package:
stage: package
tags:
- docker-machine
- micro
extends:
- .dotnet-common
script:
- cd VeritySDK
- dotnet restore -p:Configuration=Release
- dotnet build -c Release
- dotnet pack -c Release -p:PackageVersion=$DEV_VERSION
dotnet-doc:
stage: doc
tags:
- docker-machine
- micro
extends:
- .dotnet-common
script:
- cd VeritySDK.Doc
- dotnet restore -p:Configuration=Release
- dotnet build -c Release -p:BuildDocToolPath=/usr/bin/docfx
dotnet-publish:
stage: publish
tags:
- docker-machine
- micro
extends:
- .dotnet-common
script:
- cd VeritySDK
- dotnet restore -p:Configuration=Release
- dotnet build -c Release
- dotnet pack -c Release -p:PackageVersion=$DEV_VERSION
- dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text
- dotnet nuget push "bin/Release/*.nupkg" --source gitlab
when: on_success
only:
refs:
- master@dev/verity/verity-sdk
changes:
- sdk/dotnet-sdk/**/*
- .gitlab-ci.yml
dotnet-release:
stage: publish
tags:
- s3docs
- docker-machine
extends:
- .dotnet-common
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- cd VeritySDK.Doc
- dotnet restore -p:Configuration=Release
- dotnet build -c Release -p:BuildDocToolPath=/usr/bin/docfx
- aws s3 sync ../../doc s3://developer.evernym.com/doc/dotnet/$RELEASE_VERSION # upload dotnet-doc to s3
- cd ../VeritySDK
- dotnet restore -p:Configuration=Release
- dotnet build -c Release
- dotnet pack -c Release -p:PackageVersion=$RELEASE_VERSION
- dotnet nuget push "bin/Release/*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
allow_failure: true
only:
refs:
- tags@dev/verity/verity-sdk
verity-image:
stage: publish-docker
tags:
- docker-machine
- large
variables:
DOCKER_REGISTRY: "https://index.docker.io/v1/"
DOCKER_REPOSITORY: "verity-server-dev"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/verity --dockerfile $CI_PROJECT_DIR/verity/verity.dockerfile --destination evernymdev/$DOCKER_REPOSITORY:$RELEASE_VERSION --destination evernymdev/$DOCKER_REPOSITORY:stable
only:
- tags@dev/verity/verity-sdk
sdk-sample-app-image:
stage: publish-docker
tags:
- docker-machine
- large
variables:
DOCKER_REGISTRY: "https://index.docker.io/v1/"
DOCKER_REPOSITORY: "sdk-sample-app"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- export RELEASE_VERSION=`echo $CI_COMMIT_TAG | cut -c2-` # pull version from tag name
- echo "{\"auths\":{\"$DOCKER_REGISTRY\":{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/samples/sdk/Dockerfile --destination evernymdev/$DOCKER_REPOSITORY:$RELEASE_VERSION --destination evernymdev/$DOCKER_REPOSITORY:stable
only:
- tags@dev/verity/verity-sdk