forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf.groovy
53 lines (45 loc) · 1.73 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
// Groovy Script: http://www.groovy-lang.org/syntax.html
// Jenkins DSL: https://github.com/jenkinsci/job-dsl-plugin/wiki
import jobs.generation.*;
def generate(boolean isPr) {
// The input project name (e.g. dotnet/corefx)
def projectName = GithubProject
// The input branch name (e.g. master)
def branchName = GithubBranchName
def defaultBranch = "*/${branchName}"
def jobName = Utilities.getFullJobName(projectName, "perf_run", isPr)
def myJob = job(jobName) {
description('perf run')
steps {
batchFile("""powershell -File ./build/scripts/run_perf.ps1""")
}
publishers {
postBuildScripts {
steps {
batchFile("""powershell -File ./build/scripts/cleanup_perf.ps1 -ShouldArchive""")
}
}
}
}
def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles('ToArchive/**/*.*')
Utilities.addArchival(myJob, archiveSettings)
Utilities.standardJobSetup(myJob, projectName, isPr, defaultBranch)
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-or-auto-perf')
Utilities.addGithubPushTrigger(myJob)
if (isPr) {
// Utilities.addGithubPRTriggerForBranch(newJob, branch, "Windows ${configuration}")
TriggerBuilder prTrigger = TriggerBuilder.triggerOnPullRequest()
prTrigger.permitOrg('Microsoft')
prTrigger.permitOrg('dotnet')
prTrigger.setCustomTriggerPhrase("(?i).*test\\W+perf.*" )
prTrigger.triggerForBranch('master');
prTrigger.setGithubContext('Performance Test Run')
prTrigger.emitTrigger(myJob)
}
else {
Utilities.addGithubPushTrigger(myJob)
}
}
generate(true)
generate(false)