forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
167 lines (139 loc) · 6.99 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// Import the utility functionality.
import jobs.generation.Utilities;
// Grab the github project name passed in
def project = GithubProject
def msbuildTypeMap = [
'debug':'chk',
'test':'test',
'release':'fre'
]
def dailyRegex = 'dailies'
// ---------------
// HELPER CLOSURES
// ---------------
def CreateBuildTasks = { machine, configTag, buildExtra, testExtra, excludeConfigIf, nonDefaultTaskSetup ->
[true, false].each { isPR ->
['x86', 'x64', 'arm'].each { buildArch ->
['debug', 'test', 'release'].each { buildType ->
if (excludeConfigIf && excludeConfigIf(isPR, buildArch, buildType)) {
return // early exit: we don't want to create a job for this configuration
}
def config = "${buildArch}_${buildType}"
config = (configTag == null) ? config : "${configTag}_${config}"
// params: Project, BaseTaskName, IsPullRequest (appends '_prtest')
def jobName = Utilities.getFullJobName(project, config, isPR)
def testableConfig = buildType in ['debug', 'test'] && buildArch != 'arm'
def analysisConfig = buildType in ['release']
def buildScript = "call jenkins.buildone.cmd ${buildArch} ${buildType}"
buildScript += buildExtra ?: ''
buildScript += analysisConfig ? ' "/p:runcodeanalysis=true"' : ''
def testScript = "call jenkins.testone.cmd ${buildArch} ${buildType}"
testScript += testExtra ?: ''
def analysisScript = ".\\Build\\scripts\\check_prefast_error.ps1 . CodeAnalysis.err"
def newJob = job(jobName) {
// This opens the set of build steps that will be run.
// This looks strange, but it is actually a method call, with a
// closure as a param, since Groovy allows method calls without parens.
// (Compare with '.each' method used above.)
steps {
batchFile(buildScript) // run the parameter as if it were a batch file
if (testableConfig) {
batchFile(testScript)
}
if (analysisConfig) {
powerShell(analysisScript)
}
}
}
Utilities.setMachineAffinity(newJob, machine)
def msbuildType = msbuildTypeMap.get(buildType)
def msbuildFlavor = "build_${buildArch}${msbuildType}"
def archivalString = "test/${msbuildFlavor}.*,test/logs/**"
archivalString += analysisConfig ? ',CodeAnalysis.err' : ''
Utilities.addArchival(newJob, archivalString,
'', // no exclusions from archival
false, // doNotFailIfNothingArchived=false ~= failIfNothingArchived
false) // archiveOnlyIfSuccessful=false ~= archiveAlways
if (nonDefaultTaskSetup == null)
{
// This call performs remaining common job setup on the newly created job.
// This is used most commonly for simple inner loop testing.
// It does the following:
// 1. Sets up source control for the project.
// 2. Adds a push trigger if the job is a PR job
// 3. Adds a github PR trigger if the job is a PR job.
// The optional context (label that you see on github in the PR checks) is added.
// If not provided the context defaults to the job name.
// 4. Adds standard options for build retention and timeouts
// 5. Adds standard parameters for PR and push jobs.
// These allow PR jobs to be used for simple private testing, for instance.
// See the documentation for this function to see additional optional parameters.
Utilities.simpleInnerLoopJobSetup(newJob, project, isPR, "Windows ${config}")
}
else
{
Utilities.standardJobSetup(newJob, project, isPR)
nonDefaultTaskSetup(newJob, isPR, config)
}
}
}
}
}
def DailyBuildTaskSetup = { newJob, isPR, triggerName, groupRegex ->
// The addition of triggers makes the job non-default in GitHub.
if (isPR) {
def triggerRegex = "(${dailyRegex}|${groupRegex}|${triggerName})"
Utilities.addGithubPRTrigger(newJob,
triggerName, // GitHub task name
"(?i).*test\\W+${triggerRegex}.*")
} else {
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
def CreateStyleCheckTasks = { taskString, taskName, checkName ->
[true, false].each { isPR ->
def jobName = Utilities.getFullJobName(project, taskName, isPR)
def newJob = job(jobName) {
label('ubuntu')
steps {
shell(taskString)
}
}
Utilities.simpleInnerLoopJobSetup(newJob, project, isPR, checkName)
}
}
// ----------------
// INNER LOOP TASKS
// ----------------
CreateBuildTasks('Windows_NT', null, null, null, null, null)
// -----------------
// DAILY BUILD TASKS
// -----------------
// build and test on Windows 7 with VS 2013 (Dev12/MsBuild12)
CreateBuildTasks('Windows 7', 'daily_dev12', ' msbuild12', null,
/* excludeConfigIf */ { isPR, buildArch, buildType -> (buildArch == 'arm') },
/* nonDefaultTaskSetup */ { newJob, isPR, config ->
DailyBuildTaskSetup(newJob, isPR,
"Windows 7 ${config}",
'(win(dows)?\\s*7|(dev|msbuild)\\s*12)')})
// build and test on the usual configuration (VS 2015) with -includeSlow
CreateBuildTasks('Windows_NT', 'daily_slow', null, ' -includeSlow', null,
/* nonDefaultTaskSetup */ { newJob, isPR, config ->
DailyBuildTaskSetup(newJob, isPR,
"Windows ${config}",
'(slow\\s*(tests)?)')})
// build and test on the usual configuration (VS 2015) with JIT disabled
CreateBuildTasks('Windows_NT', 'daily_disablejit', ' "/p:BuildJIT=false"', ' -disablejit', null,
/* nonDefaultTaskSetup */ { newJob, isPR, config ->
DailyBuildTaskSetup(newJob, isPR,
"Windows ${config}",
'(disablejit|nojit)')})
// ----------------
// CODE STYLE TASKS
// ----------------
CreateStyleCheckTasks('./jenkins.check_eol.sh', 'ubuntu_check_eol', 'EOL Check')
CreateStyleCheckTasks('./jenkins.check_copyright.sh', 'ubuntu_check_copyright', 'Copyright Check')