-
Notifications
You must be signed in to change notification settings - Fork 318
/
config.yml
653 lines (605 loc) · 21.5 KB
/
config.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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
version: 2.1
parameters:
mapbox_navigation_native_upstream:
type: boolean
default: false
mapbox_navigation_native_snapshot:
type: string
default: ''
#-------------------------------
#---------- EXECUTORS ----------
#-------------------------------
executors:
ndk-r22-latest-executor:
docker:
- image: mbgl/android-ndk-r22:latest
working_directory: ~/code
environment:
MBX_CI_DOMAIN: o619qyc20d.execute-api.us-east-1.amazonaws.com
FORCE_MAPBOX_NAVIGATION_NATIVE_VERSION: << pipeline.parameters.mapbox_navigation_native_snapshot >>
ALLOW_SNAPSHOT_REPOSITORY: << pipeline.parameters.mapbox_navigation_native_upstream >>
#-------------------------------
#---------- WORKFLOWS ----------
#-------------------------------
workflows:
version: 2
release-workflow:
when:
not: << pipeline.parameters.mapbox_navigation_native_upstream >>
jobs:
- release-snapshot:
filters:
branches:
only:
- main
- release:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- publish-documentation:
requires:
- release
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
default:
jobs:
- prepare-and-assemble
- changelog-verification:
filters:
branches:
ignore: /^(main|release-.*)/
- static-analysis:
requires:
- prepare-and-assemble
- unit-tests-core:
requires:
- prepare-and-assemble
- unit-tests-ui:
requires:
- prepare-and-assemble
- ui-robo-tests:
requires:
- prepare-and-assemble
- internal-instrumentation-tests:
requires:
- prepare-and-assemble
- instrumentation-tests:
requires:
- prepare-and-assemble
- mobile-metrics-dry-run:
type: approval
- mobile-metrics-benchmarks:
requires:
- mobile-metrics-dry-run
#------------------------------
#---------- COMMANDS ----------
#------------------------------
commands:
write-workspace:
steps:
- persist_to_workspace:
root: ~/code
paths:
- ./
read-workspace:
steps:
- attach_workspace:
at: ~/code
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 "libnavui-maps/build.gradle" }}-{{ checksum "libnavui-base/build.gradle" }}-{{ checksum "libnavui-util/build.gradle" }}-{ checksum "libnavui-resources/build.gradle" }}-{ checksum "libnavui-maneuver/build.gradle" }}-{{ checksum "libnavui-tripprogress/build.gradle" }}-{{ checksum "libnavui-voice/build.gradle" }}-{{ checksum "libnavigation-android/build.gradle" }}-{{ checksum "libnavui-speedlimit/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 "libnavui-maps/build.gradle" }}-{{ checksum "libnavui-base/build.gradle" }}-{{ checksum "libnavui-util/build.gradle" }}-{ checksum "libnavui-resources/build.gradle" }}-{ checksum "libnavui-maneuver/build.gradle" }}-{{ checksum "libnavui-tripprogress/build.gradle" }}-{{ checksum "libnavui-voice/build.gradle" }}-{{ checksum "libnavigation-android/build.gradle" }}-{{ checksum "libnavui-speedlimit/build.gradle" }}
verify-codestyle:
steps:
- run:
name: Check codestyle
command: make check-lint
verify-license:
steps:
- run:
name: License verification
command: make license-verification
verify-common-sdk-version:
steps:
- run:
name: Verify Common SDK version
command: make verify-common-sdk-version
verify-changelog:
steps:
- run:
name: Install python dependencies
command: python3 -m pip install requests
- run:
name: Verify that a changelog entry is present in the PR description
command: |
MBX_CI_GITHUB_TOKEN=$(./mbx-ci github reader token)
if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then
python3 scripts/validate-changelog.py ${CIRCLE_PULL_REQUEST##*/} ${MBX_CI_GITHUB_TOKEN}
else
echo "Not a PR, skipping changelog validation."
fi
assemble-module:
parameters:
module_target:
description: module target
type: string
variant:
description: debug or release
type: string
inject_token:
description: whether to inject an access token file
type: boolean
default: false
steps:
- run:
name: Assemble << parameters.module_target >> APK in << parameters.variant >> mode
command: |
if << parameters.inject_token >>; then
echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/<< parameters.module_target >>/src/main/res/values/mapbox_access_token.xml
fi
./gradlew << parameters.module_target >>:assemble<< parameters.variant >>
assemble-instrumentation-test:
parameters:
module_target:
description: module target
type: string
steps:
- run:
name: Assemble Instrumentation Test APK for << parameters.module_target >>
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
assemble-core-debug:
steps:
- run:
name: Assemble Navigation Core SDK (debug)
command: make assemble-core-debug
assemble-ui-debug:
steps:
- run:
name: Assemble Navigation UI SDK(debug)
command: make assemble-ui-debug
assemble-core-release:
steps:
- run:
name: Assemble Navigation Core SDK (release)
command: make assemble-core-release
assemble-ui-release:
steps:
- run:
name: Assemble Navigation UI SDK (release)
command: make assemble-ui-release
check-api-core:
steps:
- run:
name: Check Navigation Core SDK public API
command: make core-check-api
check-api-ui:
steps:
- run:
name: Check Navigation UI SDK public API
command: make ui-check-api
unit-tests-core:
steps:
- run:
name: Run Navigation Core SDK Unit Tests and generate Jacoco test report
command: |
make core-unit-tests-jacoco
- 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 and generate Jacoco test report
command: |
make ui-unit-tests-jacoco
- store-results:
module_target: "libnavui-maps"
- store-results:
module_target: "libnavui-base"
- store-results:
module_target: "libnavui-util"
- store-results:
module_target: "libnavui-maneuver"
- store-results:
module_target: "libnavui-tripprogress"
- store-results:
module_target: "libnavui-voice"
- store-results:
module_target: "libnavui-speedlimit"
codecov:
steps:
- run:
name: Post code coverage reports to Codecov.io
command: pip3 install --user codecov && /root/.local/bin/codecov
generate-version-name:
steps:
- run:
name: Generate Core version name
command: |
if [[ -n "$CIRCLE_TAG" ]]; then
if [[ $CIRCLE_TAG == v* ]]; then
POM_VERSION_NAME=`echo $CIRCLE_TAG | sed s/v//`
else
echo "Exiting the job as this is not a release TAG"
exit 1
fi
echo "export POM_VERSION_NAME=$POM_VERSION_NAME" >> $BASH_ENV
fi
generate-google-services-json:
steps:
- run:
name: Generate google services json for the test app
command: |
echo "${EXAMPLES_GOOGLE_SERVICES_JSON}" > /root/code/examples/google-services.json
download-native-libs:
steps:
- run:
name: Download native libraries for crashlytics
command: ./gradlew downloadUnstrippedNativeLibsDir
upload-native-libs-to-crashlytics:
steps:
- run:
name: Generate crashlytics symbol file felease
command: ./gradlew examples:generateCrashlyticsSymbolFileRelease -d | grep "com.google.firebase.crashlytics"
- run:
name: Upload crashlytics mapping file felease
command: ./gradlew examples:uploadCrashlyticsMappingFileRelease -d | grep "com.google.firebase.crashlytics"
- run:
name: Upload crashlytics symbol file release
command: ./gradlew examples:uploadCrashlyticsSymbolFileRelease -d | grep "com.google.firebase.crashlytics"
run-internal-firebase-instrumentation:
parameters:
module_wrapper:
description: tests wrapper
type: string
module_target:
description: SDK module target
type: string
variant:
description: debug or release
type: string
steps:
- run:
name: Run instrumentation tests on internal SDK classes 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=23,locale=fr,orientation=portrait \
--device model=flame,version=29,locale=de,orientation=landscape \
--device model=redfin,version=30,locale=en,orientation=portrait \
--use-orchestrator \
--timeout 10m
run-firebase-instrumentation:
parameters:
variant:
description: debug or release
type: string
steps:
- run:
name: Run instrumentation tests on public SDK classes on Firebase
no_output_timeout: 1200
shell: /bin/bash -euo pipefail
command: |
gcloud firebase test android run --type instrumentation \
--app instrumentation-tests/build/outputs/apk/<< parameters.variant >>/instrumentation-tests-<< parameters.variant >>.apk \
--test instrumentation-tests/build/outputs/apk/androidTest/<< parameters.variant >>/instrumentation-tests-<< parameters.variant >>-androidTest.apk \
--device model=hammerhead,version=23,locale=fr,orientation=portrait \
--device model=flame,version=29,locale=de,orientation=landscape \
--device model=redfin,version=30,locale=en,orientation=portrait \
--use-orchestrator \
--directories-to-pull=/sdcard/Download/mapbox_test \
--timeout 15m
run-firebase-robo:
parameters:
variant:
description: debug or release
type: string
module_target:
description: module target
type: string
steps:
- run:
name: Run robo tests on Firebase
no_output_timeout: 10m
command: |
gcloud firebase test android run --type robo \
--app << parameters.module_target >>/build/outputs/apk/<< parameters.variant >>/<< parameters.module_target >>-<< parameters.variant >>.apk \
--device model=flo,version=21,locale=es,orientation=portrait \
--device model=hammerhead,version=23,locale=fr,orientation=portrait \
--device model=flame,version=29,locale=de,orientation=landscape \
--device model=redfin,version=30,locale=en,orientation=portrait \
--timeout 5m
publish-artifacts:
parameters:
artifact-type:
description: core or ui
type: string
steps:
- deploy:
name: Upload Navigation SDK to SDK Registry
command: |
make << parameters.artifact-type >>-upload-to-sdk-registry
check-public-documentation:
steps:
- run:
name: Check public documentation
command: ./scripts/dokka-validate.sh
generate-documentation:
steps:
- run:
name: Generate documentation
command: make javadoc-dokka
trigger-mobile-metrics:
steps:
- run:
name: Track metrics of the Navigation SDK
command: |
pip3 install requests
python3 scripts/trigger-mobile-metrics.py
prepare-mbx-ci:
steps:
- run:
name: Install mbx-ci
command: |
curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > mbx-ci && chmod 755 ./mbx-ci
setup-aws-credentials:
steps:
- run:
name: Obtain AWS credentials
command: |
./mbx-ci aws setup
#--------------------------
#---------- JOBS ----------
#--------------------------
jobs:
prepare-and-assemble:
executor: ndk-r22-latest-executor
steps:
- checkout
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- restore-gradle-cache
- assemble-core-debug
- assemble-ui-debug
- assemble-core-release
- assemble-ui-release
- assemble-module:
module_target: "instrumentation-tests"
variant: "Debug"
inject_token: true
- assemble-instrumentation-test:
module_target: "instrumentation-tests"
- assemble-module:
module_target: "app-tests-wrapper"
variant: "Debug"
- assemble-instrumentation-test:
module_target: "libnavigation-core"
- write-workspace
unit-tests-core:
executor: ndk-r22-latest-executor
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- unit-tests-core
- run: exit 0
unit-tests-ui:
executor: ndk-r22-latest-executor
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- unit-tests-ui
- run: exit 0
# Disabling Codecov (for now) due to https://about.codecov.io/security-update/
# - codecov
static-analysis:
executor: ndk-r22-latest-executor
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- verify-codestyle
- verify-license
- verify-common-sdk-version
- check-api-core
- check-api-ui
- check-public-documentation
- run: exit 0
publish-documentation:
executor: ndk-r22-latest-executor
steps:
- checkout
- prepare-mbx-ci
- run:
name: Publish API docs Android
command: |
GITHUB_WRITER_TOKEN=$(./mbx-ci github writer public token)
git remote set-url origin "https://x-access-token:$GITHUB_WRITER_TOKEN@github.com/mapbox/mapbox-navigation-android"
git config --global user.email no-reply@mapbox.com && git config --global user.name mapbox-ci
./scripts/publish_api_docs_android.sh -p $GITHUB_WRITER_TOKEN -t $CIRCLE_TAG
changelog-verification:
executor: ndk-r22-latest-executor
steps:
- checkout
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- prepare-mbx-ci
- verify-changelog
ui-robo-tests:
executor: ndk-r22-latest-executor
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- download-native-libs
- generate-google-services-json
- assemble-module:
module_target: "examples"
variant: "Release"
inject_token: true
- login-google-cloud-platform
- upload-native-libs-to-crashlytics
- run-firebase-robo:
module_target: "examples"
variant: "release"
- run: exit 0
internal-instrumentation-tests:
executor: ndk-r22-latest-executor
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- login-google-cloud-platform
- run-internal-firebase-instrumentation:
module_target: "libnavigation-core"
module_wrapper: "app-tests-wrapper"
variant: "debug"
- run: exit 0
instrumentation-tests:
executor: ndk-r22-latest-executor
environment:
JVM_OPTS: -Xmx3200m
BUILDTYPE: Debug
GRADLE_OPTS: -Xmx4096m -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process
steps:
- when:
condition:
not:
matches:
pattern: "^add-changelog.*"
value: << pipeline.git.branch >>
steps:
- read-workspace
- login-google-cloud-platform
- run-firebase-instrumentation:
variant: "debug"
- run: exit 0
mobile-metrics-benchmarks:
executor: ndk-r22-latest-executor
steps:
- checkout
- trigger-mobile-metrics
release-snapshot:
executor: ndk-r22-latest-executor
steps:
- checkout
- generate-version-name
- assemble-core-release
- assemble-ui-release
- check-public-documentation
- generate-documentation
- prepare-mbx-ci
- setup-aws-credentials
- publish-artifacts:
artifact-type: "core"
- publish-artifacts:
artifact-type: "ui"
- trigger-mobile-metrics
release:
executor: ndk-r22-latest-executor
steps:
- checkout
- generate-version-name
- assemble-core-release
- assemble-ui-release
- check-public-documentation
- generate-documentation
- prepare-mbx-ci
- setup-aws-credentials
- publish-artifacts:
artifact-type: "core"
- publish-artifacts:
artifact-type: "ui"