diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f18ba6..85c0f15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,3 +33,4 @@ jobs: SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3a5c703..550affe 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -57,6 +57,8 @@ jobs: # --no-daemon is required for codeql to observe the compilation # (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) run: ./gradlew assemble --no-build-cache --no-daemon + env: + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: Perform CodeQL analysis uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9 diff --git a/settings.gradle.kts b/settings.gradle.kts index 58d0f1d..ecc398f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,11 +4,50 @@ pluginManagement { id("de.undercouch.download") version "5.6.0" id("io.github.gradle-nexus.publish-plugin") version "2.0.0" id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" + id("com.gradle.develocity") version "3.19.2" } } plugins { id("org.gradle.toolchains.foojay-resolver-convention") + id("com.gradle.develocity") +} + +val develocityServer = "https://develocity.opentelemetry.io" +val isCI = System.getenv("CI") != null +val develocityAccessKey = System.getenv("DEVELOCITY_ACCESS_KEY") ?: "" + +// if develocity access key is not given and we are in CI, then we publish to scans.gradle.com +val useScansGradleCom = isCI && develocityAccessKey.isEmpty() + +develocity { + if (useScansGradleCom) { + buildScan { + termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use" + termsOfUseAgree = "yes" + } + } else { + server = develocityServer + buildScan { + publishing.onlyIf { it.isAuthenticated } + } + } + + buildScan { + uploadInBackground = !isCI + + capture { + fileFingerprints = true + } + } +} + +if (!useScansGradleCom) { + buildCache { + remote(develocity.buildCache) { + isPush = isCI && develocityAccessKey.isNotEmpty() + } + } } rootProject.name = "opentelemetry-proto"