forked from JetBrains/kotlin-web-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ktl-744 feat: tests configuration for CI
- Loading branch information
Showing
4 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -47,3 +47,4 @@ _teamcity | |
dist | ||
generated | ||
.next | ||
.teamcity/*.iml |
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,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/). |
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,104 @@ | ||
<?xml version="1.0"?> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<name>Kotlin_KotlinSites_KotlinlangTeamcityDsl Config DSL Script</name> | ||
<groupId>Kotlin_KotlinSites_KotlinlangTeamcityDsl</groupId> | ||
<artifactId>Kotlin_KotlinSites_KotlinlangTeamcityDsl_dsl</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://buildserver.labs.intellij.net/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-latest</artifactId> | ||
<version>${teamcity.dsl.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.teamcity</groupId> | ||
<artifactId>configs-dsl-kotlin-plugins-latest</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> |
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,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" | ||
} | ||
}) |