Skip to content

Commit dd47961

Browse files
author
Abduqodiri Qurbonzoda
committed
Upgrade infra to 0.1.0-dev-53
1 parent 407948b commit dd47961

File tree

6 files changed

+211
-122
lines changed

6 files changed

+211
-122
lines changed

.teamcity/additionalConfiguration.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2016-2020 JetBrains s.r.o.
3+
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
4+
*/
5+
6+
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
7+
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
8+
9+
fun Project.additionalConfiguration() {
10+
platforms.forEach { platform ->
11+
val gradleBuild = knownBuilds.buildOn(platform).steps.items.single() as GradleBuildStep
12+
gradleBuild.tasks += " " + fastBenchmarkTasks(platform)
13+
}
14+
}
15+
16+
fun fastBenchmarkTasks(platform: Platform): String {
17+
return listOf(
18+
"js", "jvm", platform.nativeTaskPrefix()
19+
).joinToString(separator = " ", transform = { "${it}FastBenchmark" })
20+
}

.teamcity/settings.kts

Lines changed: 69 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import jetbrains.buildServer.configs.kotlin.v2018_2.*
2-
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.*
3-
import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.*
1+
import jetbrains.buildServer.configs.kotlin.v2019_2.*
2+
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.*
3+
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.*
44

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

27-
version = "2018.2"
28-
val versionSuffixParameter = "versionSuffix"
29-
val teamcitySuffixParameter = "teamcitySuffix"
30-
val releaseVersionParameter = "releaseVersion"
31-
32-
val bintrayUserName = "orangy"
33-
val bintrayToken = "credentialsJSON:9a48193c-d16d-46c7-8751-2fb434b09e07"
34-
35-
val platforms = listOf("Windows", "Linux", "Mac OS X")
36-
val jdk = "JDK_18_x64"
27+
version = "2020.1"
3728

