build: Publish Gradle buildscans when CI variable is non-empty (#316)

This should allow for periodic tracking of improvements (or regressions)
in the build performance.

Fixes #314
This commit is contained in:
Nik Clayton 2023-12-12 15:17:47 +01:00 committed by GitHub
parent 07e1d4c760
commit 239f5cb274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,22 @@ dependencyResolutionManagement {
}
}
plugins {
id("com.gradle.enterprise") version "3.16"
}
val isCiBuild = !System.getenv("CI").isNullOrBlank()
gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
isUploadInBackground = !isCiBuild
tag(if (isCiBuild) "CI" else "Local")
publishAlwaysIf(isCiBuild)
}
}
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")