diff --git a/.gitignore b/.gitignore index 28496bc77f4..5564fa0a305 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ _teamcity dist generated .next +.teamcity/*.iml diff --git a/.teamcity/README b/.teamcity/README new file mode 100644 index 00000000000..b29d0749fa7 --- /dev/null +++ b/.teamcity/README @@ -0,0 +1,11 @@ +The archive contains settings for a TeamCity project. + +To edit the settings in IntelliJ Idea, open the pom.xml and +select the 'Open as a project' option. + +If you want to move this dsl to version control, save it in the +.teamcity directory. + +## Branch specific settings +Bear in mind that not all the changes there will be applied. For instance, if you add a new project or a build configuration, such changes will be ignored. This happens because TeamCity does not support different sets of projects and build configurations in feature branches. +You can read more about it [here](https://blog.jetbrains.com/teamcity/2018/01/branch-specific-settings-in-teamcity/). \ No newline at end of file diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 00000000000..6e0d2a255b4 --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + Kotlin_KotlinSites_KotlinlangTeamcityDsl Config DSL Script + Kotlin_KotlinSites_KotlinlangTeamcityDsl + Kotlin_KotlinSites_KotlinlangTeamcityDsl_dsl + 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://buildserver.labs.intellij.net/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-latest + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins-latest + 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 00000000000..b28a4c3887d --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,158 @@ +import jetbrains.buildServer.configs.kotlin.* +import jetbrains.buildServer.configs.kotlin.buildFeatures.PullRequests +import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher +import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications +import jetbrains.buildServer.configs.kotlin.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep +import jetbrains.buildServer.configs.kotlin.buildSteps.script +import jetbrains.buildServer.configs.kotlin.triggers.schedule +import jetbrains.buildServer.configs.kotlin.triggers.vcs +import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot + +/* +The settings script is an entry point for defining a TeamCity +project hierarchy. The script should contain a single call to the +project() function with a Project instance or an init function as +an argument. + +VcsRoots, BuildTypes, Templates, and subprojects can be +registered inside the project using the vcsRoot(), buildType(), +template(), and subProject() methods respectively. + +To debug settings scripts in command-line, run the + + mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate + +command and attach your debugger to the port 8000. + +To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View +-> Tool Windows -> Maven Projects), find the generate task node +(Plugins -> teamcity-configs -> teamcity-configs:generate), the +'Debug' option is available in the context menu for the task. +*/ + +version = "2022.04" + +project { + subProject(Tests) + vcsRoot(KotlinLangOrgVCSRoot) +} + +object Tests : Project({ + name = "Site Tests" + + buildType(E2ETests) + buildType(E2EProductionTest) +}) + +object E2ETests : BuildType({ + name = "E2E tests" + + vcs { + root(KotlinLangOrgVCSRoot) + } + + triggers { + vcs { + branchFilter = "+:pull/*" + } + } + + steps { + script { + scriptContent = "./scripts/test/up.sh" + } + + script { + scriptContent = "./scripts/test/run.sh" + } + + script { + scriptContent = "./scripts/test/stop.sh" + } + } + + requirements { + exists("docker.server.version") + contains("docker.server.osType", "linux") + } + + features { + commitStatusPublisher { + vcsRootExtId = "${KotlinLangOrgVCSRoot.id}" + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "%github.oauth%" + } + } + } + pullRequests { + vcsRootExtId = "${KotlinLangOrgVCSRoot.id}" + provider = github { + authType = token { + token = "%github.oauth%" + } + filterAuthorRole = PullRequests.GitHubRoleFilter.MEMBER_OR_COLLABORATOR + } + } + } +}) + +object E2EProductionTest : BuildType({ + name = "E2E Test in Production" + + vcs { + root(KotlinLangOrgVCSRoot) + } + + triggers { + schedule { + schedulingPolicy = cron { + seconds = "0" + minutes = "0" + hours = "6-18/2" + dayOfMonth = "1/1" + month = "*" + dayOfWeek = "?" + } + triggerBuild = always() + branchFilter = "+:master" + withPendingChangesOnly = false + } + } + + steps { + script { + scriptContent = """ + yarn install --immutable + yarn сi:e2e:prod + """.trimIndent() + dockerImage = "mcr.microsoft.com/playwright:v1.22.2-focal" + dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux + } + } + + features { + notifications { + notifierSettings = slackNotifier { + connection = "PROJECT_EXT_486" + sendTo = "#kotlin-web-site-e2e-tests" + messageFormat = simpleMessageFormat() + } + buildFailedToStart = true + buildFailed = true + buildProbablyHanging = true + } + } +}) + +object KotlinLangOrgVCSRoot: GitVcsRoot({ + name = "kotlinlang.org VCS root" + url = "ssh://git@github.com/JetBrains/kotlin-web-site" + branch = "refs/heads/master" + branchSpec = "+:refs/heads/*" + authMethod = uploadedKey { + uploadedKey = "default teamcity key" + } +}) \ No newline at end of file