dotnet-installer/netci.groovy

68 lines
2.5 KiB
Groovy
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import the utility functionality.
import jobs.generation.Utilities;
2015-12-03 16:37:04 +00:00
def project = GithubProject
def branch = GithubBranchName
2016-02-22 23:15:56 +00:00
def osList = ['Ubuntu', 'OSX', 'Windows_NT', 'Windows_2016', 'CentOS7.1']
2015-10-21 18:24:23 +00:00
def static getBuildJobName(def configuration, def os) {
return configuration.toLowerCase() + '_' + os.toLowerCase()
}
2015-12-03 16:57:28 +00:00
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
osList.each { os ->
// Calculate names
def lowerConfiguration = configuration.toLowerCase()
// Calculate job name
def jobName = getBuildJobName(configuration, os)
def buildCommand = '';
// Calculate the build command
if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -Targets Default"
2016-02-16 20:04:13 +00:00
}
2016-02-22 23:15:56 +00:00
else if (os == 'Windows_2016') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker -Targets Default"
2016-02-22 23:15:56 +00:00
}
2016-02-16 20:04:13 +00:00
else if (os == 'Ubuntu') {
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --docker ubuntu --targets Default"
2015-12-03 16:57:28 +00:00
}
else {
2016-02-16 20:04:13 +00:00
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --targets Default"
2015-10-21 18:24:23 +00:00
}
2015-12-03 16:57:28 +00:00
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
2016-02-22 23:15:56 +00:00
if (os == 'Windows_NT' || os == 'Windows_2016') {
2015-12-03 16:57:28 +00:00
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
2015-10-21 18:24:23 +00:00
}
}
2016-02-09 00:17:00 +00:00
Utilities.setMachineAffinity(newJob, os, 'latest-or-auto')
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addXUnitDotNETResults(newJob, '**/*-testResults.xml')
2015-12-03 16:57:28 +00:00
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${configuration} Build")
2015-12-03 16:57:28 +00:00
}
else {
Utilities.addGithubPushTrigger(newJob)
}
}
}
2016-02-16 20:04:13 +00:00
}