netci.groovy 9.3 KB
Newer Older
1 2 3
// Groovy Script: http://www.groovy-lang.org/syntax.html
// Jenkins DSL: https://github.com/jenkinsci/job-dsl-plugin/wiki

4
import jobs.generation.*;
J
Jared Parsons 已提交
5

J
Jared Parsons 已提交
6 7 8 9 10 11
// The input project name (e.g. dotnet/corefx)
def projectName = GithubProject
// The input branch name (e.g. master)
def branchName = GithubBranchName
// Folder that the project jobs reside in (project/branch)
def projectFoldername = Utilities.getFolderName(projectName) + '/' + Utilities.getFolderName(branchName)
J
Jared Parsons 已提交
12

T
Ty Overby 已提交
13 14
def windowsUnitTestMachine = 'win2016-base'

J
Jared Parsons 已提交
15
static void addRoslynJob(def myJob, String jobName, String branchName, Boolean isPr, String triggerPhraseExtra, Boolean triggerPhraseOnly = false) {
16 17 18 19 20 21 22
  def archiveSettings = new ArchivalSettings()
  archiveSettings.addFiles('Binaries/**/*.pdb')
  archiveSettings.addFiles('Binaries/**/*.xml')
  archiveSettings.addFiles('Binaries/**/*.log')
  archiveSettings.addFiles('Binaries/**/*.dmp')
  archiveSettings.addFiles('Binaries/**/*.zip')
  archiveSettings.addFiles('Binaries/**/*.png')
23 24
  archiveSettings.addFiles('Binaries/**/*.buildlog')
  archiveSettings.addFiles('Binaries/**/*.binlog')
25 26 27 28 29 30 31
  archiveSettings.excludeFiles('Binaries/Obj/**')
  archiveSettings.excludeFiles('Binaries/Bootstrap/**')
  archiveSettings.excludeFiles('Binaries/**/nuget*.zip')
  // Only archive if failed/aborted
  archiveSettings.setArchiveOnFailure()
  archiveSettings.setFailIfNothingArchived()
  Utilities.addArchival(myJob, archiveSettings)
32

33
  // Create the standard job.  This will setup parameter, SCM, timeout, etc ...
34
  def projectName = 'dotnet/roslyn'
35 36

  // Need to setup the triggers for the job
J
Jared Parsons 已提交
37
  if (isPr) {
38 39 40
    // Note the use of ' vs " for the 4th argument. We don't want groovy to interpolate this string (the ${ghprbPullId}
    // is resolved when the job is run based on an environment variable set by the Jenkins Pull Request Builder plugin.
    Utilities.standardJobSetupPR(myJob, projectName, null, '+refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*');
J
Jared Parsons 已提交
41 42 43 44
    def triggerCore = "open|all|${jobName}"
    if (triggerPhraseExtra) {
      triggerCore = "${triggerCore}|${triggerPhraseExtra}"
    }
45
    def triggerPhrase = "(?im)^\\s*(@?dotnet-bot\\,?\\s+)?(re)?test\\s+(${triggerCore})(\\s+please\\.?)?\\s*\$";
J
Jared Parsons 已提交
46 47
    def contextName = jobName
    Utilities.addGithubPRTriggerForBranch(myJob, branchName, contextName, triggerPhrase, triggerPhraseOnly)
48
  } else {
49
    Utilities.standardJobSetupPush(myJob, projectName, "*/${branchName}");
50
    Utilities.addGithubPushTrigger(myJob)
M
Matt Mitchell 已提交
51 52
    // TODO: Add once external email sending is available again
    // addEmailPublisher(myJob)
53 54 55
  }
}

T
Ty Overby 已提交
56
// True when this is a PR job, false for commit.  On feature branches we do PR jobs only.
J
Jared Parsons 已提交
57 58 59
def commitPullList = [false, true]
if (branchName.startsWith("features/")) {
  commitPullList = [true]
T
Ty Overby 已提交
60
}
J
Jared Parsons 已提交
61

