forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
250 lines (206 loc) · 10.8 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
//-------------------------------------------------------------------------------------------------------
// 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'
]
// ----------------
// INNER LOOP TASKS
// ----------------
// 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
['x86', 'x64', 'arm'].each { buildArch -> // build these architectures
['debug', 'test', 'release'].each { buildType -> // build these configurations
def config = "${buildArch}_${buildType}"
// Determine the name for the new job.
// 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 += analysisConfig ? ' "/p:runcodeanalysis=true"' : ''
def testScript = "call jenkins.testone.cmd ${buildArch} ${buildType}"
def analysisScript = ".\\Build\\scripts\\check_prefast_error.ps1 . CodeAnalysis.err"
// 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(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 a batch script
if (testableConfig) {
// The test script will only run if the build is successful
// because Jenkins will notice the failure and stop before
// executing any more build tasks.
batchFile(testScript)
}
if (analysisConfig) {
// For release builds we want to run code analysis checks
powerShell(analysisScript)
}
}
}
Utilities.setMachineAffinity(newJob, 'Windows_NT') // Server 2012 R2
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
// 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}")
}
}
}
// -----------------
// DAILY BUILD TASKS
// -----------------
// build and test on Windows 7 with VS 2013 (Dev12/MsBuild12)
[true, false]. each { isPR ->
['x86', 'x64'].each { buildArch -> // we don't support ARM on Windows 7
['debug', 'test', 'release'].each { buildType ->
def config = "daily_${buildArch}_${buildType}"
def jobName = Utilities.getFullJobName(project, config, isPR)
def testableConfig = buildType in ['debug', 'test']
def analysisConfig = buildType in ['release']
def buildScript = "call jenkins.buildone.cmd ${buildArch} ${buildType} msbuild12"
buildScript += analysisConfig ? ' "/p:runcodeanalysis=true"' : ''
def testScript = "call jenkins.testone.cmd ${buildArch} ${buildType}"
def analysisScript = ".\\Build\\scripts\\check_prefast_error.ps1 . CodeAnalysis.err"
def newJob = job(jobName) {
steps {
batchFile(buildScript)
if (testableConfig) {
batchFile(testScript)
}
if (analysisConfig) {
powerShell(analysisScript)
}
}
}
Utilities.setMachineAffinity(newJob, "Windows 7")
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
Utilities.standardJobSetup(newJob, project, isPR)
if (isPR) {
// The addition of the trigger phrase will make the job "non-default" in Github.
def dailyRegex = '(dailies|dailys?)'
def groupRegex = '(win(dows)?\\s*7|(dev|msbuild)\\s*12)'
def triggerName = "Windows 7 ${config}"
def triggerRegex = "(${dailyRegex}|${groupRegex}|${triggerName})"
Utilities.addGithubPRTrigger(newJob,
triggerName, // GitHub task name
"(?i).*test\\W+${triggerRegex}.*")
} else {
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
}
}
// build and test on the usual configuration (VS 2015) with JIT disabled
[true, false]. each { isPR ->
['x86', 'x64', 'arm'].each { buildArch ->
['debug', 'test', 'release'].each { buildType ->
def config = "daily_disablejit_${buildArch}_${buildType}"
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 += ' "/p:BuildJIT=false"' // don't build JIT on this build task
buildScript += analysisConfig ? ' "/p:runcodeanalysis=true"' : ''
def testScript = "call jenkins.testone.cmd ${buildArch} ${buildType}"
testScript += ' -disablejit' // don't run tests which would require JIT to be built
def analysisScript = ".\\Build\\scripts\\check_prefast_error.ps1 . CodeAnalysis.err"
def newJob = job(jobName) {
steps {
batchFile(buildScript)
if (testableConfig) {
batchFile(testScript)
}
if (analysisConfig) {
powerShell(analysisScript)
}
}
}
Utilities.setMachineAffinity(newJob, "Windows_NT") // Server 2012 R2
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
Utilities.standardJobSetup(newJob, project, isPR)
if (isPR) {
// The addition of the trigger phrase will make the job "non-default" in Github.
def dailyRegex = '(dailies|dailys?)'
def groupRegex = '(disablejit|no(build)?jit|buildjit=false)'
def triggerName = "Windows ${config}"
def triggerRegex = "(${dailyRegex}|${groupRegex}|${triggerName})"
Utilities.addGithubPRTrigger(newJob,
triggerName, // GitHub task name
"(?i).*test\\W+${triggerRegex}.*")
} else {
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
}
}
// ----------------
// CODE STYLE TASKS
// ----------------
// Create a job to check that no mixed line endings have been introduced.
// Note: it is not necessary to run this job daily.
[true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
def jobName = Utilities.getFullJobName(project, 'ubuntu_check_eol', isPR)
def taskString = './jenkins.check_eol.sh'
def newJob = job(jobName) {
label('ubuntu')
steps {
shell(taskString)
}
}
Utilities.simpleInnerLoopJobSetup(newJob, project, isPR, "EOL Check")
}
// Create a job to check that all source files have the correct Microsoft copyright notice.
// Note: it is not necessary to run this job daily.
[true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
def jobName = Utilities.getFullJobName(project, 'ubuntu_check_copyright', isPR)
def taskString = './jenkins.check_copyright.sh'
def newJob = job(jobName) {
label('ubuntu')
steps {
shell(taskString)
}
}
Utilities.simpleInnerLoopJobSetup(newJob, project, isPR, "Copyright Check")
}