-
Notifications
You must be signed in to change notification settings - Fork 61
/
.gitlab-ci.yml
855 lines (786 loc) · 34.4 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
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
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
include:
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v1/template.yml'
# SETUP
variables:
CURRENT_CI_IMAGE: "14"
CI_IMAGE_DOCKER: registry.ddbuild.io/ci/dd-sdk-android:$CURRENT_CI_IMAGE
GIT_DEPTH: 5
DD_SERVICE: "dd-sdk-android"
DD_ENV_TESTS: "ci"
DD_CIVISIBILITY_ENABLED: "true"
DD_INSIDE_CI: "true"
DD_COMMON_AGENT_CONFIG: "dd.env=ci,dd.trace.enabled=false,dd.jmx.fetch.enabled=false"
KUBERNETES_MEMORY_REQUEST: "8Gi"
KUBERNETES_MEMORY_LIMIT: "13Gi"
EMULATOR_NAME: "android_emulator"
ANDROID_ARCH: "arm64-v8a"
ANDROID_API: "35"
ANDROID_SDK_VERSION: "commandlinetools-mac-11076708_latest"
stages:
- ci-image
- security
- analysis
- test # TODO RUM-1622 cleanup eventually
- test-pyramid
- publish
- notify
.snippets:
# macOS AMI will already have cmdline-tools installed
install-android-api-components:
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "emulator"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_PLATFORM"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_BUILD_TOOLS"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_EMULATOR_IMAGE"
- yes | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --licenses || true
- echo "no" | ~/android_sdk/cmdline-tools/latest/bin/avdmanager --verbose create avd --force --name "$EMULATOR_NAME" --package "$ANDROID_EMULATOR_IMAGE"
run-legacy-integration-instrumented:
- set +e
- exit_code=0
- $ANDROID_HOME/emulator/emulator -avd "$EMULATOR_NAME" -grpc-use-jwt -no-snapstorage -no-audio -no-window -no-boot-anim -verbose -qemu -machine virt &
- GRADLE_OPTS="-Xmx3072m" ./gradlew :instrumented:integration:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- $ANDROID_HOME/platform-tools/adb emu kill
- if [[ "$exit_code" -ne 0 ]]; then exit 1; fi
- exit 0
run-core-it-instrumented:
- set +e
- exit_code=0
- $ANDROID_HOME/emulator/emulator -avd "$EMULATOR_NAME" -grpc-use-jwt -no-snapstorage -no-audio -no-window -no-boot-anim -verbose -qemu -machine virt &
- GRADLE_OPTS="-Xmx3072m" ./gradlew :reliability:core-it:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- $ANDROID_HOME/platform-tools/adb emu kill
- if [[ "$exit_code" -ne 0 ]]; then exit 1; fi
- exit 0
set-publishing-credentials:
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
- export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_username --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_password --with-decryption --query "Parameter.Value" --out text)
# CI IMAGE
ci-image:
stage: ci-image
when: manual
except: [ tags, schedules ]
tags: [ "arch:amd64" ]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
script:
- docker buildx build --tag $CI_IMAGE_DOCKER -f Dockerfile.gitlab --push .
# SECURITY
create_key:
stage: security
when: manual
tags: [ "arch:amd64" ]
variables:
PROJECT_NAME: "dd-sdk-android"
EXPORT_TO_KEYSERVER: "true"
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/agent-key-management-tools/gpg:1
script:
- /create.sh
artifacts:
expire_in: 13 mos
paths:
- pubkeys
# STATIC ANALYSIS
static-analysis:
stage: analysis
variables:
DETEKT_PUBLIC_API: "true"
DETEKT_GENERATE_CLASSPATH_BUILD_TASK: "printSdkDebugRuntimeClasspath"
DETEKT_CLASSPATH_FILE_PATH: "sdk_classpath"
FLAVORED_ANDROID_LINT: ":tools:lint:lint"
trigger:
include: "https://gitlab-templates.ddbuild.io/mobile/v34714656-060be019/static-analysis.yml"
strategy: depend
analysis:detekt-custom:
tags:
- "arch:amd64"
image: $CI_IMAGE_DOCKER
stage: analysis
timeout: 1h
script:
- ./gradlew assembleLibrariesRelease --stacktrace
- ./gradlew unzipAarForDetekt --stacktrace
- ./gradlew :tools:detekt:jar --stacktrace
- ./gradlew printDetektClasspath --stacktrace
- curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.4/detekt-cli-1.23.4-all.jar
- ./gradlew :dd-sdk-android-core:customDetektRules
- ./gradlew :dd-sdk-android-internal:customDetektRules
- ./gradlew :features:dd-sdk-android-logs:customDetektRules
- ./gradlew :features:dd-sdk-android-ndk:customDetektRules
- ./gradlew :features:dd-sdk-android-rum:customDetektRules
- ./gradlew :features:dd-sdk-android-session-replay:customDetektRules
- ./gradlew :features:dd-sdk-android-session-replay-material:customDetektRules
- ./gradlew :features:dd-sdk-android-trace:customDetektRules
- ./gradlew :features:dd-sdk-android-trace-otel:customDetektRules
- ./gradlew :features:dd-sdk-android-webview:customDetektRules
- ./gradlew :integrations:dd-sdk-android-coil:customDetektRules
- ./gradlew :integrations:dd-sdk-android-compose:customDetektRules
- ./gradlew :integrations:dd-sdk-android-fresco:customDetektRules
- ./gradlew :integrations:dd-sdk-android-glide:customDetektRules
- ./gradlew :integrations:dd-sdk-android-okhttp:customDetektRules
- ./gradlew :integrations:dd-sdk-android-okhttp-otel:customDetektRules
- ./gradlew :integrations:dd-sdk-android-rum-coroutines:customDetektRules
- ./gradlew :integrations:dd-sdk-android-rx:customDetektRules
- ./gradlew :integrations:dd-sdk-android-sqldelight:customDetektRules
- ./gradlew :integrations:dd-sdk-android-timber:customDetektRules
- ./gradlew :integrations:dd-sdk-android-trace-coroutines:customDetektRules
- ./gradlew :integrations:dd-sdk-android-tv:customDetektRules
# TODO RUM-1622 cleanup this section
# TESTS
test:debug:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
policy: pull
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:debug" ./gradlew :dd-sdk-android-core:testDebugUnitTest --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:debug" ./gradlew :dd-sdk-android-internal:testDebugUnitTest --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:debug" ./gradlew :unitTestDebugFeatures --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:debug" ./gradlew :unitTestDebugIntegrations --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit: "**/build/test-results/testDebugUnitTest/*.xml"
test:tools:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
policy: pull
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" ./gradlew :unitTestTools --stacktrace --no-daemon --build-cache --gradle-user-home cache/
test:kover:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
script:
- pip3 install datadog
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- export DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.api_key --with-decryption --query "Parameter.Value" --out text)
- export DD_APP_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.app_key --with-decryption --query "Parameter.Value" --out text)
- CODECOV_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.codecov-token --with-decryption --query "Parameter.Value" --out text)
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :dd-sdk-android-core:koverXmlReportRelease --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :dd-sdk-android-internal:koverXmlReportRelease --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :koverReportFeatures --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :koverReportIntegrations --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
- bash <(cat ./codecov.sh) -t $CODECOV_TOKEN
artifacts:
when: always
expire_in: 1 week
reports:
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
# TEST PYRAMID
# the steps in this section should reflect our test pyramid strategy
test-pyramid:core-it-min-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "21"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-core-it-instrumented]
test-pyramid:core-it-latest-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "35"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-core-it-instrumented]
test-pyramid:core-it-median-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "28"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-core-it-instrumented]
test-pyramid:single-fit-logs:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
policy: pull
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:logs:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
test-pyramid:single-fit-rum:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
policy: pull
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:rum:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
test-pyramid:single-fit-trace:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- cache/caches/
- cache/notifications/
policy: pull
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:trace:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
# RUN INSTRUMENTED TESTS ON MIN API (21), LATEST API (34) and MEDIAN API (28)
test-pyramid:legacy-integration-instrumented-min-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "21"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-legacy-integration-instrumented]
test-pyramid:legacy-integration-instrumented-latest-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "35"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-legacy-integration-instrumented]
test-pyramid:legacy-integration-instrumented-median-api:
tags: [ "macos:sonoma", "specific:true" ]
stage: test-pyramid
timeout: 1h
variables:
ANDROID_API: "28"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
script:
- !reference [.snippets, install-android-api-components]
- !reference [.snippets, run-legacy-integration-instrumented]
test-pyramid:detekt-api-coverage:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
script:
- mkdir -p ./config/
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- GRADLE_OPTS="-Xmx4096M" ./gradlew assembleLibrariesDebug --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew printSdkDebugRuntimeClasspath --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew :tools:detekt:jar --stacktrace --no-daemon
- curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.4/detekt-cli-1.23.4-all.jar
- java -jar detekt-cli-1.23.4-all.jar --config detekt_test_pyramid.yml --plugins tools/detekt/build/libs/detekt.jar -ex "**/*.kts" --jvm-target 11 -cp $(cat sdk_classpath)
# For now we just print the uncovered apis, eventually we will fail if it's not empty
- grep -v -f apiUsage.log apiSurface.log
test-pyramid:publish-e2e-synthetics:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
only:
- develop
script:
- mkdir -p ./config/
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore --with-decryption --query "Parameter.Value" --out text | base64 -d > ./sample-android.keystore
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_config_json --with-decryption --query "Parameter.Value" --out text > ./config/us1.json
- export E2E_STORE_PASSWD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore-password --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_api_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_APP_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_app_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_MOBILE_APP_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_mobile_app_id --with-decryption --query "Parameter.Value" --out text)
- GRADLE_OPTS="-Xmx4096M" ./gradlew assembleLibrariesRelease --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew :sample:kotlin:packageUs1Release --stacktrace --no-daemon
- npm update -g @datadog/datadog-ci
- echo "Using datadog-ci $(npx @datadog/datadog-ci version)"
- npx @datadog/datadog-ci synthetics upload-application --appKey "$E2E_DD_APP_KEY" --apiKey "$E2E_DD_API_KEY" --mobileApp "sample/kotlin/build/outputs/apk/us1/release/kotlin-us1-release.apk" --mobileApplicationId "$E2E_MOBILE_APP_ID" --versionName "$CI_COMMIT_SHORT_SHA" --latest
artifacts:
when: always
expire_in: 1 week
paths:
- sample/kotlin/build/outputs/apk/us1/release/kotlin-us1-release.apk
test-pyramid:publish-webview-synthetics:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
only:
- develop
script:
- mkdir -p ./config/
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore --with-decryption --query "Parameter.Value" --out text | base64 -d > ./sample-android.keystore
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.webview_config_json --with-decryption --query "Parameter.Value" --out text > ./config/us1.json
- export E2E_STORE_PASSWD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore-password --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.webview_api_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_APP_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.webview_app_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_MOBILE_APP_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.webview_mobile_app_id --with-decryption --query "Parameter.Value" --out text)
- GRADLE_OPTS="-Xmx4096M" ./gradlew assembleLibrariesRelease --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew :sample:kotlin:packageUs1Release --stacktrace --no-daemon
- npm update -g @datadog/datadog-ci
- echo "Using datadog-ci $(npx @datadog/datadog-ci version)"
- npx @datadog/datadog-ci synthetics upload-application --appKey "$E2E_DD_APP_KEY" --apiKey "$E2E_DD_API_KEY" --mobileApp "sample/kotlin/build/outputs/apk/us1/release/kotlin-us1-release.apk" --mobileApplicationId "$E2E_MOBILE_APP_ID" --versionName "$CI_COMMIT_SHORT_SHA" --latest
artifacts:
when: always
expire_in: 1 week
paths:
- sample/kotlin/build/outputs/apk/us1/release/kotlin-us1-release.apk
test-pyramid:publish-staging-synthetics:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
only:
- develop
script:
- mkdir -p ./config/
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore --with-decryption --query "Parameter.Value" --out text | base64 -d > ./sample-android.keystore
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_staging_config_json --with-decryption --query "Parameter.Value" --out text > ./config/staging.json
- export E2E_STORE_PASSWD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore-password --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_staging_api_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_DD_APP_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_staging_app_key --with-decryption --query "Parameter.Value" --out text)
- export E2E_MOBILE_APP_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.e2e_staging_mobile_app_id --with-decryption --query "Parameter.Value" --out text)
- GRADLE_OPTS="-Xmx4096M" ./gradlew assembleLibrariesRelease --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew :sample:kotlin:packageStagingRelease --stacktrace --no-daemon
- npm update -g @datadog/datadog-ci
- echo "Using datadog-ci $(npx @datadog/datadog-ci version)"
- npx @datadog/datadog-ci synthetics upload-application --appKey "$E2E_DD_APP_KEY" --apiKey "$E2E_DD_API_KEY" --mobileApp "sample/kotlin/build/outputs/apk/staging/release/kotlin-staging-release.apk" --mobileApplicationId "$E2E_MOBILE_APP_ID" --versionName "$CI_COMMIT_SHORT_SHA" --latest --datadogSite "datad0g.com"
artifacts:
when: always
expire_in: 1 week
paths:
- sample/kotlin/build/outputs/apk/staging/release/kotlin-staging-release.apk
test-pyramid:publish-benchmark-synthetics:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: test-pyramid
timeout: 1h
only:
- develop
script:
- mkdir -p ./config/
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore --with-decryption --query "Parameter.Value" --out text | base64 -d > ./sample-benchmark.keystore
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.benchmark_config_json --with-decryption --query "Parameter.Value" --out text > ./config/benchmark.json
- export BM_STORE_PASSWD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.keystore-password --with-decryption --query "Parameter.Value" --out text)
- export BM_DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.benchmark_api_key --with-decryption --query "Parameter.Value" --out text)
- export BM_DD_APP_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.benchmark_app_key --with-decryption --query "Parameter.Value" --out text)
- export BM_MOBILE_APP_ID=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.benchmark_mobile_app_id --with-decryption --query "Parameter.Value" --out text)
- GRADLE_OPTS="-Xmx4096M" ./gradlew assembleLibrariesRelease --stacktrace --no-daemon
- GRADLE_OPTS="-Xmx4096M" ./gradlew :sample:benchmark:packageRelease --stacktrace --no-daemon
- npm update -g @datadog/datadog-ci
- echo "Using datadog-ci $(npx @datadog/datadog-ci version)"
- npx @datadog/datadog-ci synthetics upload-application --appKey "$BM_DD_APP_KEY" --apiKey "$BM_DD_API_KEY" --mobileApp "sample/benchmark/build/outputs/apk/release/benchmark-release.apk" --mobileApplicationId "$BM_MOBILE_APP_ID" --versionName "$CI_COMMIT_SHORT_SHA" --latest
artifacts:
when: always
expire_in: 1 week
paths:
- sample/benchmark/build/outputs/apk/release/benchmark-release.apk
# PUBLISH ARTIFACTS ON MAVEN
publish:release-core:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :dd-sdk-android-core:publishToSonatype --stacktrace --no-daemon
publish:release-internal:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [ .snippets, set-publishing-credentials ]
- ./gradlew :dd-sdk-android-internal:publishToSonatype --stacktrace --no-daemon
publish:release-coil:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-coil:publishToSonatype --stacktrace --no-daemon
publish:release-compose:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-compose:publishToSonatype --stacktrace --no-daemon
publish:release-fresco:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-fresco:publishToSonatype --stacktrace --no-daemon
publish:release-glide:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-glide:publishToSonatype --stacktrace --no-daemon
publish:release-trace-coroutines:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-trace-coroutines:publishToSonatype --stacktrace --no-daemon
publish:release-rum-coroutines:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-rum-coroutines:publishToSonatype --stacktrace --no-daemon
publish:release-ndk:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-ndk:publishToSonatype --stacktrace --no-daemon
publish:release-rx:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-rx:publishToSonatype --stacktrace --no-daemon
publish:release-sqldelight:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-sqldelight:publishToSonatype --stacktrace --no-daemon
publish:release-timber:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-timber:publishToSonatype --stacktrace --no-daemon
publish:release-android-tv:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-tv:publishToSonatype --stacktrace --no-daemon
publish:release-session-replay:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-session-replay:publishToSonatype --stacktrace --no-daemon
publish:release-session-replay-material:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-session-replay-material:publishToSonatype --stacktrace --no-daemon
publish:release-session-replay-compose:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-session-replay-compose:publishToSonatype --stacktrace --no-daemon
publish:release-logs:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-logs:publishToSonatype --stacktrace --no-daemon
publish:release-okhttp:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-okhttp:publishToSonatype --stacktrace --no-daemon
publish:release-okhttp-otel:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:dd-sdk-android-okhttp-otel:publishToSonatype --stacktrace --no-daemon
publish:release-trace:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-trace:publishToSonatype --stacktrace --no-daemon
publish:release-trace-otel:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-trace-otel:publishToSonatype --stacktrace --no-daemon
publish:release-webview:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-webview:publishToSonatype --stacktrace --no-daemon
publish:release-rum:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:dd-sdk-android-rum:publishToSonatype --stacktrace --no-daemon
publish:release-benchmark:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :tools:benchmark:publishToSonatype --stacktrace --no-daemon
# SLACK NOTIFICATIONS
notify:publish-develop-success:
extends: .slack-notifier-base
stage: notify
when: on_success
only:
- develop
script:
- 'MESSAGE_TEXT=":package: $CI_PROJECT_NAME develop $CI_COMMIT_TAG: Snapshot published on :maven:, Sample app published on :synthetics:"'
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"
notify:publish-develop-failure:
extends: .slack-notifier-base
stage: notify
when: on_failure
only:
- develop
script:
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
- 'MESSAGE_TEXT=":status_alert: $CI_PROJECT_NAME $CI_COMMIT_TAG develop pipeline <$BUILD_URL|$COMMIT_MESSAGE> failed."'
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"
notify:publish-release-success:
extends: .slack-notifier-base
stage: notify
when: on_success
only:
- tags
script:
- MAVEN_URL="https://search.maven.org/artifact/com.datadoghq/dd-sdk-android-core/$CI_COMMIT_TAG/aar"
- 'MESSAGE_TEXT=":rocket: $CI_PROJECT_NAME $CI_COMMIT_TAG published on :maven: $MAVEN_URL"'
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"
notify:publish-release-failure:
extends: .slack-notifier-base
stage: notify
when: on_failure
only:
- tags
script:
- BUILD_URL="$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID"
- 'MESSAGE_TEXT=":status_alert: $CI_PROJECT_NAME $CI_COMMIT_TAG publish pipeline <$BUILD_URL|$COMMIT_MESSAGE> failed."'
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"
notify:dogfood-app:
tags: [ "arch:amd64" ]
only:
- tags
image: $CI_IMAGE_DOCKER
stage: notify
when: on_success
script:
- pip3 install GitPython requests
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_token --with-decryption --query "Parameter.Value" --out text >> ./gh_token
- python3 dogfood.py -v $CI_COMMIT_TAG -t app
notify:dogfood-demo:
tags: [ "arch:amd64" ]
only:
- tags
image: $CI_IMAGE_DOCKER
stage: notify
when: on_success
script:
- pip3 install GitPython requests
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_token --with-decryption --query "Parameter.Value" --out text >> ./gh_token
- python3 dogfood.py -v $CI_COMMIT_TAG -t demo
notify:dogfood-gradle-plugin:
tags: [ "arch:amd64" ]
only:
- tags
image: $CI_IMAGE_DOCKER
stage: notify
when: on_success
script:
- pip3 install GitPython requests
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gh_token --with-decryption --query "Parameter.Value" --out text >> ./gh_token
- python3 dogfood.py -v $CI_COMMIT_TAG -t gradle-plugin