forked from dotnet/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
149 lines (135 loc) · 5.14 KB
/
netci.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// 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;
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = [
'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',
'Linux_NoSuffix:arm:Release',
'Linux_NoSuffix:x64:Release',
'opensuse.42.3:x64:Debug',
'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',
'Windows_NT_ES:x64:Debug',
'Windows_NT_NoSuffix:x64:Release',
'Windows_NT:arm:Debug'
]
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';
// Calculate job name
def jobName = getBuildJobName(configuration, os, architecture)
def baseBatchBuildCommand = ".\\build.cmd -Configuration ${configuration} -Architecture ${architecture} -Targets Default";
def baseShellBuildCommand = "./build.sh --skip-prereqs --configuration ${configuration} --targets Default";
// Calculate the build command
if (os.startsWith("Windows_NT")) {
osUsedForMachineAffinity = 'windows.10.amd64.clientrs4.devex.15.8.open'
buildCommand = "${baseBatchBuildCommand}"
if (os == 'Windows_NT_ES') {
buildCommand = """
set DOTNET_CLI_UI_LANGUAGE=es
${buildCommand}
"""
}
else if (os == 'Windows_NT_NoSuffix') {
buildCommand = """
set DropSuffix=true
${buildCommand}
"""
}
if (architecture == "arm") {
buildCommand = """${buildCommand} /p:CLIBUILD_SKIP_TESTS=true"""
}
}
else if (os == 'Windows_2016') {
buildCommand = "${baseBatchBuildCommand} -RunInstallerTestsInDocker"
}
else if (os.startsWith("Linux")) {
osUsedForMachineAffinity = 'Ubuntu16.04';
if (os == 'Linux-musl') {
buildCommand = "${baseShellBuildCommand} --runtime-id linux-musl-x64 --docker alpine.3.6"
}
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}
"""
}
}
}
else if (os == 'Ubuntu') {
buildCommand = "${baseShellBuildCommand} --docker ubuntu.14.04"
}
else if (os == 'RHEL6') {
osUsedForMachineAffinity = 'Ubuntu16.04';
buildCommand = "${baseShellBuildCommand} --runtime-id rhel.6-x64 --docker rhel.6"
}
else if (os == 'ubuntu.18.04' || os == 'fedora.27' || os == 'opensuse.42.3') {
osUsedForMachineAffinity = 'Ubuntu16.04'
osVersionUsedForMachineAffinity = 'latest-docker'
buildCommand = "${baseShellBuildCommand} --docker ${os} --linux-portable"
}
else {
buildCommand = "${baseShellBuildCommand}"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (osUsedForMachineAffinity == 'windows.10.amd64.clientrs4.devex.15.8.open' || osUsedForMachineAffinity == 'Windows_2016') {
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
}
if (os.startsWith("Windows_NT")) {
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity)
} else {
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, osVersionUsedForMachineAffinity)
}
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
// ARM CI runs are build only.
if ((architecture != 'arm') && (architecture != 'arm64')) {
Utilities.addMSTestResults(newJob, '**/*.trx')
}
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build")
def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles("test/**/*.trx")
archiveSettings.setFailIfNothingArchived()
archiveSettings.setArchiveOnFailure()
Utilities.addArchival(newJob, archiveSettings)
}
// 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)