Skip to content

Show TeamCity build status in Kotlinx Benchmark GitHub PRs #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .teamcity/additionalConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildTypeSettings
import jetbrains.buildServer.configs.kotlin.v2019_2.ParameterDisplay
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.BuildTypeSettings
import jetbrains.buildServer.configs.kotlin.DslContext
import jetbrains.buildServer.configs.kotlin.ParameterDisplay
import jetbrains.buildServer.configs.kotlin.Project
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle

fun Project.additionalConfiguration() {
knownBuilds.buildVersion.params {
param(versionSuffixParameter, "")
}
knownBuilds.buildAll.features {
commitStatusPublisher {
vcsRootExtId = "${DslContext.settingsRoot.id}"
publisher = github {
githubUrl = "https://api.github.com"
authType = storedToken {
tokenId = "tc_token_id:CID_7db3007c46f7e30124f81ef54591b223:-1:4b5743ff-b95e-41b0-89d6-e9a50d3048db"
}
}
}
}
platforms.forEach { platform ->
val gradleBuild = knownBuilds.buildOn(platform).steps.items.single() as GradleBuildStep
gradleBuild.tasks += " " + "fastBenchmark"
Expand Down
4 changes: 2 additions & 2 deletions .teamcity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<artifactId>configs-dsl-kotlin-latest</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<artifactId>configs-dsl-kotlin-plugins-latest</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
Expand Down
16 changes: 6 additions & 10 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.*
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.*
import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.buildSteps.*
import jetbrains.buildServer.configs.kotlin.triggers.*

/*
The settings script is an entry point for defining a TeamCity
Expand All @@ -24,7 +24,7 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
'Debug' option is available in the context menu for the task.
*/

version = "2020.1"
version = "2023.05"

project {
// Disable editing of project and build settings from the UI to avoid issues with TeamCity
Expand Down Expand Up @@ -142,8 +142,6 @@ fun Project.deployVersion() = BuildType {
params {
// enable editing of this configuration to set up things
param("teamcity.ui.settings.readOnly", "false")
param("bintray-user", bintrayUserName)
password("bintray-key", bintrayToken)
param(versionSuffixParameter, "dev-%build.counter%")
param("reverse.dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID.system.libs.repo.description", libraryStagingRepoDescription)
param("env.libs.repository.id", "%dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID.env.libs.repository.id%")
Expand All @@ -158,7 +156,7 @@ fun Project.deployVersion() = BuildType {
gradle {
name = "Verify Gradle Configuration"
tasks = "clean publishPrepareVersion"
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$releaseVersionParameter=%$releaseVersionParameter% -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$releaseVersionParameter=%$releaseVersionParameter%"
buildFile = ""
jdkHome = "%env.$jdk%"
}
Expand Down Expand Up @@ -188,8 +186,6 @@ fun Project.deploy(platform: Platform, configureBuild: BuildType) = buildType("D
params {
param(versionSuffixParameter, "${configureBuild.depParamRefs[versionSuffixParameter]}")
param(releaseVersionParameter, "${configureBuild.depParamRefs[releaseVersionParameter]}")
param("bintray-user", bintrayUserName)
password("bintray-key", bintrayToken)
param("env.libs.repository.id", "%dep.$BUILD_CREATE_STAGING_REPO_ABSOLUTE_ID.env.libs.repository.id%")
}

Expand All @@ -202,7 +198,7 @@ fun Project.deploy(platform: Platform, configureBuild: BuildType) = buildType("D
name = "Deploy ${platform.buildTypeName()} Binaries"
jdkHome = "%env.$jdk%"
jvmArgs = "-Xmx1g"
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$releaseVersionParameter=%$releaseVersionParameter% -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$releaseVersionParameter=%$releaseVersionParameter%"
tasks = "clean publish"
buildFile = ""
gradleWrapperPath = ""
Expand Down
9 changes: 3 additions & 6 deletions .teamcity/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.*

const val versionSuffixParameter = "versionSuffix"
const val teamcitySuffixParameter = "teamcitySuffix"
const val releaseVersionParameter = "releaseVersion"

const val bintrayUserName = "%env.BINTRAY_USER%"
const val bintrayToken = "%env.BINTRAY_API_KEY%"
const val libraryStagingRepoDescription = "kotlinx-benchmark"

val platforms = Platform.values()
const val jdk = "JDK_18"
const val jdk = "JDK_18_x64"

enum class Platform {
Windows, Linux, MacOS;
Expand Down Expand Up @@ -70,7 +68,6 @@ fun Project.buildType(name: String, platform: Platform, configure: BuildType.()
params {
// This parameter is needed for macOS agent to be compatible
if (platform == Platform.MacOS) param("env.JDK_17", "")
if (platform == Platform.MacOS) param("env.JDK_16", "")
}

commonConfigure()
Expand Down Expand Up @@ -120,4 +117,4 @@ fun BuildType.dependsOnSnapshot(build: IdOwner, onFailure: FailureAction = Failu
onDependencyCancel = FailureAction.CANCEL
}
}
}
}