1 // Import the utility functionality.
3 import jobs.generation.*;
5 def project = GithubProject
6 def branch = GithubBranchName
7 def projectName = Utilities.getFolderName(project)
8 def projectFolder = projectName + '/' + Utilities.getFolderName(branch)
10 def static getOSGroup(def os) {
11 def osGroupMap = ['Ubuntu':'Linux',
13 'Ubuntu16.04': 'Linux',
17 'Windows_NT':'Windows_NT',
20 'OpenSUSE13.2': 'Linux',
21 'OpenSUSE42.1': 'Linux',
22 'LinuxARMEmulator': 'Linux']
23 def osGroup = osGroupMap.get(os, null)
24 assert osGroup != null : "Could not find os group for ${os}"
28 [true, false].each { isPR ->
29 ['Windows_NT'].each { os ->
30 def architecture = 'x64'
31 def configuration = 'Release'
32 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
37 batchFile("C:\\tools\\nuget install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory C:\\tools -Prerelease -ExcludeVersion")
38 batchFile("python C:\\tools\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py")
39 batchFile("set __TestIntermediateDir=int&&build.cmd release ${architecture}")
40 batchFile("tests\\runtest.cmd release ${architecture}")
41 batchFile("tests\\scripts\\run-xunit-perf.cmd")
45 // Save machinedata.json to /artifact/bin/ Jenkins dir
46 def archiveSettings = new ArchivalSettings()
47 archiveSettings.addFiles('sandbox\\perf-*.xml')
48 archiveSettings.addFiles('machinedata.json')
49 Utilities.addArchival(newJob, archiveSettings)
51 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
53 // For perf, we need to keep the run results longer
55 // Enable the log rotator
64 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
65 builder.setGithubContext("${os} Perf Tests")
66 builder.triggerOnlyOnComment()
67 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
68 builder.triggerForBranch(branch)
69 builder.emitTrigger(newJob)
73 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
74 builder.emitTrigger(newJob)
79 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
80 [true, false].each { isPR ->
81 ['Ubuntu'].each { os ->
82 def osGroup = getOSGroup(os)
83 def architecture = 'x64'
84 def configuration = 'Release'
85 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
87 shell("sudo bash ./tests/scripts/perf-prep.sh --branch=${projectName}")
88 shell("sudo ./init-tools.sh")
89 shell("""sudo bash ./tests/scripts/run-xunit-perf.sh \\
90 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
91 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
92 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
93 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
94 --coreFxBinDir=\"\${WORKSPACE}/bin/${osGroup}.AnyCPU.${configuration};\${WORKSPACE}/bin/Unix.AnyCPU.${configuration};\${WORKSPACE}/bin/AnyOS.AnyCPU.${configuration}\" \\
95 --coreFxNativeBinDir=\"\${WORKSPACE}/bin/${osGroup}.${architecture}.${configuration}\"""")
99 Utilities.setMachineAffinity(newJob, os, 'latest-or-auto') // Just run against Linux VM
\92s for now.
101 // Save machinedata.json to /artifact/bin/ Jenkins dir
102 def archiveSettings = new ArchivalSettings()
103 archiveSettings.addFiles('sandbox/perf-*.xml')
104 archiveSettings.addFiles('machinedata.json')
105 Utilities.addArchival(newJob, archiveSettings)
107 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
109 // For perf, we need to keep the run results longer
111 // Enable the log rotator
113 artifactDaysToKeep(7)
115 artifactNumToKeep(25)
120 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
121 builder.setGithubContext("${os} Perf Tests")
122 builder.triggerOnlyOnComment()
123 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
124 builder.triggerForBranch(branch)
125 builder.emitTrigger(newJob)
128 // Set a push trigger
129 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
130 builder.emitTrigger(newJob)