3829
project {
3930
// Disable editing of project and build settings from the UI to avoid issues with TeamCity
4031
params {
4132
param("teamcity.ui.settings.readOnly", "true")
4233
}
4334

44-
val buildAll = buildAll()
45-
val builds = platforms.map { build(it) }
35+
val buildVersion = buildVersion()
36+
val buildAll = buildAll(buildVersion)
37+
val builds = platforms.map { build(it, buildVersion) }
4638
builds.forEach { build ->
47-
buildAll.dependsOn(build) {
48-
snapshot {
49-
onDependencyFailure = FailureAction.ADD_PROBLEM
50-
onDependencyCancel = FailureAction.CANCEL
51-
}
52-
}
39+
buildAll.dependsOnSnapshot(build, onFailure = FailureAction.ADD_PROBLEM)
5340
buildAll.dependsOn(build) {
5441
artifacts {
5542
artifactRules = "+:maven=>maven\n+:api=>api"
5643
}
5744
}
5845
}
5946

60-
val deployConfigure = deployConfigure()
61-
val deploys = platforms.map { deploy(it, deployConfigure) }
62-
val deployPublish = deployPublish(deployConfigure).apply {
47+
val deployVersion = deployVersion().apply {
48+
dependsOnSnapshot(buildAll, onFailure = FailureAction.IGNORE)
49+
}
50+
val deploys = platforms.map { deploy(it, deployVersion) }
51+
val deployPublish = deployPublish(deployVersion).apply {
52+
dependsOnSnapshot(buildAll, onFailure = FailureAction.IGNORE)
6353
deploys.forEach {
6454
dependsOnSnapshot(it)
6555
}
6656
}
6757

68-
buildTypesOrder = listOf(buildAll) + builds + deployPublish + deployConfigure + deploys
58+
buildTypesOrder = listOf(buildAll, buildVersion, *builds.toTypedArray(), deployPublish, deployVersion, *deploys.toTypedArray())
59+
60+
additionalConfiguration()
6961
}
7062

71-
fun Project.buildAll() = BuildType {
72-
id("Build_All")
63+
fun Project.buildVersion() = BuildType {
64+
id(BUILD_CONFIGURE_VERSION_ID)
65+
this.name = "Build (Configure Version)"
66+
commonConfigure()
67+
68+
params {
69+
param(versionSuffixParameter, "SNAPSHOT")
70+
param(teamcitySuffixParameter, "%build.counter%")
71+
}
72+
73+
steps {
74+
gradle {
75+
name = "Generate build chain version"
76+
jdkHome = "%env.$jdk%"
77+
tasks = ""
78+
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$teamcitySuffixParameter=%$teamcitySuffixParameter%"
79+
buildFile = ""
80+
gradleWrapperPath = ""
81+
}
82+
}
83+
}.also { buildType(it) }
84+
85+
fun Project.buildAll(versionBuild: BuildType) = BuildType {
86+
id(BUILD_ALL_ID)
7387
this.name = "Build (All)"
7488
type = BuildTypeSettings.Type.COMPOSITE
75-
89+
90+
dependsOnSnapshot(versionBuild)
91+
buildNumberPattern = versionBuild.depParamRefs.buildNumber.ref
92+
7693
triggers {
7794
vcs {
7895
triggerRules = """
@@ -81,19 +98,27 @@ fun Project.buildAll() = BuildType {
8198
""".trimIndent()
8299
}
83100
}
84-
101+
85102
commonConfigure()
86103
}.also { buildType(it) }
87104

88-
fun Project.build(platform: String) = platform(platform, "Build") {
105+
fun Project.build(platform: Platform, versionBuild: BuildType) = buildType("Build", platform) {
106+
107+
dependsOnSnapshot(versionBuild)
108+
109+
params {
110+
param(versionSuffixParameter, versionBuild.depParamRefs[versionSuffixParameter].ref)
111+
param(teamcitySuffixParameter, versionBuild.depParamRefs[teamcitySuffixParameter].ref)
112+
}
113+
89114
steps {
90115
gradle {
91-
name = "Build and Test $platform Binaries"
116+
name = "Build and Test ${platform.buildTypeName()} Binaries"
92117
jdkHome = "%env.$jdk%"
93118
jvmArgs = "-Xmx1g"
94-
tasks = "clean publishToBuildLocal check ${fastBenchmarkTasks(platform).joinToString(separator = " ")}"
119+
tasks = "clean publishToBuildLocal check"
95120
// --continue is needed to run tests for all targets even if one target fails
96-
gradleParams = "--info --stacktrace -P$versionSuffixParameter=SNAPSHOT -P$teamcitySuffixParameter=%build.counter% --continue"
121+
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$teamcitySuffixParameter=%$teamcitySuffixParameter% --continue"
97122
buildFile = ""
98123
gradleWrapperPath = ""
99124
}
@@ -103,34 +128,9 @@ fun Project.build(platform: String) = platform(platform, "Build") {
103128
artifactRules = "+:build/maven=>maven\n+:build/api=>api"
104129
}
105130

106-
fun fastBenchmarkTasks(platform: String): List<String> {
107-
val nativeFastBenchmark = when(platform) {
108-
"Mac OS X" -> "macosX64FastBenchmark"
109-
"Linux" -> "linuxX64FastBenchmark"
110-
"Windows" -> "mingwX64FastBenchmark"
111-
else -> throw IllegalArgumentException("Unknown platform: $platform")
112-
}
113-
return listOf("jsFastBenchmark", "jvmFastBenchmark", nativeFastBenchmark)
114-
}
115-
116-
fun BuildType.dependsOn(build: BuildType, configure: Dependency.() -> Unit) =
117-
apply {
118-
dependencies.dependency(build, configure)
119-
}
120-
121-
fun BuildType.dependsOnSnapshot(build: BuildType, configure: SnapshotDependency.() -> Unit = {}) = apply {
122-
dependencies.dependency(build) {
123-
snapshot {
124-
configure()
125-
onDependencyFailure = FailureAction.FAIL_TO_START
126-
onDependencyCancel = FailureAction.CANCEL
127-
}
128-
}
129-
}
130-
131-
fun Project.deployConfigure() = BuildType {
132-
id("Deploy_Configure")
133-
this.name = "Deploy (Configure)"
131+
fun Project.deployVersion() = BuildType {
132+
id(DEPLOY_CONFIGURE_VERSION_ID)
133+
this.name = "Deploy (Configure Version)"
134134
commonConfigure()
135135

136136
params {
@@ -158,21 +158,21 @@ fun Project.deployConfigure() = BuildType {
158158
}.also { buildType(it) }
159159

160160
fun Project.deployPublish(configureBuild: BuildType) = BuildType {
161-
id("Deploy_Publish")
161+
id(DEPLOY_PUBLISH_ID)
162162
this.name = "Deploy (Publish)"
163163
type = BuildTypeSettings.Type.COMPOSITE
164+
dependsOnSnapshot(configureBuild)
165+
buildNumberPattern = configureBuild.depParamRefs.buildNumber.ref
164166
params {
165-
param(versionSuffixParameter, "${configureBuild.depParamRefs[versionSuffixParameter]}")
166-
167167
// Tell configuration build how to get release version parameter from this build
168168
// "dev" is the default and means publishing is not releasing to public
169-
param(configureBuild.reverseDepParamRefs[releaseVersionParameter].name, "dev")
169+
text(configureBuild.reverseDepParamRefs[releaseVersionParameter].name, "dev", display = ParameterDisplay.PROMPT, label = "Release Version")
170170
}
171171
commonConfigure()
172-
}.also { buildType(it) }.dependsOnSnapshot(configureBuild)
172+
}.also { buildType(it) }
173173

174174

175-
fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platform, "Deploy") {
175+
fun Project.deploy(platform: Platform, configureBuild: BuildType) = buildType("Deploy", platform) {
176176
type = BuildTypeSettings.Type.DEPLOYMENT
177177
enablePersonalBuilds = false
178178
maxRunningBuilds = 1
@@ -189,63 +189,13 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf
189189

190190
steps {
191191
gradle {
192-
name = "Deploy $platform Binaries"
192+
name = "Deploy ${platform.buildTypeName()} Binaries"
193193
jdkHome = "%env.$jdk%"
194194
jvmArgs = "-Xmx1g"
195195
gradleParams = "--info --stacktrace -P$versionSuffixParameter=%$versionSuffixParameter% -P$releaseVersionParameter=%$releaseVersionParameter% -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
196-
tasks = "clean build publish"
196+
tasks = "clean publish"
197197
buildFile = ""
198198
gradleWrapperPath = ""
199199
}
200200
}
201201
}.dependsOnSnapshot(configureBuild)
202-
203-
fun Project.platform(platform: String, name: String, configure: BuildType.() -> Unit) = BuildType {
204-
// ID is prepended with Project ID, so don't repeat it here
205-
// ID should conform to identifier rules, so just letters, numbers and underscore
206-
id("${name}_${platform.substringBefore(" ")}")
207-
// Display name of the build configuration
208-
this.name = "$name ($platform)"
209-
210-
requirements {
211-
contains("teamcity.agent.jvm.os.name", platform)
212-
}
213-
214-
params {
215-
// This parameter is needed for macOS agent to be compatible
216-
param("env.JDK_17", "")
217-
}
218-
219-
commonConfigure()
220-
configure()
221-
}.also { buildType(it) }
222-
223-
224-
fun BuildType.commonConfigure() {
225-
requirements {
226-
noLessThan("teamcity.agent.hardware.memorySizeMb", "6144")
227-
}
228-
229-
// Allow to fetch build status through API for badges
230-
allowExternalStatus = true
231-
232-
// Configure VCS, by default use the same and only VCS root from which this configuration is fetched
233-
vcs {
234-
root(DslContext.settingsRoot)
235-
showDependenciesChanges = true
236-
checkoutMode = CheckoutMode.ON_AGENT
237-
}
238-
239-
failureConditions {
240-
errorMessage = true
241-
nonZeroExitCode = true
242-
executionTimeoutMin = 120
243-
}
244-
245-
features {
246-
feature {
247-
id = "perfmon"
248-
type = "perfmon"
249-
}
250-
}
251-
}

0 commit comments

Comments
 (0)