Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to TeamCity and Qodana #822

Closed
wants to merge 75 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
b18b6b4
TeamCity change in 'Kord' project: Versioned settings configuration u…
Mar 23, 2023
da15f1e
TeamCity change in 'Kord' project: runners of 'Run Native Tests on Li…
Mar 23, 2023
6d5cb8f
TeamCity change in 'Kord' project: runners of 'Run Native Tests on Li…
Mar 23, 2023
57af5c4
Use Gradle to auto-provision GraalVm JDK 17
DRSchlaubi Mar 23, 2023
0b87c04
Run Gradle with --stacktrace
DRSchlaubi Mar 23, 2023
d8b430d
Enable debug logs
DRSchlaubi Mar 23, 2023
fec351f
Initial migration to TeamCity CI
DRSchlaubi Mar 23, 2023
0f5b682
Add mandatory ID
DRSchlaubi Mar 23, 2023
3f90329
TeamCity change in 'Kord' project: 'Run Native Tests on Linux' build …
Mar 23, 2023
299cd2c
TeamCity change in 'Kord' project: 'Validation' build configuration w…
Mar 23, 2023
0f4d958
TeamCity change in 'Kord' project: VCS roots of 'Validation' build co…
Mar 23, 2023
dbbcf75
Add mandatory ID
DRSchlaubi Mar 23, 2023
25ca64e
TeamCity change in 'Kord' project: 'https://github.com/kordlib/kord#r…
Mar 23, 2023
a718e73
TeamCity change in 'Kord' project: 'Validation' build configuration w…
Mar 23, 2023
fcce6a2
TeamCity change in 'Kord' project: commit current project settings
Mar 23, 2023
d89d95b
Fix CI
DRSchlaubi Mar 23, 2023
37d2397
Remove TeamCity patches
DRSchlaubi Mar 23, 2023
c4ffbbf
Fail if test count changes significantly
DRSchlaubi Mar 23, 2023
fa529a1
Run Validation CI on pull requests as well
DRSchlaubi Mar 23, 2023
b854803
Fix Pull request configuration
DRSchlaubi Mar 23, 2023
e3af14e
TeamCity change in 'Kord' project: Versioned settings configuration u…
Mar 23, 2023
a33ba50
Add GITHU_BRANCH environment variable
DRSchlaubi Mar 23, 2023
1d5dd13
Convert more CI
DRSchlaubi Mar 24, 2023
f1440d5
Convert Maven deployment to TeamCity
DRSchlaubi Mar 24, 2023
2199872
Fix typo
DRSchlaubi Mar 24, 2023
359d4b8
Run live tests in TeamCity
DRSchlaubi Mar 24, 2023
b9865b8
Fix wrong environment variable name
DRSchlaubi Mar 24, 2023
62b9228
Mark environmen variable as secure
DRSchlaubi Mar 24, 2023
4ba8caa
Fix CI secret
DRSchlaubi Mar 24, 2023
27cb1a8
Stop running CI on GH-pages
DRSchlaubi Mar 25, 2023
a9d4a18
Add build cache
DRSchlaubi Apr 11, 2023
acbe24d
Fix build
DRSchlaubi Apr 11, 2023
b7fc13c
Remove JDK 11 dependency
DRSchlaubi Apr 12, 2023
35ac453
Update secrets
DRSchlaubi Apr 12, 2023
c7c1d74
Add Qodana to project
DRSchlaubi Apr 12, 2023
ffe9545
Correctly specify linter
DRSchlaubi Apr 12, 2023
ca0d5b0
Add trigger for Qodana CI
DRSchlaubi Apr 12, 2023
5846446
Add PR support to QodanaCI
DRSchlaubi Apr 12, 2023
8c9dfab
TeamCity change in 'Kord' project: Synchronization with own VCS root …
Apr 12, 2023
ac78e1c
Remove outdated xml config
DRSchlaubi Apr 12, 2023
bf3c31b
Update test token again
DRSchlaubi Apr 12, 2023
d69e85b
Fix incorrect configuration of publishing parameters
DRSchlaubi Apr 12, 2023
f780226
Specify publishing secrets differently
DRSchlaubi Apr 12, 2023
2bd1699
Add fixing user
DRSchlaubi Apr 13, 2023
1ea6b9d
Fix wrong env var name
DRSchlaubi Apr 13, 2023
2c70f94
Fix name of branch variable
DRSchlaubi Apr 13, 2023
4432d83
Run generateBuildConfig in Qodana
DRSchlaubi Apr 13, 2023
dc98325
Update user variable
DRSchlaubi Apr 13, 2023
17b6d53
Use different sonatype credentials
DRSchlaubi Apr 13, 2023
0de827a
Fix typo in parameter name
DRSchlaubi Apr 13, 2023
f710f86
Fix broken branch name detection
DRSchlaubi Apr 13, 2023
6d2d6b5
Update baseline
DRSchlaubi Apr 14, 2023
4e10c7f
Disable all other branches for now
DRSchlaubi Apr 17, 2023
2a622c0
Configure build cache
DRSchlaubi Apr 17, 2023
818e45b
Do not run on internal PRs twice
DRSchlaubi Apr 17, 2023
b2119b2
Use Grgit
DRSchlaubi Apr 19, 2023
e945daf
Fully switch to grgit
DRSchlaubi Apr 21, 2023
f1a8873
Also run on tags
DRSchlaubi Apr 27, 2023
022cb61
Merge branch '0.9.x' into feature/teamcity
lukellmann May 1, 2023
8ae2d11
Suppress unused inspections
lukellmann May 1, 2023
8245a68
Latest qodana-jvm linter
lukellmann May 1, 2023
a2fc864
TeamCity change in 'Kord' project: build features of 'Qodana' build c…
May 1, 2023
4534610
Improve generated patch for GitHub token fix
DRSchlaubi May 1, 2023
2610596
Switch to qodana.recommended profile
lukellmann May 1, 2023
918d35b
These inspections should be included in the qodana.recommended profile
lukellmann May 1, 2023
6e6f4ee
Update baseline and name correctly
lukellmann May 2, 2023
290dbe2
Update baseline again
lukellmann May 2, 2023
33feccd
Baseline improvements
DRSchlaubi May 3, 2023
c208d04
Ignore MemberVisibilityCanBePrivate and remove baseline
DRSchlaubi May 3, 2023
47454e1
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
Jul 8, 2023
78b4a83
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
Jul 8, 2023
a529864
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
Jul 22, 2023
2f51d0e
TeamCity change in 'Kord' project: runners of 'Deployment' build conf…
Jul 22, 2023
981635f
TeamCity change in 'Kord' project: runners of 'Deployment' build conf…
Jul 22, 2023
64a96ea
TeamCity change in 'Kord' project: Connection added
Jan 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .github/workflows/deployment-ci.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/docs-ci.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ out/

