/
circle.yml
417 lines (387 loc) · 13.8 KB
/
circle.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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
version: 2.1
parameters:
docker-image-tag:
type: string
default: "mbgl/android-ndk-r21:769c31f1d8"
workflows:
version: 2
default:
jobs:
- build
- release-core-snapshot:
filters:
branches:
only:
- master
- release-ui-snapshot:
filters:
branches:
only:
- master
- release-core:
filters:
tags:
only: /^release_core_.*/
branches:
ignore: /.*/
- release-ui:
filters:
tags:
only: /^release_ui_.*_core_.*/
branches:
ignore: /.*/
- ui-tests
commands:
restore-gradle-cache:
steps:
- restore_cache:
keys:
- deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "examples/build.gradle" }}-{{ checksum "libnavigation-router/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libtesting-ui/build.gradle" }}-{{ checksum "libtesting-utils/build.gradle" }}-{{ checksum "libnavigation-ui/build.gradle" }}
- deps-
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: deps-{{ checksum "build.gradle" }}-{{ checksum "gradle/dependencies.gradle" }}-{{ checksum "examples/build.gradle" }}-{{ checksum "libnavigation-router/build.gradle" }}-{{ checksum "libnavigation-base/build.gradle" }}-{{ checksum "libnavigation-core/build.gradle" }}-{{ checksum "libnavigation-metrics/build.gradle" }}-{{ checksum "libnavigation-util/build.gradle" }}-{{ checksum "libnavigator/build.gradle" }}-{{ checksum "libtrip-notification/build.gradle" }}-{{ checksum "libtesting-ui/build.gradle" }}-{{ checksum "libtesting-utils/build.gradle" }}-{{ checksum "libnavigation-ui/build.gradle" }}
verify:
steps:
- run:
name: Check codebase
command: make check
build-module:
parameters:
module_target:
description: module target
type: string
variant:
description: debug or release
type: string
steps:
- run:
name: Build << parameters.module_target >> APK in << parameters.variant >> mode
command: |
./gradlew << parameters.module_target >>:assemble<< parameters.variant >>
build-example-app:
parameters:
variant:
description: debug or release
type: string
steps:
- run:
name: Build examples APK in << parameters.variant >> mode
command: |
echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/examples/src/main/res/values/mapbox_access_token.xml
./gradlew examples:assemble<< parameters.variant >>
build-instrumentation-test:
parameters:
module_target:
description: module target
type: string
steps:
- run:
name: Build Instrumentation Test APK
command: |
./gradlew << parameters.module_target >>:assembleAndroidTest
login-google-cloud-platform:
steps:
- run:
name: Log in to Google Cloud Platform
shell: /bin/bash -euo pipefail
command: |
echo "${GCLOUD_SERVICE_ACCOUNT_JSON}" > secret.json
gcloud auth activate-service-account --key-file secret.json --project mapbox-navigation-android
rm secret.json
store-results:
parameters:
module_target:
description: module target
type: string
steps:
- store_artifacts:
path: << parameters.module_target >>/build/reports
destination: << parameters.module_target >>/reports
- store_test_results:
path: << parameters.module_target >>/build/test-results
build-core-debug:
steps:
- run:
name: Build Navigation Core SDK (debug)
command: make build-core-debug
build-ui-debug:
steps:
- run:
name: Build Navigation UI SDK(debug)
command: make build-ui-debug
build-release-core:
steps:
- run:
name: Build Navigation Core SDK (release)
command: make build-core-release
build-release-ui:
steps:
- run:
name: Build Navigation UI SDK (release)
command: make build-ui-release
check-api-core:
steps:
- run:
name: Check Navigation Core SDK public API
command: |
make build-core-release
make core-check-api
check-api-ui:
steps:
- run:
name: Check Navigation UI SDK public API
command: |
make build-ui-release
make ui-check-api
unit-tests-core:
steps:
- run:
name: Run Navigation Core SDK Unit Tests
command: make core-unit-tests
- store-results:
module_target: "libnavigation-router"
- store-results:
module_target: "libnavigation-base"
- store-results:
module_target: "libnavigation-core"
- store-results:
module_target: "libnavigation-metrics"
- store-results:
module_target: "libnavigation-util"
- store-results:
module_target: "libnavigator"
- store-results:
module_target: "libtrip-notification"
unit-tests-ui:
steps:
- run:
name: Run Navigation UI SDK Unit Tests
command: make ui-unit-tests
- store-results:
module_target: "libnavigation-ui"
generate-core-version-name:
steps:
- run:
name: Generate Core version name
command: |
if [[ -n "$CIRCLE_TAG" ]]; then
if [[ $CIRCLE_TAG == release_core_* ]]; then
POM_CORE_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 3`
elif [[ $CIRCLE_TAG == qa_release_core_*
|| $CIRCLE_TAG == prod_release_core_* ]]; then
POM_CORE_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 4`
else
echo "Exiting the job as this is not a release TAG"
exit 1
fi
echo "export POM_CORE_VERSION_NAME=$POM_CORE_VERSION_NAME" >> $BASH_ENV
fi
generate-ui-version-name:
steps:
- run:
name: Generate UI version name
command: |
if [[ -n "$CIRCLE_TAG" ]]; then
if [[ $CIRCLE_TAG == release_ui_*_core_* ]]; then
POM_UI_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 3`
POM_CORE_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 5`
elif [[ $CIRCLE_TAG == qa_release_ui_*_core_*
|| $CIRCLE_TAG == prod_release_ui_*_core_* ]]; then
POM_UI_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 4`
POM_CORE_VERSION_NAME=`echo $CIRCLE_TAG | cut -d '_' -f 6`
else
echo "Exiting the job as this is not a release TAG"
exit 1
fi
echo "export POM_UI_VERSION_NAME=$POM_UI_VERSION_NAME" >> $BASH_ENV
echo "export POM_CORE_VERSION_NAME=$POM_CORE_VERSION_NAME" >> $BASH_ENV
fi
run-firebase-instrumentation:
parameters:
module_wrapper:
description: module wrapper
type: string
module_target:
description: module target
type: string
variant:
description: debug or release
type: string
steps:
- run:
name: Run instrumentation tests on Firebase
no_output_timeout: 1200
shell: /bin/bash -euo pipefail
command: |
gcloud firebase test android run --type instrumentation \
--app << parameters.module_wrapper >>/build/outputs/apk/<< parameters.variant >>/<< parameters.module_wrapper >>-<< parameters.variant >>.apk \
--test << parameters.module_target >>/build/outputs/apk/androidTest/<< parameters.variant >>/<< parameters.module_target >>-<< parameters.variant >>-androidTest.apk \
--device model=hammerhead,version=21,locale=en,orientation=portrait \
--device model=athene,version=23,locale=fr,orientation=landscape \
--device model=sailfish,version=26,locale=es,orientation=portrait \
--device model=walleye,version=28,locale=de,orientation=landscape \
--use-orchestrator \
--timeout 5m
run-firebase-robo:
parameters:
variant:
description: debug or release
type: string
steps:
- run:
name: Run robo tests on Firebase
no_output_timeout: 10m
command: |
gcloud firebase test android run --type robo \
--app examples/build/outputs/apk/<< parameters.variant >>/examples-<< parameters.variant >>.apk \
--device model=hammerhead,version=21,locale=en,orientation=portrait \
--device model=athene,version=23,locale=fr,orientation=landscape \
--device model=sailfish,version=26,locale=es,orientation=portrait \
--device model=walleye,version=28,locale=de,orientation=landscape \
--timeout 5m
publish-artifacts:
parameters:
artifact-type:
description: core or ui
type: string
steps:
- deploy:
name: Publish Navigation SDK to SDK Registry
command: |
make << parameters.artifact-type >>-publish-to-sdk-registry
check-public-documentation:
steps:
- run:
name: Check public documentation
command: sh scripts/dokka-validate.sh
generate-documentation:
steps:
- run:
name: Generate documentation
command: make javadoc-dokka
track-performance:
steps:
- run:
name: Track performance of the Navigation SDK
command: |
if [ -n "${MOBILE_METRICS_TOKEN}" ]; then
if [[ $CIRCLE_BRANCH == master ]]; then
curl -u ${MOBILE_METRICS_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=android-navigation-benchmark \
-d build_parameters[BENCHMARK_COMMIT]= ${CIRCLE_SHA1} \
https://circleci.com/api/v1.1/project/github/mapbox/mobile-metrics/tree/master
fi
fi
- run:
name: Trigger android binary size check
command: |
if [ -n "${MOBILE_METRICS_TOKEN}" ]; then
if [[ $CIRCLE_BRANCH == master ]]; then
curl -u ${MOBILE_METRICS_TOKEN}: -d build_parameters[CIRCLE_JOB]=android-navigation-binary-size https://circleci.com/api/v1.1/project/github/mapbox/mobile-metrics/tree/master
fi
fi
- run:
name: Trigger code coverage check
command: |
if [ -n "${MOBILE_METRICS_TOKEN}" ]; then
if [[ $CIRCLE_BRANCH == master ]]; then
curl -u ${MOBILE_METRICS_TOKEN}: -d build_parameters[CIRCLE_JOB]=android-navigation-code-coverage https://circleci.com/api/v1.1/project/github/mapbox/mobile-metrics/tree/master
fi
fi
jobs:
build:
working_directory: ~/code
docker:
- image: << pipeline.parameters.docker-image-tag >>
steps:
- checkout
- restore-gradle-cache
- verify
- check-public-documentation
- check-api-core
- check-api-ui
- build-core-debug
- build-ui-debug
- unit-tests-core
- unit-tests-ui
ui-tests:
docker:
- image: << pipeline.parameters.docker-image-tag >>
working_directory: ~/code
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process
steps:
- checkout
- restore-gradle-cache
- build-module:
module_target: "app-tests-wrapper"
variant: "Debug"
- build-module:
module_target: "libnavigation-core"
variant: "Debug"
- build-instrumentation-test:
module_target: "libnavigation-core"
- login-google-cloud-platform
- run-firebase-instrumentation:
module_target: "libnavigation-core"
module_wrapper: "app-tests-wrapper"
variant: "debug"
- build-example-app:
variant: "Release"
- run-firebase-robo:
variant: "release"
release-core-snapshot:
working_directory: ~/code
docker:
- image: << pipeline.parameters.docker-image-tag >>
steps:
- checkout
- generate-core-version-name
- check-public-documentation
- generate-documentation
- publish-artifacts:
artifact-type: "core"
- track-performance
release-core:
working_directory: ~/code
docker:
- image: << pipeline.parameters.docker-image-tag >>
steps:
- generate-core-version-name
- checkout
- build-release-core
- check-public-documentation
- generate-documentation
- publish-artifacts:
artifact-type: "core"
release-ui-snapshot:
working_directory: ~/code
docker:
- image: << pipeline.parameters.docker-image-tag >>
steps:
- generate-ui-version-name
- checkout
- check-public-documentation
- generate-documentation
- publish-artifacts:
artifact-type: "ui"
- track-performance
release-ui:
working_directory: ~/code
docker:
- image: << pipeline.parameters.docker-image-tag >>
steps:
- generate-ui-version-name
- checkout
- build-release-ui
- check-public-documentation
- generate-documentation
- publish-artifacts:
artifact-type: "ui"