2015-11-16 19:21:57 +00:00
|
|
|
// 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.
|
|
|
|
|
2015-10-08 23:07:36 +00:00
|
|
|
// Import the utility functionality.
|
|
|
|
|
|
|
|
import jobs.generation.Utilities;
|
|
|
|
|
2015-12-03 16:37:04 +00:00
|
|
|
def project = GithubProject
|
2016-02-12 17:11:20 +00:00
|
|
|
def branch = GithubBranchName
|
2016-03-11 22:32:36 +00:00
|
|
|
def isPR = true
|
2015-10-08 23:07:36 +00:00
|
|
|
|
2018-03-25 19:48:16 +00:00
|
|
|
def platformList = ['Linux:x64:Release', 'Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Debug', 'OSX10.12:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT_ES:x64:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug', 'RHEL6:x64:Debug', 'Alpine3.6:x64:Debug', 'Linux:arm:Debug', 'Linux:arm64:Debug']
|
2015-10-08 23:07:36 +00:00
|
|
|
|
2016-03-11 22:32:36 +00:00
|
|
|
def static getBuildJobName(def configuration, def os, def architecture) {
|
|
|
|
return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()
|
2015-10-08 23:07:36 +00:00
|
|
|
}
|
|
|
|
|
2015-12-03 16:57:28 +00:00
|
|
|
|
2016-03-11 22:32:36 +00:00
|
|
|
platformList.each { platform ->
|
|
|
|
// Calculate names
|
|
|
|
def (os, architecture, configuration) = platform.tokenize(':')
|
2017-03-09 19:02:14 +00:00
|
|
|
def osUsedForMachineAffinity = os;
|
2015-12-03 16:57:28 +00:00
|
|
|
|
2016-03-11 22:32:36 +00:00
|
|
|
// Calculate job name
|
|
|
|
def jobName = getBuildJobName(configuration, os, architecture)
|
|
|
|
def buildCommand = '';
|
2015-10-23 00:41:39 +00:00
|
|
|
|
2016-03-11 22:32:36 +00:00
|
|
|
// Calculate the build command
|
|
|
|
if (os == 'Windows_NT') {
|
|
|
|
buildCommand = ".\\build.cmd -Configuration ${configuration} -Architecture ${architecture} -Targets Default"
|
|
|
|
}
|
|
|
|
else if (os == 'Windows_2016') {
|
|
|
|
buildCommand = ".\\build.cmd -Configuration ${configuration} -Architecture ${architecture} -RunInstallerTestsInDocker -Targets Default"
|
|
|
|
}
|
2017-09-06 23:12:31 +00:00
|
|
|
else if (os == 'Windows_NT_ES') {
|
|
|
|
osUsedForMachineAffinity = 'Windows_NT'
|
|
|
|
buildCommand = """
|
|
|
|
set DOTNET_CLI_UI_LANGUAGE=es
|
|
|
|
.\\build.cmd -Configuration ${configuration} -Architecture ${architecture} -Targets Default
|
|
|
|
"""
|
|
|
|
}
|
2016-03-11 22:32:36 +00:00
|
|
|
else if (os == 'Ubuntu') {
|
2016-06-01 23:44:26 +00:00
|
|
|
buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --docker ubuntu.14.04 --targets Default"
|
2016-03-11 22:32:36 +00:00
|
|
|
}
|
2017-03-09 19:02:14 +00:00
|
|
|
else if (os == 'Linux') {
|
|
|
|
osUsedForMachineAffinity = 'Ubuntu16.04';
|
2018-03-25 19:48:16 +00:00
|
|
|
if ((architecture == 'arm') || (architecture == 'arm64')) {
|
2018-03-15 02:04:25 +00:00
|
|
|
buildCommand = "./build.sh --linux-portable --skip-prereqs --architecture ${architecture} --configuration ${configuration} --targets Default /p:CLIBUILD_SKIP_TESTS=true"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
buildCommand = "./build.sh --linux-portable --skip-prereqs --configuration ${configuration} --targets Default"
|
|
|
|
}
|
2017-03-09 19:02:14 +00:00
|
|
|
}
|
2017-10-10 16:08:06 +00:00
|
|
|
else if (os == 'RHEL6') {
|
|
|
|
osUsedForMachineAffinity = 'Ubuntu16.04';
|
2017-10-10 18:00:12 +00:00
|
|
|
buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --runtime-id rhel.6-x64 --docker rhel.6 --targets Default"
|
2017-10-10 16:08:06 +00:00
|
|
|
}
|
2017-11-29 16:03:48 +00:00
|
|
|
else if (os == 'Alpine3.6') {
|
|
|
|
osUsedForMachineAffinity = 'Ubuntu16.04';
|
|
|
|
buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --runtime-id alpine.3.6-x64 --docker alpine.3.6 --targets Default"
|
|
|
|
}
|
2016-03-11 22:32:36 +00:00
|
|
|
else {
|
|
|
|
// Jenkins non-Ubuntu CI machines don't have docker
|
|
|
|
buildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --targets Default"
|
|
|
|
}
|
2015-10-21 18:24:23 +00:00
|
|
|
|
2016-03-11 22:32:36 +00:00
|
|
|
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
|
|
|
|
// Set the label.
|
|
|
|
steps {
|
2017-09-06 23:12:31 +00:00
|
|
|
if (osUsedForMachineAffinity == 'Windows_NT' || osUsedForMachineAffinity == 'Windows_2016') {
|
2016-03-11 22:32:36 +00:00
|
|
|
// Batch
|
|
|
|
batchFile(buildCommand)
|
2015-12-03 16:57:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2016-03-11 22:32:36 +00:00
|
|
|
// Shell
|
|
|
|
shell(buildCommand)
|
2015-12-03 16:57:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-03-11 22:32:36 +00:00
|
|
|
|
2017-03-09 19:02:14 +00:00
|
|
|
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, 'latest-or-auto')
|
2016-03-11 22:32:36 +00:00
|
|
|
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
|
2018-03-15 19:30:11 +00:00
|
|
|
// ARM CI runs are build only.
|
2018-03-25 19:48:16 +00:00
|
|
|
if ((architecture != 'arm') && (architecture != 'arm64')) {
|
2018-03-15 19:30:11 +00:00
|
|
|
Utilities.addMSTestResults(newJob, '**/*.trx')
|
|
|
|
}
|
2016-03-11 22:32:36 +00:00
|
|
|
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build")
|
2016-02-16 20:04:13 +00:00
|
|
|
}
|
2016-03-11 22:32:36 +00:00
|
|
|
|
2017-03-30 10:40:03 +00:00
|
|
|
// Make the call to generate the help job
|
|
|
|
Utilities.createHelperJob(this, project, branch,
|
|
|
|
"Welcome to the ${project} 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.
|
2017-05-15 18:47:42 +00:00
|
|
|
|
|
|
|
Utilities.addCROSSCheck(this, project, branch)
|