62
// Windows Desktop CLR
T
Ty Overby 已提交
63
commitPullList.each { isPr ->
J
Jared Parsons 已提交
64
  ['debug', 'release'].each { configuration ->
65
        ['unit32', 'unit64'].each { buildTarget ->
J
Jared Parsons 已提交
66
      def jobName = Utilities.getFullJobName(projectName, "windows_${configuration}_${buildTarget}", isPr)
67
            def myJob = job(jobName) {
J
Jared Parsons 已提交
68
        description("Windows ${configuration} tests on ${buildTarget}")
69
                  steps {
J
Jared Parsons 已提交
70
                    batchFile(""".\\build\\scripts\\cibuild.cmd ${(configuration == 'debug') ? '-debug' : '-release'} ${(buildTarget == 'unit32') ? '-test32' : '-test64'} -testDesktop""")
71 72
                  }
                }
J
Jared Parsons 已提交
73

74
      def triggerPhraseOnly = false
J
Jared Parsons 已提交
75
      def triggerPhraseExtra = ""
T
Ty Overby 已提交
76
      Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
J
Jared Parsons 已提交
77 78
      Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
      addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
79 80 81 82 83 84 85 86 87 88 89
    }
  }
}

// Windows CoreCLR
commitPullList.each { isPr ->
  ['debug', 'release'].each { configuration ->
    def jobName = Utilities.getFullJobName(projectName, "windows_coreclr_test", isPr)
    def myJob = job(jobName) {
      description("Windows CoreCLR unit tests")
            steps {
J
Jared Parsons 已提交
90
              batchFile(""".\\build\\scripts\\cibuild.cmd ${(configuration == 'debug') ? '-debug' : '-release'} -testCoreClr""")
91
            }
92
    }
J
Jared Parsons 已提交
93 94 95

    def triggerPhraseOnly = false
    def triggerPhraseExtra = ""
T
Ty Overby 已提交
96
    Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
J
Jared Parsons 已提交
97 98
    Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
    addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
99
  }
J
Jared Parsons 已提交
100
}
101

A
Ashley Hauck 已提交
102
// Ubuntu 16.04
T
Ty Overby 已提交
103
commitPullList.each { isPr ->
A
Ashley Hauck 已提交
104
  def jobName = Utilities.getFullJobName(projectName, "ubuntu_16_debug", isPr)
J
Jared Parsons 已提交
105
  def myJob = job(jobName) {
A
Ashley Hauck 已提交
106
    description("Ubuntu 16.04 tests")
107
                  steps {
K
khyperia 已提交
108
                    shell("./build/scripts/cibuild.sh --debug")
109 110
                  }
                }
111

J
Jared Parsons 已提交
112
  def triggerPhraseOnly = false
J
Jared Parsons 已提交
113
  def triggerPhraseExtra = "linux"
A
Ashley Hauck 已提交
114
  Utilities.setMachineAffinity(myJob, 'Ubuntu16.04', 'latest-or-auto')
J
Jared Parsons 已提交
115
  Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
T
Ty Overby 已提交
116 117 118
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}

A
Ashley Hauck 已提交
119
// Ubuntu 16.04 mono
T
Ty Overby 已提交
120
commitPullList.each { isPr ->
A
Ashley Hauck 已提交
121
  def jobName = Utilities.getFullJobName(projectName, "ubuntu_16_mono_debug", isPr)
T
Ty Overby 已提交
122
  def myJob = job(jobName) {
A
Ashley Hauck 已提交
123
    description("Ubuntu 16.04 mono tests")
T
Ty Overby 已提交
124
                  steps {
A
Ashley Hauck 已提交
125
                    shell("./build/scripts/cibuild.sh --debug --mono")
T
Ty Overby 已提交
126 127 128 129 130 131 132
                  }
                }

  def triggerPhraseOnly = false
  def triggerPhraseExtra = "linux"
  Utilities.setMachineAffinity(myJob, 'Ubuntu16.04', 'latest-or-auto')
  Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
J
Jared Parsons 已提交
133 134 135 136
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}

// Mac
T
Ty Overby 已提交
137
commitPullList.each { isPr ->
J
Jared Parsons 已提交
138 139 140
  def jobName = Utilities.getFullJobName(projectName, "mac_debug", isPr)
  def myJob = job(jobName) {
    description("Mac tests")
141
    steps {
K
khyperia 已提交
142
      shell("./build/scripts/cibuild.sh --debug")
143 144
    }
  }
J
Jared Parsons 已提交
145 146

  def triggerPhraseOnly = true
J
Jared Parsons 已提交
147
  def triggerPhraseExtra = "mac"
148
  Utilities.setMachineAffinity(myJob, 'OSX10.12', 'latest-or-auto')
149
  Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
J
Jared Parsons 已提交
150
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
151
  }
