Skip to content

Commit

Permalink
(#69) Add TeamCity Kotlin Configuration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gep13 committed Sep 8, 2022
1 parent 47dc348 commit fad6601
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .teamcity/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>ChocoCCM Config DSL Script</name>
<groupId>ChocoCCM</groupId>
<artifactId>ChocoCCM</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://teamcityserver/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>

<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>

<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
90 changes: 90 additions & 0 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
@@ -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%"
}
}
}
}
})

0 comments on commit fad6601

Please sign in to comment.