**/build/*
!**/build/generated/
**/build/generated/**/test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do these generated files come from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this came from the Graal PR to prevent commiting the reflect-config.json for tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep graal stuff out of this pr? i think we should

.teamcity/target/
# re-exclude BuildConfigGenerated.kt
common/build/generated/source/buildConfig/main/main/dev/kord/common/BuildConfigGenerated.kt
30 changes: 30 additions & 0 deletions .teamcity/DebuggableGradle.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import jetbrains.buildServer.configs.kotlin.BuildSteps
import jetbrains.buildServer.configs.kotlin.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle

const val debugParamName = "debug"
const val gradleHome = ".gradle-home"
const val gradleHomeFlag = "--gradle-user-home $gradleHome"

/**
* Adds a new [Gradle build step][GradleBuildStep] that supports the debug parameter.
*/
fun BuildSteps.debuggableGradle(name: String, configure: GradleBuildStep.() -> Unit) {
gradle {
this.name = "$name (Debug)"
conditions {
equals(debugParamName, true.toString())
}
configure()
gradleParams += listOf("-d", gradleHomeFlag)
}

gradle {
this.name = name
conditions {
equals(debugParamName, false.toString())
}
configure()
gradleParams += listOf(gradleHomeFlag)
}
}
48 changes: 48 additions & 0 deletions .teamcity/DeploymentCI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import jetbrains.buildServer.configs.kotlin.FailureConditions
import jetbrains.buildServer.configs.kotlin.RelativeId
import jetbrains.buildServer.configs.kotlin.failureConditions.BuildFailureOnMetric
import jetbrains.buildServer.configs.kotlin.failureConditions.failOnMetricChange

