forked from DataDog/dd-sdk-kotlin-multiplatform
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
298 lines (266 loc) · 9.89 KB
/
.gitlab-ci.yml
File metadata and controls
298 lines (266 loc) · 9.89 KB
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
# SETUP
variables:
CURRENT_CI_IMAGE: "6"
CI_IMAGE_DOCKER: registry.ddbuild.io/ci/dd-sdk-kotlin-multiplatform:$CURRENT_CI_IMAGE
SLACK_NOTIFIER_IMAGE: registry.ddbuild.io/slack-notifier:latest
GIT_DEPTH: 6
KUBERNETES_MEMORY_REQUEST: "8Gi"
KUBERNETES_MEMORY_LIMIT: "13Gi"
DD_SERVICE: "dd-sdk-kotlin-multiplatform"
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"
DD_JAVA_AGENT_FILE: "dd-java-agent-1.50.0.jar"
stages:
- ci-image
- info
- analysis
- test
- publish
- notify
.snippets:
set-publishing-credentials:
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-kotlin-multiplatform.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-kotlin-multiplatform.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
- export CENTRAL_PUBLISHER_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-kotlin-multiplatform.publishing.central_username --with-decryption --query "Parameter.Value" --out text)
- export CENTRAL_PUBLISHER_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-kotlin-multiplatform.publishing.central_password --with-decryption --query "Parameter.Value" --out text)
# Security
# TODO RUM-5306 Signing keys were generated using the image
# 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/agent-key-management-tools/gpg:1.
# But this image is not compatible with k8s runner, so we need to regenerate keys using compatible
# approach by the time existing keys expire (Aug 2025).
# 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-jammy
script:
- docker buildx build --tag $CI_IMAGE_DOCKER --label target=build -f Dockerfile.gitlab --push .
env-info:
stage: info
when: manual
tags: [ "macos:sonoma-arm64, specific:true" ]
allow_failure: true # do not block GH PRs
script:
- system_profiler SPSoftwareDataType # system info
- xcodebuild -version
- xcode-select -p # default Xcode
- ls /Applications/ | grep Xcode # other Xcodes
- xcodebuild -project sample/appleApp/appleApp.xcodeproj -scheme "Sample iOS" -showdestinations -quiet # installed iOS destinations
- xcodebuild -project sample/appleApp/appleApp.xcodeproj -scheme "Sample tvOS" -showdestinations -quiet # installed tvOS destinations
- xcbeautify --version
- swiftlint --version
- carthage version
- gh --version
- brew -v
- bundler --version
- python3 -V
- java --version
# Analysis
static-analysis-ios:
stage: analysis
tags: [ "macos:sonoma-arm64, specific:true" ]
timeout: 1h
script:
# - ./tools/lint/run-linter.sh
- ./tools/license/check-license.sh
static-analysis-android:
stage: analysis
variables:
DETEKT_PUBLIC_API: "false"
DETEKT_CUSTOM_RULES_BUILD_TASK: ""
DETEKT_CUSTOM_RULES_JAR_PATH: ""
DETEKT_CUSTOM_RULES_YML_PATH: ""
DETEKT_GENERATE_CLASSPATH_BUILD_TASK: "printSdkDebugRuntimeClasspath"
DETEKT_CLASSPATH_FILE_PATH: ""
FLAVORED_ANDROID_LINT: ""
trigger:
include: "https://gitlab-templates.ddbuild.io/mobile/v34714656-060be019/static-analysis.yml"
strategy: depend
analysis:licenses:
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
stage: analysis
timeout: 30m
script:
- ./gradlew checkDependencyLicenses --stacktrace --no-daemon
# Test
jvm-unit-test:
stage: test
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
timeout: 1h
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
- ./gradlew jvmUnitTestAll --no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit:
- "**/build/test-results/testDebugUnitTest/*.xml"
- "**/build/test-results/testReleaseUnitTest/*.xml"
ios-unit-test:
stage: test
tags: [ "macos:sonoma-arm64, specific:true" ]
timeout: 1h
script:
- pod repo update
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
- ./gradlew iosUnitTestAll --no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit:
- "**/build/test-results/iosSimulatorArm64Test/*.xml"
tvos-unit-test:
stage: test
tags: [ "macos:sonoma-arm64, specific:true" ]
timeout: 1h
script:
- pod repo update
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
- ./gradlew tvosUnitTestAll --no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
artifacts:
when: always
expire_in: 1 week
reports:
junit:
- "**/build/test-results/tvosSimulatorArm64Test/*.xml"
sample-app-build-ios:
stage: test
tags: [ "macos:sonoma-arm64, specific:true" ]
timeout: 1h
variables:
BUILD_DESTINATION: "platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.5"
script:
- pod repo update
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
# by some reason without this line xcodebuild below fails
- ./gradlew :core:podBuildDatadogCoreIosSimulator
:core:podBuildDatadogCrashReportingIosSimulator
:features:rum:podBuildDatadogRUMIosSimulator
:features:logs:podBuildDatadogLogsIosSimulator
:features:session-replay:podBuildDatadogSessionReplayIosSimulator
--no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
- xcodebuild -project sample/appleApp/appleApp.xcodeproj -destination "$BUILD_DESTINATION" -scheme "Sample iOS" build | xcbeautify --preserve-unbeautified
sample-app-build-tvos:
stage: test
tags: [ "macos:sonoma-arm64, specific:true" ]
timeout: 1h
variables:
BUILD_DESTINATION: "platform=tvOS Simulator,name=Apple TV,OS=17.5"
script:
- pod repo update
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
# temporary workaround for RUM-4282
# by some reason without this line xcodebuild below fails
- ./gradlew :core:podBuildDatadogCoreTvosSimulator
:core:podBuildDatadogCrashReportingTvosSimulator
:features:rum:podBuildDatadogRUMTvosSimulator
:features:logs:podBuildDatadogLogsTvosSimulator
--no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
- xcodebuild -project sample/appleApp/appleApp.xcodeproj -destination "$BUILD_DESTINATION" -scheme "Sample tvOS" build | xcbeautify --preserve-unbeautified
sample-app-build-android:
stage: test
tags: [ "arch:amd64" ]
image: $CI_IMAGE_DOCKER
timeout: 1h
script:
- rm -rf ~/.gradle/daemon/
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
- export DD_AGENT_PATH="$(pwd)/$DD_JAVA_AGENT_FILE"
- ./gradlew :sample:androidApp:assembleDebug --no-daemon -Dorg.gradle.jvmargs=-javaagent:$DD_AGENT_PATH=$DD_COMMON_AGENT_CONFIG
# PUBLISH ARTIFACTS ON MAVEN
publish:release-core:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :core:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-logs:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:logs:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-rum:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:rum:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-webview:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:webview:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-session-replay:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :features:session-replay:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-ktor:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:ktor:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
publish:release-ktor3:
tags: [ "macos:sonoma-arm64, specific:true" ]
only:
- tags
stage: publish
timeout: 30m
script:
- !reference [.snippets, set-publishing-credentials]
- ./gradlew :integrations:ktor3:publishToSonatype closeSonatypeStagingRepository --stacktrace --no-daemon
# SLACK NOTIFICATIONS
notify:publish-release-success:
image: $SLACK_NOTIFIER_IMAGE
tags: [ "arch:amd64" ]
stage: notify
when: on_success
only:
- tags
script:
- MAVEN_URL="https://search.maven.org/artifact/com.datadoghq/dd-sdk-kotlin-multiplatform-core/$CI_COMMIT_TAG/jar"
- 'MESSAGE_TEXT=":rocket: $CI_PROJECT_NAME $CI_COMMIT_TAG published on :maven: $MAVEN_URL"'
- postmessage "#mobile-sdk-ops" "$MESSAGE_TEXT"
notify:publish-release-failure:
image: $SLACK_NOTIFIER_IMAGE
tags: [ "arch:amd64" ]
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"