From fad6601d5d6732e493da2db4a1bec94049a33ad3 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Wed, 7 Sep 2022 17:00:20 +0100 Subject: [PATCH] (#69) Add TeamCity Kotlin Configuration Based on a successful execution of the build in development environment, let's bring that configuration into source control, so that we can run it from here. --- .teamcity/pom.xml | 104 +++++++++++++++++++++++++++++++++++++++++ .teamcity/settings.kts | 90 +++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 .teamcity/pom.xml create mode 100644 .teamcity/settings.kts diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 0000000..ee6ddea --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + ChocoCCM Config DSL Script + ChocoCCM + ChocoCCM + 1.0-SNAPSHOT + + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://teamcityserver/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + ${basedir} + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + compile + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 0000000..fd48b22 --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,90 @@ +import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.PullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +project { + buildType(ChocoCCM) +} + +object ChocoCCM : BuildType({ + id = AbsoluteId("ChocoCCM") + name = "Build" + + artifactRules = """ + +:Output/*.xml + +:Output/ChocoCCM/** + """.trimIndent() + + params { + param("env.vcsroot.branch", "%vcsroot.branch%") + param("env.Git_Branch", "%teamcity.build.vcs.branch.ChocoCCM_ChocoCCMVcsRoot%") + param("teamcity.git.fetchAllHeads", "true") + password("env.GITHUB_PAT", "%system.GitHubPAT%", display = ParameterDisplay.HIDDEN, readOnly = true) + } + + vcs { + root(DslContext.settingsRoot) + + branchFilter = """ + +:* + """.trimIndent() + } + + steps { + step { + name = "Include Signing Keys" + type = "PrepareSigningEnvironment" + } + powerShell { + name = "BootstrapPSGet Task" + formatStderrAsError = true + scriptMode = script { + content = """ + try { + & .\build.ps1 -Task BootstrapPSGet -Verbose -ErrorAction Stop + } + catch { + ${'$'}_ | Out-String | Write-Host -ForegroundColor Red + exit 1 + } + """.trimIndent() + } + noProfile = false + } + powerShell { + name = "CI Task" + formatStderrAsError = true + scriptMode = script { + content = """ + try { + & .\build.ps1 -Task CI -Verbose -ErrorAction Stop + } + catch { + ${'$'}_ | Out-String | Write-Host -ForegroundColor Red + exit 1 + } + """.trimIndent() + } + noProfile = false + param("jetbrains_powershell_script_file", "build.ps1") + } + } + + triggers { + vcs { + branchFilter = "" + } + } + + features { + pullRequests { + provider = github { + authType = token { + token = "%system.GitHubPAT%" + } + } + } + } +})