val DeploymentCI = KordBuild("Deployment") {
id = RelativeId("deployment")
triggers {
vcs()
}

steps {
debuggableGradle("Run checks") {
tasks = "check"
}

debuggableGradle("Publish Artifacts") {
conditions {
// Meaning: Do not run on Pull Requests
doesNotExist("teamcity.pullRequest.number")
}

tasks = "publish"
gradleParams = "-x test"
}
}

failureConditions {
failOnSignificantDecreaseOf(BuildFailureOnMetric.MetricType.TEST_COUNT)
failOnSignificantDecreaseOf(BuildFailureOnMetric.MetricType.TEST_IGNORED_COUNT)
}

features {
//installGitHubPullRequest()
}
}

private fun FailureConditions.failOnSignificantDecreaseOf(metricType: BuildFailureOnMetric.MetricType) {
failOnMetricChange {
metric = metricType
threshold = 20
units = BuildFailureOnMetric.MetricUnit.PERCENTS
comparison = BuildFailureOnMetric.MetricComparison.LESS
compareTo = build {
buildRule = lastSuccessful()
}
}
}
54 changes: 54 additions & 0 deletions .teamcity/GitHub.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import jetbrains.buildServer.configs.kotlin.BuildFeatures
import jetbrains.buildServer.configs.kotlin.DslContext
import jetbrains.buildServer.configs.kotlin.ProjectFeatures
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.buildFeatures.pullRequests
import jetbrains.buildServer.configs.kotlin.projectFeatures.githubIssues
import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot

object GitHub : GitVcsRoot({
name = "https://github.com/kordlib/kord#refs/heads/0.8.x"
url = "https://github.com/kordlib/kord"
branchSpec = """
+:refs/heads/*
+:refs/tags/*
-:refs/heads/gh-pages
""".trimIndent()
authMethod = password {
userName = "DRSchlaubi"
password = "credentialsJSON:6c4cf2b5-741b-420a-bd80-587c4746b827"
}
param("oauthProviderId", "tc-cloud-github-connection")
})

fun BuildFeatures.installGitHubPublisher() = commitStatusPublisher {
vcsRootExtId = "${DslContext.settingsRoot.id}"
publisher = github {
githubUrl = "https://api.github.com"
authType = personalToken {
token = "credentialsJSON:6c4cf2b5-741b-420a-bd80-587c4746b827"
}
}
param("github_oauth_user", "DRSchlaubi")
}

fun BuildFeatures.installGitHubPullRequest() = pullRequests {
provider = github {
authType = token {
token = "credentialsJSON:6c4cf2b5-741b-420a-bd80-587c4746b827"
}
filterSourceBranch = """
:refs/-
+:refs/pull/*/head
""".trimIndent()
}
}

fun ProjectFeatures.installGitHubIssueTracker() = githubIssues {
id = "PROJECT_EXT_2"
displayName = "GitHub"
repositoryURL = "https://github.com/kordlib/kord"
authType = accessToken {
accessToken = "credentialsJSON:6c4cf2b5-741b-420a-bd80-587c4746b827"
}
}
9 changes: 9 additions & 0 deletions .teamcity/GraalVMNativeImageCI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import jetbrains.buildServer.configs.kotlin.RelativeId

val GraalVMNativeImageCI = MultiOSKordBuild("Run GraalVM Native image Tests", RelativeId("Run_Native_Image_tests")) {
steps {
debuggableGradle("Run Native Image Tests") {
tasks = "nativeTest"
}
}
}
32 changes: 32 additions & 0 deletions .teamcity/OSMatrix.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import jetbrains.buildServer.configs.kotlin.AbsoluteId
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.Id