J
Jared Parsons 已提交
152 153

// Determinism
T
Ty Overby 已提交
154
commitPullList.each { isPr ->
J
Jared Parsons 已提交
155 156 157
  def jobName = Utilities.getFullJobName(projectName, "windows_determinism", isPr)
  def myJob = job(jobName) {
    description('Determinism tests')
J
Jared Parsons 已提交
158
    steps {
J
Jared Parsons 已提交
159
      batchFile(""".\\build\\scripts\\cibuild.cmd -testDeterminism""")
160
    }
161
  }
162

J
Jared Parsons 已提交
163
  def triggerPhraseOnly = false
164
  def triggerPhraseExtra = "determinism"
T
Ty Overby 已提交
165
  Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
J
Jared Parsons 已提交
166 167 168 169
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}

// Build correctness tests
T
Ty Overby 已提交
170
commitPullList.each { isPr ->
J
Jared Parsons 已提交
171 172 173 174
  def jobName = Utilities.getFullJobName(projectName, "windows_build_correctness", isPr)
  def myJob = job(jobName) {
    description('Build correctness tests')
    steps {
J
Jared Parsons 已提交
175
      batchFile(""".\\build\\scripts\\cibuild.cmd -testBuildCorrectness""")
J
Jared Parsons 已提交
176 177 178
    }
  }

J
Jared Parsons 已提交
179
  def triggerPhraseOnly = false
J
Jared Parsons 已提交
180
  def triggerPhraseExtra = ""
T
Ty Overby 已提交
181
  Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
J
Jared Parsons 已提交
182
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
183
}
184 185 186 187 188 189 190

// Perf Correctness
commitPullList.each { isPr ->
  def jobName = Utilities.getFullJobName(projectName, "perf_correctness", isPr)
  def myJob = job(jobName) {
    description('perf test correctness')
    steps {
J
Jared Parsons 已提交
191
      batchFile(""".\\build\\scripts\\cibuild.cmd -testPerfCorrectness""")
192 193 194
    }
  }

195
  def triggerPhraseOnly = false
196
  def triggerPhraseExtra = "perf-correctness"
T
Ty Overby 已提交
197
  Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
198 199
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}
J
Jared Parsons 已提交
200 201 202 203 204 205 206 207 208 209 210 211 212

// Microbuild
commitPullList.each { isPr ->
  def jobName = Utilities.getFullJobName(projectName, "microbuild", isPr)
  def myJob = job(jobName) {
    description('MicroBuild test')
    steps {
      batchFile(""".\\src\\Tools\\MicroBuild\\cibuild.cmd""")
    }
  }

  def triggerPhraseOnly = false
  def triggerPhraseExtra = "microbuild"
T
Ty Overby 已提交
213
  Utilities.setMachineAffinity(myJob, 'Windows_NT', windowsUnitTestMachine)
J
Jared Parsons 已提交
214 215
  addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}
M
Matt Mitchell 已提交
216

217
// VS Integration Tests
218
commitPullList.each { isPr ->
219 220 221 222 223 224
  ['debug', 'release'].each { configuration ->
    ['vs-integration'].each { buildTarget ->
      def jobName = Utilities.getFullJobName(projectName, "windows_${configuration}_${buildTarget}", isPr)
      def myJob = job(jobName) {
        description("Windows ${configuration} tests on ${buildTarget}")
        steps {
J
Jared Parsons 已提交
225
          batchFile(""".\\build\\scripts\\cibuild.cmd ${(configuration == 'debug') ? '-debug' : '-release'} -testVsi""")
226 227 228
        }
      }

I
Ivan Basov 已提交
229 230
      def triggerPhraseOnly = false
      def triggerPhraseExtra = ""
231
      Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3')
232 233
      Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
      addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
234 235 236 237
    }
  }
}

M
Matt Mitchell 已提交
238 239 240 241 242 243
JobReport.Report.generateJobReport(out)

// Make the call to generate the help job
Utilities.createHelperJob(this, projectName, branchName,
    "Welcome to the ${projectName} Repository",  // This is prepended to the help message
    "Have a nice day!")  // This is appended to the help message.  You might put known issues here.