forked from dotnet/corefx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
323 lines (277 loc) · 13.9 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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// Import the utility functionality.
import jobs.generation.Utilities;
def project = GithubProject
// Globals
// Map of os -> osGroup.
def osGroupMap = ['Ubuntu':'Linux',
'OSX':'OSX',
'Windows_NT':'Windows_NT',
'FreeBSD':'FreeBSD',
'CentOS7.1': 'Linux',
'OpenSUSE13.2': 'Linux']
// Map of os -> nuget runtime
def targetNugetRuntimeMap = ['OSX' : 'osx.10.10-x64',
'Ubuntu' : 'ubuntu.14.04-x64',
'FreeBSD' : 'ubuntu.14.04-x64',
'CentOS7.1' : 'ubuntu.14.04-x64',
'OpenSUSE13.2' : 'ubuntu.14.04-x64']
// **************************
// Define code coverage build
// **************************
[true, false].each { isPR ->
def newJob = job(Utilities.getFullJobName(project, 'code_coverage_windows', isPR)) {
steps {
batchFile('call "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat" && build.cmd /p:Coverage=true')
}
}
// Set up standard options
Utilities.standardJobSetup(newJob, project, isPR)
// Set the machine affinity to windows machines
Utilities.setMachineAffinity(newJob, 'Windows_NT')
// Publish reports
Utilities.addHtmlPublisher(newJob, 'bin/tests/coverage', 'Code Coverage Report', 'index.htm')
// Archive results.
Utilities.addArchival(newJob, '**/coverage/*,msbuild.log')
// Set triggers
if (isPR) {
// Set PR trigger
Utilities.addGithubPRTrigger(newJob, 'Code Coverage Windows Debug', '(?i).*test\\W+code\\W+coverage.*')
}
else {
// Set a periodic trigger
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
// **************************
// Define code formatter check build
// **************************
[true, false].each { isPR ->
def newJob = job(Utilities.getFullJobName(project, 'native_code_format_check', isPR)) {
steps {
shell('python src/Native/format-code.py checkonly')
}
}
// Set up standard options.
Utilities.standardJobSetup(newJob, project, isPR)
// Set the machine affinity to Ubuntu machines
Utilities.setMachineAffinity(newJob, 'Ubuntu')
if (isPR) {
// Set PR trigger. Only trigger when the phrase is said.
Utilities.addGithubPRTrigger(newJob, 'Code Formatter Check', '(?i).*test\\W+code\\W+formatter\\W+check.*', true)
}
else {
// Set a push trigger
Utilities.addGithubPushTrigger(newJob)
}
}
// **************************
// Define outerloop windows testing. Run locally on each machine.
// **************************
def osShortName = ['Windows 10': 'win10', 'Windows 7' : 'win7', 'Windows_NT' : 'windows_nt']
[true, false].each { isPR ->
['Windows 10', 'Windows 7', 'Windows_NT'].each { os ->
['Debug', 'Release'].each { configuration ->
def newJobName = "outerloop_${osShortName[os]}_${configuration.toLowerCase()}"
def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) {
steps {
batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && Build.cmd /p:Configuration=${configuration} /p:WithCategories=\"InnerLoop;OuterLoop\" /p:TestWithLocalLibraries=true")
}
}
// Set the affinity. OS name matches the machine affinity.
Utilities.setMachineAffinity(newJob, os)
// Set up standard options.
Utilities.standardJobSetup(newJob, project, isPR)
// Add the unit test results
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
// Set up appropriate triggers. PR on demand, otherwise nightly
if (isPR) {
// Set PR trigger.
// TODO: More elaborate regex trigger?
Utilities.addGithubPRTrigger(newJob, "OuterLoop ${os} ${configuration}", "(?i).*test\\W+outerloop.*")
}
else {
// Set a periodic trigger
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
}
}
// Here are the OS's that needs separate builds and tests.
// We create a build for the native compilation, a build for the build of corefx itself (on Windows)
// and then a build for the test of corefx on the target platform. Then we link them with a build
// flow job.
def innerLoopNonWindowsOSs = ['Ubuntu', 'OSX', 'FreeBSD', 'CentOS7.1', 'OpenSUSE13.2']
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
innerLoopNonWindowsOSs.each { os ->
def osGroup = osGroupMap[os]
//
// First define the nativecomp build
//
def newNativeCompBuildJobName = "nativecomp_${os.toLowerCase()}_${configuration.toLowerCase()}"
def newNativeCompJob = job(Utilities.getFullJobName(project, newNativeCompBuildJobName, isPR)) {
steps {
shell("./build.sh native x64 ${configuration.toLowerCase()}")
}
}
// Set the affinity. All of these run on Windows currently.
Utilities.setMachineAffinity(newNativeCompJob, os)
// Set up standard options.
Utilities.standardJobSetup(newNativeCompJob, project, isPR)
// Add archival for the built data.
Utilities.addArchival(newNativeCompJob, "bin/**")
//
// First we set up a build job that builds the corefx repo on Windows
//
def newBuildJobName = "${os.toLowerCase()}_${configuration.toLowerCase()}_bld"
def newBuildJob = job(Utilities.getFullJobName(project, newBuildJobName, isPR)) {
steps {
batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd /p:Configuration=${configuration} /p:OSGroup=${osGroup} /p:SkipTests=true /p:TestNugetRuntimeId=${targetNugetRuntimeMap[os]}")
// Package up the results.
batchFile("C:\\Packer\\Packer.exe .\\bin\\build.pack .\\bin")
}
}
// Set the affinity. All of these run on Windows currently.
Utilities.setMachineAffinity(newBuildJob, 'Windows_NT')
// Set up standard options.
Utilities.standardJobSetup(newBuildJob, project, isPR)
// Archive the results
Utilities.addArchival(newBuildJob, "bin/build.pack,bin/osGroup.AnyCPU.${configuration}/**,bin/ref/**,bin/packages/**,msbuild.log")
//
// Then we set up a job that runs the test on the target OS
//
def fullNativeCompBuildJobName = Utilities.getFolderName(project) + '/' + newNativeCompJob.name
def fullCoreFXBuildJobName = Utilities.getFolderName(project) + '/' + newBuildJob.name
def newTestJobName = "${os.toLowerCase()}_${configuration.toLowerCase()}_tst"
def newTestJob = job(Utilities.getFullJobName(project, newTestJobName, isPR)) {
steps {
// Copy data from other builds.
// TODO: Add a new job or allow for copying coreclr from debug build
// CoreCLR
copyArtifacts("dotnet_coreclr/release_${os.toLowerCase()}") {
excludePatterns('**/testResults.xml', '**/*.ni.dll')
buildSelector {
latestSuccessful(true)
}
}
// MSCorlib
copyArtifacts("dotnet_coreclr/release_windows_nt") {
includePatterns("bin/Product/${osGroup}*/**")
excludePatterns('**/testResults.xml', '**/*.ni.dll')
buildSelector {
latestSuccessful(true)
}
}
// Native components
copyArtifacts(fullNativeCompBuildJobName) {
includePatterns("bin/**")
buildSelector {
buildNumber('\${COREFX_NATIVECOMP_BUILD}')
}
}
// The tests/corefx components
copyArtifacts(fullCoreFXBuildJobName) {
includePatterns('bin/build.pack')
buildSelector {
buildNumber('\${COREFX_BUILD}')
}
}
// Unpack the build data
shell("unpacker ./bin/build.pack ./bin")
// Export the LTTNG environment variable and then run the tests
shell("""export LTTNG_HOME=/home/dotnet-bot
./run-test.sh \\
--configuration ${configuration} \\
--os ${osGroup} \\
--corefx-tests \${WORKSPACE}/bin/tests/${osGroup}.AnyCPU.${configuration} \\
--coreclr-bins \${WORKSPACE}/bin/Product/${osGroup}.x64.Release/ \\
--mscorlib-bins \${WORKSPACE}/bin/Product/${osGroup}.x64.Release/
""")
}
// Add parameters for the input jobs
parameters {
stringParam('COREFX_BUILD', '', 'Build number to copy CoreFX test binaries from')
stringParam('COREFX_NATIVECOMP_BUILD', '', 'Build number to copy CoreFX native components from')
}
}
// Set the affinity. All of these run on the target
Utilities.setMachineAffinity(newTestJob, os)
// Set up standard options.
Utilities.standardJobSetup(newTestJob, project, isPR)
// Add the unit test results
Utilities.addXUnitDotNETResults(newTestJob, '**/testResults.xml')
//
// Then we set up a flow job that runs the build and the nativecomp build in parallel and then executes.
// the test job
//
def fullCoreFXTestJobName = Utilities.getFolderName(project) + '/' + newTestJob.name
def flowJobName = "${os.toLowerCase()}_${configuration.toLowerCase()}"
def newFlowJob = buildFlowJob(Utilities.getFullJobName(project, flowJobName, isPR)) {
buildFlow("""
parallel (
{ nativeCompBuild = build(params, '${fullNativeCompBuildJobName}') },
{ coreFXBuild = build(params, '${fullCoreFXBuildJobName}') }
)
// Then run the test job
build(params +
[COREFX_BUILD: coreFXBuild.build.number,
COREFX_NATIVECOMP_BUILD : nativeCompBuild.build.number], '${fullCoreFXTestJobName}')
""")
// Needs a workspace
configure {
def buildNeedsWorkspace = it / 'buildNeedsWorkspace'
buildNeedsWorkspace.setValue('true')
}
}
// Set the affinity. All of these run on the target
Utilities.setMachineAffinity(newFlowJob, os)
// Set up standard options.
Utilities.standardJobSetup(newFlowJob, project, isPR)
// Set up triggers
if (isPR) {
// Set PR trigger.
// Set of OS's that work currently.
if (os in ['Ubuntu', 'OSX', 'OpenSUSE13.2']) {
Utilities.addGithubPRTrigger(newFlowJob, "Innerloop ${os} ${configuration} Build and Test")
}
}
else {
// Set a push trigger
Utilities.addGithubPushTrigger(newFlowJob)
}
}
}
}
// Generate the build and test versions for Windows_NT. When full build/run is supported on a platform, those platforms
// could be removed from above and then added in below.
def supportedFullCyclePlatforms = ['Windows_NT']
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
supportedFullCyclePlatforms.each { osGroup ->
def newJobName = "${osGroup.toLowerCase()}_${configuration.toLowerCase()}"
def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) {
steps {
batchFile("call \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat\" x86 && build.cmd /p:Configuration=${configuration} /p:OSGroup=${osGroup}")
batchFile("C:\\Packer\\Packer.exe .\\bin\\build.pack .\\bin")
}
}
// Set the affinity. All of these run on Windows currently.
Utilities.setMachineAffinity(newJob, osGroup)
// Set up standard options.
Utilities.standardJobSetup(newJob, project, isPR)
// Add the unit test results
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
// Add archival for the built data.
Utilities.addArchival(newJob, "bin/build.pack,bin/${osGroup}.AnyCPU.Debug/**,bin/ref/**,bin/packages/**,msbuild.log")
// Set up triggers
if (isPR) {
// Set PR trigger.
Utilities.addGithubPRTrigger(newJob, "Innerloop ${osGroup} ${configuration} Build and Test")
}
else {
// Set a push trigger
Utilities.addGithubPushTrigger(newJob)
}
}
}
}