Skip to content

Commit 6fb8783

Browse files
authored
Enable Develocity build scans (#145)
1 parent b3d2d27 commit 6fb8783

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ jobs:
3636
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
3737
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3838
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
39+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
# --no-daemon is required for codeql to observe the compilation
5858
# (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands)
5959
run: ./gradlew assemble --no-build-cache --no-daemon
60+
env:
61+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
6062

6163
- name: Perform CodeQL analysis
6264
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9

settings.gradle.kts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,50 @@ pluginManagement {
44
id("de.undercouch.download") version "5.6.0"
55
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
66
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
7+
id("com.gradle.develocity") version "3.19.2"
78
}
89
}
910

1011
plugins {
1112
id("org.gradle.toolchains.foojay-resolver-convention")
13+
id("com.gradle.develocity")
14+
}
15+
16+
val develocityServer = "https://develocity.opentelemetry.io"
17+
val isCI = System.getenv("CI") != null
18+
val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: ""
19+
20+
// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com
21+
val useScansGradleCom = isCI && develocityAccessKey.isEmpty()
22+
23+
develocity {
24+
if (useScansGradleCom) {
25+
buildScan {
26+
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
27+
termsOfUseAgree = "yes"
28+
}
29+
} else {
30+
server = develocityServer
31+
buildScan {
32+
publishing.onlyIf { it.isAuthenticated }
33+
}
34+
}
35+
36+
buildScan {
37+
uploadInBackground = !isCI
38+
39+
capture {
40+
fileFingerprints = true
41+
}
42+
}
43+
}
44+
45+
if (!useScansGradleCom) {
46+
buildCache {
47+
remote(develocity.buildCache) {
48+
isPush = isCI && develocityAccessKey.isNotEmpty()
49+
}
50+
}
1251
}
1352

1453
rootProject.name = "opentelemetry-proto"

0 commit comments

Comments
 (0)