forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
300 lines (249 loc) · 11.4 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
// Import the utility functionality.
import jobs.generation.Utilities;
def project = 'dotnet/wcf'
// Utility to move into dotnet-ci eventually
// **************************
// Define the basic inner loop builds for PR
// **************************
// Create the test only builds for Linux
// The test only build utilizes the artifacts from other jobs
// as well as an upstream job in order to execute the runs on Linux.
// Create one for PR and one for Regular
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
def configurationJobName = configuration.toLowerCase()
def jobName = "linux_${configurationJobName}_tst"
def linuxTestJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
label('ubuntu')
parameters {
stringParam('WCF_LINUX_BUILD_NUMBER', '', 'Build number to copy WCF Linux build artifacts from')
}
steps {
// Copy artifacts from all of the required upstream jobs
copyArtifacts('dotnet_coreclr/release_ubuntu') {
excludePatterns('**/testResults.xml', '**/*.ni.dll')
buildSelector {
latestSuccessful(true)
}
targetDirectory('coreclr')
}
copyArtifacts('dotnet_coreclr/release_windows_nt') {
includePatterns('bin/Product/Linux*/**')
excludePatterns('**/testResults.xml', '**/*.ni.dll')
buildSelector {
latestSuccessful(true)
}
targetDirectory('coreclr')
}
copyArtifacts('dotnet_corefx_linux_nativecomp_debug') {
includePatterns('bin/**')
buildSelector {
latestSuccessful(true)
}
targetDirectory('corefx')
}
copyArtifacts('dotnet_corefx_linux_debug') {
excludePatterns('**/testResults.xml', '**/*.ni.dll')
buildSelector {
latestSuccessful(true)
}
targetDirectory('corefx')
}
// The input WCF build is specified by parameter. See below for the flow job
// that triggers the Linux build, then passes that build result to this build.
// Upstream job is the PR test job. Note we need the fully qualified job name
// in order to copy artifacts.
def linuxBuildName = Utilities.getFolderName(project) + '/' +
Utilities.getFullJobName(project, "linux_${configurationJobName}_bld", isPR)
copyArtifacts(linuxBuildName) {
includePatterns('bin/**')
buildSelector {
buildNumber('${WCF_LINUX_BUILD_NUMBER}')
}
}
shell("""
./run-test.sh --coreclr-bins \${WORKSPACE}/coreclr/bin/Product/Linux.x64.Release \\
--mscorlib-bins \${WORKSPACE}/coreclr/bin/Product/Linux.x64.Release \\
--corefx-bins \${WORKSPACE}/corefx/bin/Linux.AnyCPU.Debug/ \\
--corefx-native-bins \${WORKSPACE}/corefx/bin/Linux.x64.Debug/Native \\
--wcf-bins \${WORKSPACE}/bin/Linux.AnyCPU.${configuration} \\
--wcf-tests \${WORKSPACE}/bin/tests/Linux.AnyCPU.${configuration}""")
}
}
// Finish off the job with the usual options
if (isPR) {
Utilities.addPRTestSCM(linuxTestJob, project)
Utilities.addStandardPRParameters(linuxTestJob, project)
}
else {
Utilities.addScm(linuxTestJob, project)
Utilities.addStandardNonPRParameters(linuxTestJob)
}
Utilities.addStandardOptions(linuxTestJob)
Utilities.addXUnitDotNETResults(linuxTestJob, 'bin/tests/**/testResults.xml')
}
}
// Loop over the options and build up the innerloop build matrix.
// When we go to create the Linux build, in addition to creating the regular job,
// we should create a flow job that launches the build on Windows, followed by the
// test on Linux, passing the build parameter to the linux test job. Then, instead
// of adding the PR/commit triggers to the build job, we should add it to the flow job.
['Debug', 'Release'].each { configuration ->
['Linux', 'Windows_NT'].each { os ->
// Calculate job name
def osJobName = os.toLowerCase()
if (osJobName == 'windows_nt') {
osJobName = 'windows'
}
def configurationJobName = configuration.toLowerCase()
def jobName = "${osJobName}_${configurationJobName}"
// The flow job name will be free of the suffix below
def flowJobName = jobName
// If Linux, append _bld to the end.
if (os == 'Linux') {
jobName += '_bld'
}
// Create the new job
def newCommitJob = job(Utilities.getFullJobName(project, jobName, false)) {
label('windows')
steps {
// Use inline replacement
batchFile("build.cmd /p:Configuration=${configuration} /p:OSGroup=${os}")
}
}
// Add commit job options
Utilities.addScm(newCommitJob, project)
Utilities.addStandardNonPRParameters(newCommitJob)
// Don't add the push trigger if on Linux, since we'll run it through the
// flow job defined below
if (os != 'Linux') {
Utilities.addGithubPushTrigger(newCommitJob)
}
// Create the new PR job
def newPRJob = job(Utilities.getFullJobName(project, jobName, true)) {
label('windows')
steps {
// Use inline replacement
batchFile("build.cmd /p:Configuration=${configuration} /p:OSGroup=${os}")
}
}
// Add a PR trigger
if (os != 'Linux') {
Utilities.addGithubPRTrigger(newPRJob, "${os} ${configuration} Build")
}
Utilities.addPRTestSCM(newPRJob, project)
Utilities.addStandardPRParameters(newPRJob, project)
// Add common options:
[newPRJob, newCommitJob].each { newJob ->
Utilities.addStandardOptions(newJob)
if (os != 'Linux') {
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
Utilities.addArchival(newJob, "bin/${os}.AnyCPU.${configuration}/**")
} else {
// Include the tests on Linux, since they'll be moved to another
// machine for execution
Utilities.addArchival(newJob, "bin/${os}.AnyCPU.${configuration}/**,bin/tests/**")
}
}
}
}
// Add flow jobs for Linux bld/tst
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
def configurationJobName = configuration.toLowerCase()
def jobName = "linux_${configurationJobName}"
def linuxFlowJob = buildFlowJob(Utilities.getFullJobName(project, jobName, isPR)) {
def buildJobName = Utilities.getFolderName(project) + '/' + Utilities.getFullJobName(project, jobName + '_bld', isPR)
def testJobName = Utilities.getFolderName(project) + '/' + Utilities.getFullJobName(project, jobName + '_tst', isPR)
buildFlow("""
// Build the Linux _bld job
def linuxBuildJob = build(params, \"${buildJobName}\")
// Pass this to the test job. Include the parameters
build(params + [WCF_LINUX_BUILD_NUMBER: linuxBuildJob.build.number],
\"${testJobName}\")
""")
// Needs a workspace
configure {
def buildNeedsWorkspace = it / 'buildNeedsWorkspace'
buildNeedsWorkspace.setValue('true')
}
}
if (isPR) {
Utilities.addPRTestSCM(linuxFlowJob, project)
Utilities.addStandardPRParameters(linuxFlowJob, project)
Utilities.addGithubPRTrigger(linuxFlowJob, "Linux ${configuration} Build and Test")
}
else {
Utilities.addScm(linuxFlowJob, project)
Utilities.addStandardNonPRParameters(linuxFlowJob)
Utilities.addGithubPushTrigger(linuxFlowJob)
}
Utilities.addStandardOptions(linuxFlowJob)
}
}
// **************************
// Define the code coverage jobs
// **************************
// Define build string
def codeCoverageBuildString = '''build.cmd /p:Coverage=true /p:WithCategories=OuterLoop'''
// Generate a rolling (12 hr job) and a PR job that can be run on demand
def rollingCCJob = job(Utilities.getFullJobName(project, 'code_coverage_windows', false)) {
label('windows-elevated')
steps {
batchFile(codeCoverageBuildString)
}
}
def prCCJob = job(Utilities.getFullJobName(project, 'code_coverage_windows', true)) {
label('windows-elevated')
steps {
batchFile(codeCoverageBuildString)
}
}
// For both jobs, archive the coverage info and publish an HTML report
[rollingCCJob, prCCJob].each { newJob ->
Utilities.addHtmlPublisher(newJob, 'bin/tests/coverage', 'Code Coverage Report', 'index.htm')
Utilities.addArchival(newJob, '**/coverage/*,msbuild.log')
}
Utilities.addScm(rollingCCJob, project)
Utilities.addStandardOptions(rollingCCJob)
Utilities.addStandardNonPRParameters(rollingCCJob)
Utilities.addPeriodicTrigger(rollingCCJob, '@daily')
Utilities.addPRTestSCM(prCCJob, project)
Utilities.addStandardOptions(prCCJob)
Utilities.addStandardPRParameters(prCCJob, project)
Utilities.addGithubPRTrigger(prCCJob, 'Code Coverage Windows Debug', '@dotnet-bot test code coverage please')
// **************************
// Outerloop. Rolling every 4 hours for debug and release
// **************************
['Debug', 'Release'].each { configuration ->
def configurationJobName = configuration.toLowerCase()
def jobName = "outerloop_windows_${configurationJobName}"
// Create the new rolling job
def newRollingJob = job(Utilities.getFullJobName(project, jobName, false)) {
label('windows-elevated')
steps {
batchFile("build.cmd /p:Configuration=${configuration} /p:WithCategories=OuterLoop")
}
}
// Add commit job options
Utilities.addScm(newRollingJob, project)
Utilities.addStandardNonPRParameters(newRollingJob)
Utilities.addPeriodicTrigger(newRollingJob, 'H H/4 * * *')
// Create the new PR job for on demand execution. No automatic PR trigger.
// Triggered with '@dotnet-bot test outerloop please'
def newPRJob = job(Utilities.getFullJobName(project, jobName, true)) {
label('windows-elevated')
steps {
batchFile("build.cmd /p:Configuration=${configuration} /p:WithCategories=OuterLoop")
}
}
// Add a PR trigger
Utilities.addGithubPRTrigger(newPRJob, "Outerloop Windows ${configuration} Build", '@dotnet-bot test outerloop please')
Utilities.addPRTestSCM(newPRJob, project)
Utilities.addStandardPRParameters(newPRJob, project)
// Add common options
[newPRJob, newRollingJob].each { newJob ->
Utilities.addStandardOptions(newJob)
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
}
}