forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf.groovy
98 lines (82 loc) · 3.74 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
// 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
[true, false].each { isPR ->
['Windows_NT'].each { os ->
['Release'].each { config ->
['x64', 'x86'].each { arch ->
def jobName = "SDK_Perf_${os}_${arch}"
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
def perfWorkingDirectory = "%WORKSPACE%\\artifacts\\${config}\\TestResults\\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 -perf /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/${config}/TestResults/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.createHelperJob(this, project, branch,
"Welcome to the ${project} Perf help",
"Have a nice day!")