forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf.groovy
173 lines (148 loc) · 6.77 KB
/
perf.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
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import the utility functionality.
import jobs.generation.ArchivalSettings;
import jobs.generation.Utilities;
import jobs.generation.TriggerBuilder;
def project = GithubProject
def branch = GithubBranchName
def static getBuildJobName(def configuration, def os) {
return configuration.toLowerCase() + '_' + os.toLowerCase()
}
// Setup SDK performance tests runs on Windows
[true, false].each { isPR ->
['Windows_NT'].each { os ->
['Release'].each { config ->
['x64'].each { arch ->
def jobName = "SDK_Perf_${os}_${arch}"
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
def perfWorkingDirectory = "%WORKSPACE%\\artifacts\\TestResults\\${config}\\Performance"
// Set the label.
label('windows_server_2016_clr_perf')
wrappers {
credentialsBinding {
string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
}
}
if (isPR) {
parameters {
stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form SDK <private|rolling> BenchviewCommitName')
}
}
def runType = isPR ? 'private' : 'rolling'
steps {
// Build solution and run the performance tests
batchFile("\"%WORKSPACE%\\build.cmd\" -configuration ${config} -ci -msbuildEngine dotnet -performanceTest /p:PerfIterations=10 /p:PerfOutputDirectory=\"${perfWorkingDirectory}\" /p:PerfCollectionType=stopwatch")
// Upload perf results to BenchView
batchFile("set perfWorkingDirectory=${perfWorkingDirectory}\n" +
"set configuration=${config}\n" +
"set architecture=${arch}\n" +
"set OS=${os}\n" +
"set runType=${runType}\n" +
"\"%WORKSPACE%\\build\\uploadperftobenchview.cmd\"")
}
}
def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles("artifacts/TestResults/${config}/Performance/**")
archiveSettings.setAlwaysArchive()
Utilities.addArchival(newJob, archiveSettings)
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
newJob.with {
logRotator {
artifactDaysToKeep(30)
daysToKeep(30)
artifactNumToKeep(200)
numToKeep(200)
}
wrappers {
timeout {
absolute(240)
}
}
}
if (isPR) {
TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
builder.setGithubContext("${os} ${arch} SDK Perf Tests")
builder.triggerOnlyOnComment()
//Phrase is "test Windows_NT x64 SDK Perf Tests"
builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}\\W+sdk\\W+perf\\W+tests.*")
builder.triggerForBranch(branch)
builder.emitTrigger(newJob)
}
else {
TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
builder.emitTrigger(newJob)
Utilities.addPeriodicTrigger(newJob, "@daily", true)
}
}
}
}
}
// Setup SDK performance tests runs on Linux
[true, false].each { isPR ->
['Ubuntu_16.04'].each { os ->
['Release'].each { config ->
['x64'].each { arch ->
def jobName = "SDK_Perf_${os}_${arch}"
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
def perfWorkingDirectory = "\${WORKSPACE}/artifacts/TestResults/${config}/Performance"
// Set the label.
label('ubuntu_1604_clr_perf')
wrappers {
credentialsBinding {
string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
}
}
if (isPR) {
parameters {
stringParam('BenchviewCommitName', '\${ghprbPullTitle}', 'The name that you will be used to build the full title of a run in Benchview. The final name will be of the form SDK <private|rolling> BenchviewCommitName')
}
}
def runType = isPR ? 'private' : 'rolling'
steps {
// Build solution and run the performance tests
shell("./build.sh --configuration ${config} --ci --performancetest /p:PerfIterations=10 /p:PerfOutputDirectory=\"${perfWorkingDirectory}\" /p:PerfCollectionType=stopwatch")
// Upload perf results to BenchView
shell("export perfWorkingDirectory=${perfWorkingDirectory}\n" +
"export configuration=${config}\n" +
"export architecture=${arch}\n" +
"export OS=${os}\n" +
"export runType=${runType}\n" +
"./build/uploadperftobenchview.sh")
}
}
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
newJob.with {
logRotator {
artifactDaysToKeep(30)
daysToKeep(30)
artifactNumToKeep(200)
numToKeep(200)
}
wrappers {
timeout {
absolute(240)
}
}
}
if (isPR) {
TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
builder.setGithubContext("${os} ${arch} SDK Perf Tests")
builder.triggerOnlyOnComment()
//Phrase is "test Ubuntu_16.04 x64 SDK Perf Tests"
builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+${arch}\\W+sdk\\W+perf\\W+tests.*")
builder.triggerForBranch(branch)
builder.emitTrigger(newJob)
}
else {
TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
builder.emitTrigger(newJob)
Utilities.addPeriodicTrigger(newJob, "@daily", true)
}
}
}
}
}
Utilities.createHelperJob(this, project, branch,
"Welcome to the ${project} Perf help",
"Have a nice day!")