forked from dotnet/corert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
103 lines (89 loc) · 4.43 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
// Import the utility functionality.
import jobs.generation.Utilities;
import jobs.generation.JobReport;
// The input project name (e.g. dotnet/coreclr)
def project = GithubProject
// The input branch name (e.g. master)
def branch = GithubBranchName
def imageVersionMap = ['Windows_NT':'latest-or-auto',
'OSX':'latest-or-auto',
'Ubuntu':'20170118']
// Innerloop build OS's
def osList = ['Ubuntu', 'OSX', 'Windows_NT']
// Generate the builds for debug and release, commit and PRJob
[true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
['Debug', 'Release'].each { configuration ->
osList.each { os ->
// Define build string
def lowercaseConfiguration = configuration.toLowerCase()
// Determine the name for the new job. The first parameter is the project,
// the second parameter is the base name for the job, and the last parameter
// is a boolean indicating whether the job will be a PR job. If true, the
// suffix _prtest will be appended.
def newJobName = Utilities.getFullJobName(project, lowercaseConfiguration + '_' + os.toLowerCase(), isPR)
def buildString = "";
def prJobDescription = "${os} ${configuration}";
if (configuration == 'Debug') {
prJobDescription += " and CoreCLR tests"
}
// Calculate the build commands
if (os == 'Windows_NT') {
buildString = "build.cmd ${lowercaseConfiguration}"
testScriptString = "tests\\runtest.cmd ${configuration} /coreclr "
}
else {
buildString = "./build.sh ${lowercaseConfiguration}"
testScriptString = "tests/runtest.sh ${configuration} -coreclr "
}
// Create a new job with the specified name. The brace opens a new closure
// and calls made within that closure apply to the newly created job.
def newJob = job(newJobName) {
// This opens the set of build steps that will be run.
steps {
if (os == 'Windows_NT') {
// Indicates that a batch script should be run with the build string (see above)
batchFile(buildString)
batchFile("tests\\runtest.cmd ${configuration} /multimodule")
if (configuration == 'Debug') {
if (isPR) {
// Run a small set of BVTs during PR validation
batchFile(testScriptString + "Top200")
}
else {
// Run the full set of known passing tests in the post-commit job
batchFile(testScriptString + "KnownGood")
}
}
}
else {
shell(buildString)
if (configuration == 'Debug') {
if (isPR) {
// Run a small set of BVTs during PR validation
shell(testScriptString + "top200")
}
else {
// Run the full set of known passing tests in the post-commit job
// Todo: Enable push test jobs once we establish a reasonable passing set of tests
// shell(testScriptString + "KnownGood")
}
}
}
}
}
// This call performs test run checks for the CI.
Utilities.addXUnitDotNETResults(newJob, '**/testResults.xml')
Utilities.setMachineAffinity(newJob, os, imageVersionMap[os])
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, prJobDescription)
}
else {
// Set a large timeout since the default (2 hours) is insufficient
Utilities.setJobTimeout(newJob, 1440)
Utilities.addGithubPushTrigger(newJob)
}
}
}
}
JobReport.Report.generateJobReport(out)