|
1 | 1 | import jetbrains.buildServer.configs.kotlin.v2018_2.* |
2 | 2 | import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.* |
3 | 3 | import jetbrains.buildServer.configs.kotlin.v2018_2.triggers.* |
4 | | -import java.lang.IllegalArgumentException |
5 | 4 |
|
6 | 5 | /* |
7 | 6 | The settings script is an entry point for defining a TeamCity |
@@ -66,13 +65,10 @@ project { |
66 | 65 | } |
67 | 66 | } |
68 | 67 |
|
69 | | - val benchmarks = listOf( |
70 | | - benchmark("js", "Linux"), |
71 | | - benchmark("jvm", "Linux"), |
72 | | - *platforms.map { benchmark("native", it) }.toTypedArray() |
73 | | - ) |
| 68 | + buildTypesOrder = listOf(buildAll, buildVersion, *builds.toTypedArray(), deployPublish, deployConfigure, *deploys.toTypedArray()) |
74 | 69 |
|
75 | | - buildTypesOrder = listOf(buildAll, buildVersion, *builds.toTypedArray(), deployPublish, deployConfigure, *deploys.toTypedArray(), *benchmarks.toTypedArray()) |
| 70 | + val benchmarksProject = benchmarksProject() |
| 71 | + subProject(benchmarksProject) |
76 | 72 | } |
77 | 73 |
|
78 | 74 | fun Project.buildVersion() = BuildType { |
@@ -143,45 +139,6 @@ fun Project.build(platform: String, versionBuild: BuildType) = platform(platform |
143 | 139 | artifactRules = "+:build/maven=>maven\n+:build/api=>api" |
144 | 140 | } |
145 | 141 |
|
146 | | -fun Project.benchmark(target: String, platform: String) = platform(platform, "${target}Benchmark") { |
147 | | - steps { |
148 | | - gradle { |
149 | | - name = "Benchmark" |
150 | | - tasks = benchmarkTask(target, platform) |
151 | | - jdkHome = "%env.$jdk%" |
152 | | - param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL") |
153 | | - buildFile = "" |
154 | | - gradleWrapperPath = "" |
155 | | - } |
156 | | - } |
157 | | - |
158 | | - artifactRules = "benchmarks/build/reports/**=> reports" |
159 | | - |
160 | | - requirements { |
161 | | - benchmarkAgentInstanceTypeRequirement(platform) |
162 | | - } |
163 | | - |
164 | | - failureConditions { |
165 | | - executionTimeoutMin = 1440 |
166 | | - } |
167 | | -} |
168 | | - |
169 | | -fun benchmarkTask(target: String, platform: String): String = when(target) { |
170 | | - "js", "jvm" -> "${target}Benchmark" |
171 | | - "native" -> when(platform) { |
172 | | - "Mac OS X" -> "macosX64Benchmark" |
173 | | - "Linux" -> "linuxX64Benchmark" |
174 | | - "Windows" -> "mingwX64Benchmark" |
175 | | - else -> throw IllegalArgumentException("Unknown platform: $platform") |
176 | | - } |
177 | | - else -> throw IllegalArgumentException("Unknown target: $target") |
178 | | -} |
179 | | - |
180 | | -fun Requirements.benchmarkAgentInstanceTypeRequirement(platform: String) { |
181 | | - if (platform == "Linux") equals("system.ec2.instance-type", "m5d.xlarge") |
182 | | - else if (platform == "Windows") equals("system.ec2.instance-type", "m5.xlarge") |
183 | | -} |
184 | | - |
185 | 142 | fun BuildType.dependsOn(build: BuildType, configure: Dependency.() -> Unit) = |
186 | 143 | apply { |
187 | 144 | dependencies.dependency(build, configure) |
@@ -268,53 +225,3 @@ fun Project.deploy(platform: String, configureBuild: BuildType) = platform(platf |
268 | 225 | } |
269 | 226 | } |
270 | 227 | }.dependsOnSnapshot(configureBuild) |
271 | | - |
272 | | -fun Project.platform(platform: String, name: String, configure: BuildType.() -> Unit) = BuildType { |
273 | | - // ID is prepended with Project ID, so don't repeat it here |
274 | | - // ID should conform to identifier rules, so just letters, numbers and underscore |
275 | | - id("${name}_${platform.substringBefore(" ")}") |
276 | | - // Display name of the build configuration |
277 | | - this.name = "$name ($platform)" |
278 | | - |
279 | | - requirements { |
280 | | - contains("teamcity.agent.jvm.os.name", platform) |
281 | | - } |
282 | | - |
283 | | - params { |
284 | | - // This parameter is needed for macOS agent to be compatible |
285 | | - if (platform.startsWith("Mac")) param("env.JDK_17", "") |
286 | | - } |
287 | | - |
288 | | - commonConfigure() |
289 | | - configure() |
290 | | -}.also { buildType(it) } |
291 | | - |
292 | | - |
293 | | -fun BuildType.commonConfigure() { |
294 | | - requirements { |
295 | | - noLessThan("teamcity.agent.hardware.memorySizeMb", "6144") |
296 | | - } |
297 | | - |
298 | | - // Allow to fetch build status through API for badges |
299 | | - allowExternalStatus = true |
300 | | - |
301 | | - // Configure VCS, by default use the same and only VCS root from which this configuration is fetched |
302 | | - vcs { |
303 | | - root(DslContext.settingsRoot) |
304 | | - showDependenciesChanges = true |
305 | | - checkoutMode = CheckoutMode.ON_AGENT |
306 | | - } |
307 | | - |
308 | | - failureConditions { |
309 | | - errorMessage = true |
310 | | - nonZeroExitCode = true |
311 | | - executionTimeoutMin = 120 |
312 | | - } |
313 | | - |
314 | | - features { |
315 | | - feature { |
316 | | - id = "perfmon" |
317 | | - type = "perfmon" |
318 | | - } |
319 | | - } |
320 | | -} |
0 commit comments