Skip to content

Commit b226b95

Browse files
committed
Add teamcity configuration
1 parent 8eb54d8 commit b226b95

File tree

2 files changed

+207
-0
lines changed

2 files changed

+207
-0
lines changed

.teamcity/pom.xml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0"?>
2+
<project>
3+
<modelVersion>4.0.0</modelVersion>
4+
<name>Git Workshop Config DSL Script</name>
5+
<groupId>git-workshop</groupId>
6+
<artifactId>git-workshop_dsl</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
9+
<parent>
10+
<groupId>org.jetbrains.teamcity</groupId>
11+
<artifactId>configs-dsl-kotlin-parent</artifactId>
12+
<version>1.0-SNAPSHOT</version>
13+
</parent>
14+
15+
<repositories>
16+
<repository>
17+
<id>jetbrains-all</id>
18+
<url>https://download.jetbrains.com/teamcity-repository</url>
19+
<snapshots>
20+
<enabled>true</enabled>
21+
</snapshots>
22+
</repository>
23+
<repository>
24+
<id>teamcity-server</id>
25+
<url>https://ci.sourcegrade.org/app/dsl-plugins-repository</url>
26+
<snapshots>
27+
<enabled>true</enabled>
28+
</snapshots>
29+
</repository>
30+
</repositories>
31+
32+
<pluginRepositories>
33+
<pluginRepository>
34+
<id>JetBrains</id>
35+
<url>https://download.jetbrains.com/teamcity-repository</url>
36+
</pluginRepository>
37+
</pluginRepositories>
38+
39+
<build>
40+
<sourceDirectory>${basedir}</sourceDirectory>
41+
<plugins>
42+
<plugin>
43+
<artifactId>kotlin-maven-plugin</artifactId>
44+
<groupId>org.jetbrains.kotlin</groupId>
45+
<version>${kotlin.version}</version>
46+
47+
<configuration/>
48+
<executions>
49+
<execution>
50+
<id>compile</id>
51+
<phase>process-sources</phase>
52+
<goals>
53+
<goal>compile</goal>
54+
</goals>
55+
</execution>
56+
<execution>
57+
<id>test-compile</id>
58+
<phase>process-test-sources</phase>
59+
<goals>
60+
<goal>test-compile</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
<plugin>
66+
<groupId>org.jetbrains.teamcity</groupId>
67+
<artifactId>teamcity-configs-maven-plugin</artifactId>
68+
<version>${teamcity.dsl.version}</version>
69+
<configuration>
70+
<format>kotlin</format>
71+
<dstDir>target/generated-configs</dstDir>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
77+
<dependencies>
78+
<dependency>
79+
<groupId>org.jetbrains.teamcity</groupId>
80+
<artifactId>configs-dsl-kotlin-latest</artifactId>
81+
<version>${teamcity.dsl.version}</version>
82+
<scope>compile</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.jetbrains.teamcity</groupId>
86+
<artifactId>configs-dsl-kotlin-plugins-latest</artifactId>
87+
<version>1.0-SNAPSHOT</version>
88+
<type>pom</type>
89+
<scope>compile</scope>
90+
</dependency>
91+
<dependency>
92+
<groupId>org.jetbrains.kotlin</groupId>
93+
<artifactId>kotlin-stdlib-jdk8</artifactId>
94+
<version>${kotlin.version}</version>
95+
<scope>compile</scope>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.jetbrains.kotlin</groupId>
99+
<artifactId>kotlin-script-runtime</artifactId>
100+
<version>${kotlin.version}</version>
101+
<scope>compile</scope>
102+
</dependency>
103+
</dependencies>
104+
</project>

.teamcity/settings.kts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import jetbrains.buildServer.configs.kotlin.BuildFeatures
2+
import jetbrains.buildServer.configs.kotlin.BuildType
3+
import jetbrains.buildServer.configs.kotlin.DslContext
4+
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
5+
import jetbrains.buildServer.configs.kotlin.buildFeatures.perfmon
6+
import jetbrains.buildServer.configs.kotlin.buildSteps.exec
7+
import jetbrains.buildServer.configs.kotlin.project
8+
import jetbrains.buildServer.configs.kotlin.projectFeatures.githubIssues
9+
import jetbrains.buildServer.configs.kotlin.triggers.vcs
10+
import jetbrains.buildServer.configs.kotlin.version
11+
12+
/*
13+
The settings script is an entry point for defining a TeamCity
14+
project hierarchy. The script should contain a single call to the
15+
project() function with a Project instance or an init function as
16+
an argument.
17+
18+
VcsRoots, BuildTypes, Templates, and subprojects can be
19+
registered inside the project using the vcsRoot(), buildType(),
20+
template(), and subProject() methods respectively.
21+
22+
To debug settings scripts in command-line, run the
23+
24+
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
25+
26+
command and attach your debugger to the port 8000.
27+
28+
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
29+
-> Tool Windows -> Maven Projects), find the generate task node
30+
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
31+
'Debug' option is available in the context menu for the task.
32+
*/
33+
34+
version = "2023.11"
35+
36+
project {
37+
38+
buildType(createBuild("workshop", "workflows"))
39+
40+
features {
41+
githubIssues {
42+
id = "PROJECT_EXT_3"
43+
displayName = "sourcegrade/git-workshop"
44+
repositoryURL = "https://github.com/sourcegrade/git-workshop"
45+
authType = accessToken {
46+
accessToken = "credentialsJSON:f57a4fdd-fb30-41c0-9983-620364336d03"
47+
}
48+
param("tokenId", "")
49+
}
50+
}
51+
}
52+
53+
fun createBuild(buildGroup: String, buildName: String): BuildType {
54+
return object : BuildType() {
55+
init {
56+
name = "$buildGroup/$buildName"
57+
58+
configureVcs()
59+
configureTriggers()
60+
features {
61+
configureBaseFeatures()
62+
}
63+
64+
steps {
65+
exec {
66+
name = "Build $buildGroup/$buildName with AlgoTeX"
67+
path = "latexmk"
68+
arguments = "--shell-escape -synctex=1 -interaction=nonstopmode -file-line-error -lualatex $buildName.tex"
69+
70+
dockerImage = "ghcr.io/tudalgo/algotex:latest"
71+
dockerRunParameters = "--rm --interactive=false -v ${"$"}PWD:/data/ -w /data/$buildGroup"
72+
}
73+
}
74+
}
75+
}
76+
}
77+
78+
fun BuildType.configureVcs() {
79+
vcs {
80+
root(DslContext.settingsRoot)
81+
}
82+
}
83+
84+
fun BuildType.configureTriggers() {
85+
triggers {
86+
vcs {
87+
branchFilter = "+:*"
88+
}
89+
}
90+
}
91+
92+
fun BuildFeatures.configureBaseFeatures() {
93+
perfmon {}
94+
commitStatusPublisher {
95+
vcsRootExtId = "${DslContext.settingsRoot.id}"
96+
publisher = github {
97+
githubUrl = "https://api.github.com"
98+
authType = personalToken {
99+
token = "credentialsJSON:f57a4fdd-fb30-41c0-9983-620364336d03"
100+
}
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)