/**
* Creates a matrix for [operatingSystems] and runs the build everywhere.
*
* @param name a base name for all [types][BuildType]
* (Is converted to `$name ($operatingSystem)`
* @param id a base [Id] for all [types][BuildType]
* (Is converted to `$name_$operatingSystem)
* @param operatingSystems [List] of operating systems
* @param configure configuration for all types
*/
@Suppress("FunctionName")
fun MultiOSKordBuild(
name: String,
id: Id,
operatingSystems: List<String> = listOf("Linux", "Windows", "Mac OS"),
configure: BuildType.() -> Unit
): List<BuildType> {
return operatingSystems.map { operatingSystem ->
KordBuild("$name ($operatingSystem)") {
this.id = AbsoluteId("${id.value}_${operatingSystem.replace(' ', '_').lowercase()}")
requirements {
matches("teamcity.agent.jvm.os.family", "Linux")
}

configure()
}
}
}
22 changes: 22 additions & 0 deletions .teamcity/QodanaCI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import jetbrains.buildServer.configs.kotlin.RelativeId
import jetbrains.buildServer.configs.kotlin.buildSteps.Qodana
import jetbrains.buildServer.configs.kotlin.buildSteps.qodana

val QodanaCI = KordBuild("Qodana") {
id = RelativeId("qodana")

triggers {
vcs()
}

steps {
qodana {
cloudToken = "credentialsJSON:acbac377-214a-4239-a3bb-bcf3ae29d83e"
linter = Qodana.Linter.Jvm()
}
}

features {
installGitHubPullRequest()
}
}
30 changes: 30 additions & 0 deletions .teamcity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# .teamcity

This folder houses the [TeamCity](https://jetbrains.com/teamcity) configurations for the Kord build process

# Documentation

Documentation can be
found [here](https://www.jetbrains.com/help/teamcity/kotlin-dsl.html) ([KDoc](https://kord.teamcity.com/app/dsl-documentation/index.html))

# Importing in IntelliJ

File -> Project Structure -> Modules -> Add -> Import ->
Select [pom.xml](pom.xml) -> Select Maven

# Validating

To Validate the config format run the following Maven goal

```shell
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
```

# Builds

| Name | Description | Definition |
|--------------------|----------------------------------------------------------------------|----------------------------------------------------|
| Deployment | Runs checks (Test, binary compatibility) and publish Maven artifacts | [Deployment.kt](DeploymentCI.kt) |
| Docs | Deploys documentation to GitHub Pages | [DocsCI.kt](DocsCI.kt) |
| GraalVM Validation | Runs GraalVM Native image Tests | [GraalVMNativeImageCI.kt](GraalVMNativeImageCI.kt) |
| Qodana | Runs Qodana | [QodanaCI.kt](QodanaCI.kt) |
39 changes: 39 additions & 0 deletions .teamcity/Shared.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.buildFeatures.buildCache

@Suppress("FunctionName")
fun KordBuild(name: String, configure: BuildType.() -> Unit) = object : BuildType({
this.name = name
configure()

vcs {
root(DslContext.settingsRoot)
}

requirements {
matches("teamcity.agent.jvm.os.family", "Linux")
}

params {
checkbox(debugParamName, false.toString(), "Debug Mode", "Run build with debug logging enabled")
password("env.KORD_TEST_TOKEN", "credentialsJSON:6f4d984c-83d2-4914-8dea-dc0ed996d81d")
password("env.NEXUS_USER", "credentialsJSON:8e4c071b-df9d-4701-b8df-85058c1bf7ef")
password("env.NEXUS_PASSWORD", "credentialsJSON:69d63bf7-8064-4062-a01b-96aa50fdc890")
password("system.org.gradle.project.signingKey", "credentialsJSON:aebe42c4-8827-4b93-afaf-7a1bf4f46a51")
password("system.org.gradle.project.signingPassword", "credentialsJSON:7de31dac-638d-43b6-a070-9e9d9ed3db22")
}

features {
installGitHubPublisher()
buildCache {
this.name = "gradle_cache"
rules = """
.gradle/
$gradleHome
buildSrc/.gradle
buildSrc/build
~/.gradle/caches
""".trimIndent()
}
}
}) {}
16 changes: 16 additions & 0 deletions .teamcity/TeamCityExtensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.Project
import jetbrains.buildServer.configs.kotlin.Triggers
import jetbrains.buildServer.configs.kotlin.triggers.vcs

/**
* Short-hand for only VCS triggers.
*/
fun Triggers.vcs() = vcs { }

/**
* Adds all [types] to this [Project].
*
* @see MultiOSKordBuild
*/
fun Project.buildType(types: Iterable<BuildType>) = types.forEach(::buildType)
Loading
Loading