github.com/neilgarb/delve@v1.9.2-nobreaks/.teamcity/settings.kts (about)

     1  import jetbrains.buildServer.configs.kotlin.v2019_2.*
     2  import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.PullRequests
     3  import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher
     4  import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.golang
     5  import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests
     6  import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand
     7  import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.exec
     8  import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell
     9  import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
    10  import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
    11  import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
    12  
    13  /*
    14  The settings script is an entry point for defining a TeamCity
    15  project hierarchy. The script should contain a single call to the
    16  project() function with a Project instance or an init function as
    17  an argument.
    18  
    19  VcsRoots, BuildTypes, Templates, and subprojects can be
    20  registered inside the project using the vcsRoot(), buildType(),
    21  template(), and subProject() methods respectively.
    22  
    23  To debug settings scripts in command-line, run the
    24  
    25      mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
    26  
    27  command and attach your debugger to the port 8000.
    28  
    29  To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
    30  -> Tool Windows -> Maven Projects), find the generate task node
    31  (Plugins -> teamcity-configs -> teamcity-configs:generate), the
    32  'Debug' option is available in the context menu for the task.
    33  */
    34  
    35  version = "2020.2"
    36  
    37  val targets = arrayOf(
    38          "linux/amd64/1.16",
    39          "linux/amd64/1.17",
    40          "linux/amd64/1.18",
    41          "linux/amd64/tip",
    42  
    43          "linux/386/1.18",
    44  
    45          "linux/arm64/1.18",
    46          "linux/arm64/tip",
    47  
    48          "windows/amd64/1.18",
    49          "windows/amd64/tip",
    50  
    51          "mac/amd64/1.18",
    52          "mac/amd64/tip",
    53  
    54          "mac/arm64/1.18",
    55          "mac/arm64/tip"
    56  )
    57  
    58  project {
    59      val tests = targets.map { target ->
    60          val (os, arch, version) = target.split("/")
    61          TestBuild(os, arch, version, AbsoluteId("Delve_${os}_${arch}_${version.replace('.', '_')}"))
    62      }
    63      tests.map { test ->
    64          test.os
    65      }.distinct().forEach { os ->
    66          subProject(OSProject(os, tests.filter { test ->
    67              test.os == os
    68          }))
    69      }
    70      buildType(AggregatorBuild(tests))
    71      params {
    72          param("teamcity.ui.settings.readOnly", "true")
    73      }
    74  }
    75  
    76  class AggregatorBuild(tests: Collection<BuildType>) : BuildType({
    77      name = "Aggregator"
    78      type = Type.COMPOSITE
    79  
    80      vcs {
    81          root(DslContext.settingsRoot)
    82      }
    83  
    84      triggers {
    85          vcs {
    86          }
    87      }
    88  
    89      dependencies {
    90          tests.forEach { test ->
    91              snapshot(test) {
    92              }
    93          }
    94      }
    95  
    96      features {
    97          pullRequests {
    98              vcsRootExtId = "${DslContext.settingsRoot.id}"
    99              provider = github {
   100                  authType = token {
   101                      token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700"
   102                  }
   103                  filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
   104              }
   105          }
   106          commitStatusPublisher {
   107              vcsRootExtId = "${DslContext.settingsRoot.id}"
   108              publisher = github {
   109                  githubUrl = "https://api.github.com"
   110                  authType = personalToken {
   111                      token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700"
   112                  }
   113              }
   114              param("github_oauth_user", "")
   115          }
   116      }
   117  
   118      failureConditions {
   119          executionTimeoutMin = 60
   120      }
   121  })
   122  
   123  class OSProject(os: String, tests: List<TestBuild>) : Project({
   124      id = AbsoluteId("Delve_$os")
   125      name = os.capitalize()
   126  
   127      tests.map { test ->
   128          test.arch
   129      }.distinct().forEach { arch ->
   130          subProject(ArchProject(os, arch, tests.filter { test ->
   131              test.arch == arch
   132          }))
   133      }
   134  })
   135  
   136  class ArchProject(os: String, arch: String, tests: List<TestBuild>) : Project({
   137      id = AbsoluteId("Delve_${os}_${arch}")
   138      name = arch
   139  
   140      tests.forEach { test ->
   141          buildType(test)
   142      }
   143  })
   144  
   145  class TestBuild(val os: String, val arch: String, version: String, buildId: AbsoluteId) : BuildType({
   146      id = buildId
   147      name = version
   148  
   149      vcs {
   150          root(DslContext.settingsRoot)
   151      }
   152  
   153      failureConditions {
   154          executionTimeoutMin = 30
   155  
   156          if (version != "tip") {
   157              failOnMetricChange {
   158                   metric = BuildFailureOnMetric.MetricType.TEST_COUNT
   159                   units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT
   160                   comparison = BuildFailureOnMetric.MetricComparison.LESS
   161                   compareTo = value()
   162              }
   163          }
   164      }
   165  
   166      steps {
   167          when (os) {
   168              "linux" -> {
   169                  val dockerArch = when (arch) {
   170                      "386" -> "i386"
   171                      "arm64" -> "arm64v8"
   172                      else -> {
   173                          arch
   174                      }
   175                  }
   176                  dockerCommand {
   177                      name = "Pull Ubuntu"
   178                      commandType = other {
   179                          subCommand = "pull"
   180                          commandArgs = "$dockerArch/ubuntu:20.04"
   181                      }
   182                  }
   183                  dockerCommand {
   184                      name = "Test"
   185                      commandType = other {
   186                          subCommand = "run"
   187                          commandArgs = """
   188                          -v %teamcity.build.checkoutDir%:/delve
   189                          --env TEAMCITY_VERSION=${'$'}TEAMCITY_VERSION
   190                          --env CI=true
   191                          --privileged
   192                          $dockerArch/ubuntu:20.04
   193                          /delve/_scripts/test_linux.sh ${"go$version"} $arch
   194                      """.trimIndent()
   195                      }
   196                  }
   197              }
   198              "windows" -> {
   199                  powerShell {
   200                      name = "Test"
   201                      scriptMode = file {
   202                          path = "_scripts/test_windows.ps1"
   203                      }
   204                      param("jetbrains_powershell_scriptArguments", "-version ${"go$version"} -arch $arch")
   205                  }
   206              }
   207              "mac" -> {
   208                  exec {
   209                      name = "Test"
   210                      path = "_scripts/test_mac.sh"
   211                      arguments = "${"go$version"} $arch %system.teamcity.build.tempDir%"
   212                  }
   213              }
   214          }
   215      }
   216  
   217      requirements {
   218          when (arch) {
   219              "386", "amd64" -> equals("teamcity.agent.jvm.os.arch", if (os == "mac") "x86_64" else "amd64")
   220              "arm64" -> equals("teamcity.agent.jvm.os.arch", "aarch64")
   221          }
   222          when (os) {
   223              "linux" -> {
   224                  matches("teamcity.agent.jvm.os.family", "Linux")
   225              }
   226              "windows" -> {
   227                  matches("teamcity.agent.jvm.os.family", "Windows")
   228              }
   229              "mac" -> {
   230                  matches("teamcity.agent.jvm.os.family", "Mac OS")
   231              }
   232          }
   233      }
   234  
   235      features {
   236          pullRequests {
   237              vcsRootExtId = "${DslContext.settingsRoot.id}"
   238              provider = github {
   239                  authType = token {
   240                      token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700"
   241                  }
   242                  filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY
   243              }
   244          }
   245          golang {
   246              testFormat = "json"
   247          }
   248      }
   249  })