dotnet-installer/netci.groovy

146 lines
5.1 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.ArchivalSettings;
import jobs.generation.Utilities;
2015-12-03 16:37:04 +00:00
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = [
'AllLinux:x64:Release',
'CentOS7.1:x64:Debug',
'Debian8.2:x64:Debug',
'fedora.27:x64:Debug',
'Linux:arm:Debug',
'Linux:arm64:Debug',
'Linux-musl:x64:Debug',
'Linux:x64:Release',
2018-07-31 22:06:02 +00:00
'Linux_NoSuffix:arm:Release',
'Linux_NoSuffix:x64:Release',
'OSX10.12:x64:Release',
'RHEL6:x64:Debug',
'RHEL7.2:x64:Release',
'Ubuntu:x64:Release',
'Ubuntu16.04:x64:Debug',
'ubuntu.18.04:x64:Debug',
'Windows_NT:x64:Release',
'Windows_NT:x86:Debug',
2018-07-31 22:06:02 +00:00
'Windows_NT_ES:x64:Debug',
'Windows_NT_NoSuffix:x64:Release'
]
def static getBuildJobName(def configuration, def os, def architecture) {
return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()
}
platformList.each { platform ->
// Calculate names
def (os, architecture, configuration) = platform.tokenize(':')
def osUsedForMachineAffinity = os;
def osVersionUsedForMachineAffinity = 'latest-or-auto';
2015-12-03 16:57:28 +00:00
// Calculate job name
def jobName = getBuildJobName(configuration, os, architecture)
2018-07-31 22:06:02 +00:00
def baseBatchBuildCommand = ".\\build.cmd -Configuration ${configuration} -Architecture ${architecture} -Targets Default";
def baseShellBuildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --targets Default";
// Calculate the build command
2018-07-31 22:06:02 +00:00
if (os.startsWith("Windows_NT")) {
osUsedForMachineAffinity = 'Windows_NT'
2018-07-31 22:06:02 +00:00
buildCommand = "${baseBatchBuildCommand}"
if (os == 'Windows_NT_ES') {
buildCommand = """
set DOTNET_CLI_UI_LANGUAGE=es
2018-07-31 22:06:02 +00:00
${buildCommand}
"""
}
else if (os == 'Windows_NT_NoSuffix') {
buildCommand = """
set DropSuffix=true
${buildCommand}
"""
2018-07-31 22:06:02 +00:00
}
}
2018-07-31 22:06:02 +00:00
else if (os == 'Windows_2016') {
buildCommand = "${baseBatchBuildCommand} -RunInstallerTestsInDocker"
}
2018-07-31 22:06:02 +00:00
else if (os.startsWith("Linux")) {
osUsedForMachineAffinity = 'Ubuntu16.04';
2018-07-31 22:06:02 +00:00
if (os == 'Linux-musl') {
buildCommand = "${baseShellBuildCommand} --runtime-id linux-musl-x64 --docker alpine.3.6"
}
2018-07-31 22:06:02 +00:00
else
{
buildCommand = "${baseShellBuildCommand} --linux-portable"
if ((architecture == 'arm') || (architecture == 'arm64')) {
buildCommand = "${buildCommand} --architecture ${architecture} /p:CLIBUILD_SKIP_TESTS=true"
}
if (os == 'Linux_NoSuffix') {
buildCommand = """
export DropSuffix=true
${buildCommand}
"""
}
}
}
2018-07-31 22:06:02 +00:00
else if (os == 'Ubuntu') {
buildCommand = "${baseShellBuildCommand} --docker ubuntu.14.04"
2017-10-10 16:08:06 +00:00
}
2018-07-31 22:06:02 +00:00
else if (os == 'RHEL6') {
osUsedForMachineAffinity = 'Ubuntu16.04';
2018-07-31 22:06:02 +00:00
buildCommand = "${baseShellBuildCommand} --runtime-id rhel.6-x64 --docker rhel.6"
}
2019-09-26 21:15:25 +00:00
else if (os == 'ubuntu.18.04' || os == 'fedora.27') {
osUsedForMachineAffinity = 'Ubuntu16.04'
osVersionUsedForMachineAffinity = 'latest-docker'
2018-07-31 22:06:02 +00:00
buildCommand = "${baseShellBuildCommand} --docker ${os} --linux-portable"
}
else if (os == 'AllLinux') {
osUsedForMachineAffinity = 'Ubuntu16.04'
2018-07-31 23:25:02 +00:00
buildCommand = "${baseShellBuildCommand} --skip-prereqs --configuration ${configuration} --targets Default /t:BuildAndPublishAllLinuxDistrosNativeInstallers"
}
else {
2018-07-31 22:06:02 +00:00
buildCommand = "${baseShellBuildCommand}"
}
2015-10-21 18:24:23 +00:00
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (osUsedForMachineAffinity == 'Windows_NT' || osUsedForMachineAffinity == 'Windows_2016') {
// Batch
batchFile(buildCommand)
2015-12-03 16:57:28 +00:00
}
else {
// Shell
shell(buildCommand)
2015-12-03 16:57:28 +00:00
}
}
}
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, osVersionUsedForMachineAffinity)
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
// ARM and AllLinux CI runs are build only.
if ((architecture != 'arm') && (architecture != 'arm64') && (os != 'AllLinux')) {
Utilities.addMSTestResults(newJob, '**/*.trx')
}
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build")
2018-07-31 22:06:02 +00:00
def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles("test/**/*.trx")
archiveSettings.addFiles("*.binlog")
archiveSettings.setFailIfNothingArchived()
archiveSettings.setArchiveOnFailure()
Utilities.addArchival(newJob, archiveSettings)
2016-02-16 20:04:13 +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.
Utilities.addCROSSCheck(this, project, branch)