-
Notifications
You must be signed in to change notification settings - Fork 82
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
Closed
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…
da15f1e
TeamCity change in 'Kord' project: runners of 'Run Native Tests on Li…
6d5cb8f
TeamCity change in 'Kord' project: runners of 'Run Native Tests on Li…
57af5c4
Use Gradle to auto-provision GraalVm JDK 17
DRSchlaubi 0b87c04
Run Gradle with --stacktrace
DRSchlaubi d8b430d
Enable debug logs
DRSchlaubi fec351f
Initial migration to TeamCity CI
DRSchlaubi 0f5b682
Add mandatory ID
DRSchlaubi 3f90329
TeamCity change in 'Kord' project: 'Run Native Tests on Linux' build …
299cd2c
TeamCity change in 'Kord' project: 'Validation' build configuration w…
0f4d958
TeamCity change in 'Kord' project: VCS roots of 'Validation' build co…
dbbcf75
Add mandatory ID
DRSchlaubi 25ca64e
TeamCity change in 'Kord' project: 'https://github.com/kordlib/kord#r…
a718e73
TeamCity change in 'Kord' project: 'Validation' build configuration w…
fcce6a2
TeamCity change in 'Kord' project: commit current project settings
d89d95b
Fix CI
DRSchlaubi 37d2397
Remove TeamCity patches
DRSchlaubi c4ffbbf
Fail if test count changes significantly
DRSchlaubi fa529a1
Run Validation CI on pull requests as well
DRSchlaubi b854803
Fix Pull request configuration
DRSchlaubi e3af14e
TeamCity change in 'Kord' project: Versioned settings configuration u…
a33ba50
Add GITHU_BRANCH environment variable
DRSchlaubi 1d5dd13
Convert more CI
DRSchlaubi f1440d5
Convert Maven deployment to TeamCity
DRSchlaubi 2199872
Fix typo
DRSchlaubi 359d4b8
Run live tests in TeamCity
DRSchlaubi b9865b8
Fix wrong environment variable name
DRSchlaubi 62b9228
Mark environmen variable as secure
DRSchlaubi 4ba8caa
Fix CI secret
DRSchlaubi 27cb1a8
Stop running CI on GH-pages
DRSchlaubi a9d4a18
Add build cache
DRSchlaubi acbe24d
Fix build
DRSchlaubi b7fc13c
Remove JDK 11 dependency
DRSchlaubi 35ac453
Update secrets
DRSchlaubi c7c1d74
Add Qodana to project
DRSchlaubi ffe9545
Correctly specify linter
DRSchlaubi ca0d5b0
Add trigger for Qodana CI
DRSchlaubi 5846446
Add PR support to QodanaCI
DRSchlaubi 8c9dfab
TeamCity change in 'Kord' project: Synchronization with own VCS root …
ac78e1c
Remove outdated xml config
DRSchlaubi bf3c31b
Update test token again
DRSchlaubi d69e85b
Fix incorrect configuration of publishing parameters
DRSchlaubi f780226
Specify publishing secrets differently
DRSchlaubi 2bd1699
Add fixing user
DRSchlaubi 1ea6b9d
Fix wrong env var name
DRSchlaubi 2c70f94
Fix name of branch variable
DRSchlaubi 4432d83
Run generateBuildConfig in Qodana
DRSchlaubi dc98325
Update user variable
DRSchlaubi 17b6d53
Use different sonatype credentials
DRSchlaubi 0de827a
Fix typo in parameter name
DRSchlaubi f710f86
Fix broken branch name detection
DRSchlaubi 6d2d6b5
Update baseline
DRSchlaubi 4e10c7f
Disable all other branches for now
DRSchlaubi 2a622c0
Configure build cache
DRSchlaubi 818e45b
Do not run on internal PRs twice
DRSchlaubi b2119b2
Use Grgit
DRSchlaubi e945daf
Fully switch to grgit
DRSchlaubi f1a8873
Also run on tags
DRSchlaubi 022cb61
Merge branch '0.9.x' into feature/teamcity
lukellmann 8ae2d11
Suppress unused inspections
lukellmann 8245a68
Latest qodana-jvm linter
lukellmann a2fc864
TeamCity change in 'Kord' project: build features of 'Qodana' build c…
4534610
Improve generated patch for GitHub token fix
DRSchlaubi 2610596
Switch to qodana.recommended profile
lukellmann 918d35b
These inspections should be included in the qodana.recommended profile
lukellmann 6e6f4ee
Update baseline and name correctly
lukellmann 290dbe2
Update baseline again
lukellmann 33feccd
Baseline improvements
DRSchlaubi c208d04
Ignore MemberVisibilityCanBePrivate and remove baseline
DRSchlaubi 47454e1
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
78b4a83
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
a529864
TeamCity change in 'Kord' project: parameters of 'Deployment' build c…
2f51d0e
TeamCity change in 'Kord' project: runners of 'Deployment' build conf…
981635f
TeamCity change in 'Kord' project: runners of 'Deployment' build conf…
64a96ea
TeamCity change in 'Kord' project: Connection added
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} | ||
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 testsThere was a problem hiding this comment.
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