forked from dotnet/wcf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetci.groovy
173 lines (146 loc) · 6.96 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
// Import the utility functionality.
import jobs.generation.Utilities;
def project = GithubProject
def branch = GithubBranchName
// **************************
// Define the basic inner loop builds for PR
// **************************
// Loop over the options and build up the innerloop build matrix.
[true, false].each { isPR ->
['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}"
def osAffinityName = os;
if (osAffinityName == 'Linux') {
// our Linux runs should only ever run on Ubuntu14.04; we don't run on other flavours yet
osAffinityName = 'Ubuntu14.04'
}
// **************************
// Create the new commit job
// **************************
def newJob = null
if (osJobName == 'linux') {
// Jobs run as a service in unix, which means that HOME variable is not set, and it is required for restoring packages
// so we set it first, and then call build.sh
newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
steps {
shell("HOME=\$WORKSPACE/tempHome ./build.sh /p:ShouldCreatePackage=false /p:ShouldGenerateNuSpec=false /p:OSGroup=${os} /p:Configuration=${os}_${configuration}")
}
}
} else {
// On other platforms, we run the build under Windows and then pack the results
newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
steps {
// Use inline replacement
batchFile("build.cmd /p:Configuration=${os}_${configuration} /p:OSGroup=${os}")
// Pack up the results for max efficiency
batchFile("C:\\Packer\\Packer.exe .\\bin\\build.pack .\\bin")
}
}
}
Utilities.setMachineAffinity(newJob, osAffinityName, 'latest-or-auto')
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
if (os != 'Linux') {
// We do not do the pack step on non-Linux builds
Utilities.addArchival(newJob, "bin/${os}.AnyCPU.${configuration}/**,bin/build.pack")
}
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "Innerloop ${os} ${configuration} Build and Test")
}
else {
Utilities.addGithubPushTrigger(newJob)
}
}
}
}
// **************************
// Define the code coverage jobs
// **************************
// Define build string
def codeCoverageBuildString = '''build.cmd /p:ShouldCreatePackage=false /p:ShouldGenerateNuSpec=false /p:OSGroup=Windows_NT /p:Configuration=Windows_NT_Debug /p:Coverage=true /p:WithCategories=\"InnerLoop;OuterLoop\"'''
// Generate a rolling (12 hr job) and a PR job that can be run on demand
[true, false].each { isPR ->
def newJob = job(Utilities.getFullJobName(project, 'code_coverage_windows', isPR)) {
label('windows-elevated')
steps {
batchFile(codeCoverageBuildString)
}
}
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addHtmlPublisher(newJob, 'bin/tests/coverage', 'Code Coverage Report', 'index.htm')
Utilities.addArchival(newJob, '**/coverage/*,msbuild.log')
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, 'Code Coverage Windows Debug', '(?i).*test\\W+code\\W*coverage.*')
}
else {
Utilities.addPeriodicTrigger(newJob, '@daily')
}
}
// **************************
// Outerloop. Rolling every 4 hours for debug and release
// **************************
[true, false].each { isPR ->
['Debug', 'Release'].each { configuration ->
def configurationJobName = configuration.toLowerCase()
def jobName = "outerloop_windows_${configurationJobName}"
// Create the new rolling job
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
label('windows-elevated')
steps {
batchFile("build.cmd /p:Configuration=Windows_NT_${configuration} /p:WithCategories=OuterLoop")
}
}
// Add commit job options
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "Outerloop Windows ${configuration} Build and Test", '(?i).*test\\W+outerloop.*')
}
else {
Utilities.addPeriodicTrigger(newJob, 'H H/4 * * *')
}
}
}
// **************************
// Outerloop and Innerloop against the latest dependencies on Windows. Rolling daily for debug and release
// **************************
['Debug', 'Release'].each { configuration ->
def configurationJobName = configuration.toLowerCase()
def jobName = "latest_dependencies_windows_${configurationJobName}"
def latestDepBuildString = '''build.cmd /p:Configuration=Windows_NT_${configuration} /p:FloatingTestRuntimeDependencies=true /p:WithCategories=\"InnerLoop;OuterLoop\"'''
// Create the new rolling job
def newLatestDepRollingJob = job(Utilities.getFullJobName(project, jobName, false)) {
label('windows-elevated')
steps {
batchFile(latestDepBuildString)
}
}
// Add commit job options
Utilities.addScm(newLatestDepRollingJob, project)
Utilities.addStandardNonPRParameters(newLatestDepRollingJob)
Utilities.addPeriodicTrigger(newLatestDepRollingJob, '@daily')
// Create the new PR job for on demand execution. No automatic PR trigger.
// Triggered with '@dotnet-bot test latest dependencies please'
def newLatestDepPRJob = job(Utilities.getFullJobName(project, jobName, true)) {
label('windows-elevated')
steps {
batchFile(latestDepBuildString)
}
}
// Add a PR trigger
Utilities.addGithubPRTrigger(newLatestDepPRJob, "Latest dependencies Windows ${configuration} Build and Test", '@dotnet-bot test latest dependencies please')
Utilities.addPRTestSCM(newLatestDepPRJob, project)
Utilities.addStandardPRParameters(newLatestDepPRJob, project)
// Add common options
[newLatestDepPRJob, newLatestDepRollingJob].each { newJob ->
Utilities.addStandardOptions(newJob)
Utilities.addXUnitDotNETResults(newJob, 'bin/tests/**/testResults.xml')
}
}