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 = ['Ubuntu14.04':'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}"
27 // Setup perflab tests runs
28 [true, false].each { isPR ->
29 ['Windows_NT'].each { os ->
30 ['x64', 'x86'].each { architecture ->
31 def newJob = job(Utilities.getFullJobName(project, "perf_perflab_${os}_${architecture}", isPR)) {
33 label('windows_clr_perf')
36 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
44 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 <branch> private BenchviewCommitName')
47 def configuration = 'Release'
48 def runType = isPR ? 'private' : 'rolling'
49 def benchViewName = isPR ? 'coreclr private %BenchviewCommitName%' : 'coreclr rolling %GIT_BRANCH_WITHOUT_ORIGIN% %GIT_COMMIT%'
54 batchFile("if exist \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\" rmdir /s /q \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\"")
55 batchFile("C:\\Tools\\nuget.exe install Microsoft.BenchView.JSONFormat -Source http://benchviewtestfeed.azurewebsites.net/nuget -OutputDirectory \"%WORKSPACE%\" -Prerelease -ExcludeVersion")
56 //Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
57 //we have to do it all as one statement because cmd is called each time and we lose the set environment variable
58 batchFile("if [%GIT_BRANCH:~0,7%] == [origin/] (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)\n" +
59 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name " + "\"" + benchViewName + "\"" + " --user " + "\"dotnet-bot@microsoft.com\"\n" +
60 "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type " + runType)
61 batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
62 batchFile("set __TestIntermediateDir=int&&build.cmd release ${architecture}")
63 batchFile("tests\\runtest.cmd release ${architecture} GenerateLayoutOnly")
64 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${architecture} -configuration ${configuration} -testBinLoc bin\\tests\\Windows_NT.${architecture}.Release\\performance\\perflab\\Perflab -library -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype " + runType)
65 batchFile("tests\\scripts\\run-xunit-perf.cmd -arch ${architecture} -configuration ${configuration} -testBinLoc bin\\tests\\Windows_NT.${architecture}.Release\\Jit\\Performance\\CodeQuality -uploadToBenchview \"%WORKSPACE%\\Microsoft.Benchview.JSONFormat\\tools\" -runtype " + runType)
69 // Save machinedata.json to /artifact/bin/ Jenkins dir
70 def archiveSettings = new ArchivalSettings()
71 archiveSettings.addFiles('perf-*.xml')
72 archiveSettings.addFiles('perf-*.etl')
73 Utilities.addArchival(newJob, archiveSettings)
75 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
78 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
79 builder.setGithubContext("${os} ${architecture} CoreCLR Perf Tests")
80 builder.triggerOnlyOnComment()
81 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}_${architecture}\\W+perf.*")
82 builder.triggerForBranch(branch)
83 builder.emitTrigger(newJob)
87 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
88 builder.emitTrigger(newJob)
94 // Create the Linux/OSX/CentOS coreclr test leg for debug and release and each scenario
95 [true, false].each { isPR ->
96 ['Ubuntu14.04'].each { os ->
97 def newJob = job(Utilities.getFullJobName(project, "perf_${os}", isPR)) {
99 label('linux_clr_perf')
102 string('BV_UPLOAD_SAS_TOKEN', 'CoreCLR Perf BenchView Sas')
110 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 <branch> private BenchviewCommitName')
113 def osGroup = getOSGroup(os)
114 def architecture = 'x64'
115 def configuration = 'Release'
116 def runType = isPR ? 'private' : 'rolling'
117 def benchViewName = isPR ? 'coreclr private \$BenchviewCommitName' : 'coreclr rolling \$GIT_BRANCH_WITHOUT_ORIGIN \$GIT_COMMIT'
120 shell("bash ./tests/scripts/perf-prep.sh")
121 shell("./init-tools.sh")
122 shell("./build.sh ${architecture} ${configuration}")
123 shell("GIT_BRANCH_WITHOUT_ORIGIN=\$(echo \$GIT_BRANCH | sed \"s/[^/]*\\/\\(.*\\)/\\1 /\")\n" +
124 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/submission-metadata.py\" --name " + "\"" + benchViewName + "\"" + " --user " + "\"dotnet-bot@microsoft.com\"\n" +
125 "python3.5 \"\${WORKSPACE}/tests/scripts/Microsoft.BenchView.JSONFormat/tools/build.py\" git --branch \$GIT_BRANCH_WITHOUT_ORIGIN --type " + runType)
126 shell("""sudo -E bash ./tests/scripts/run-xunit-perf.sh \\
127 --testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
128 --testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
129 --coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
130 --mscorlibDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
131 --coreFxBinDir=\"\${WORKSPACE}/corefx\" \\
132 --runType=\"${runType}\" \\
133 --benchViewOS=\"${os}\" \\
134 --uploadToBenchview""")
138 // Save machinedata.json to /artifact/bin/ Jenkins dir
139 def archiveSettings = new ArchivalSettings()
140 archiveSettings.addFiles('sandbox/perf-*.xml')
141 archiveSettings.addFiles('machinedata.json')
142 Utilities.addArchival(newJob, archiveSettings)
144 Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
146 // For perf, we need to keep the run results longer
148 // Enable the log rotator
150 artifactDaysToKeep(7)
152 artifactNumToKeep(25)
157 TriggerBuilder builder = TriggerBuilder.triggerOnPullRequest()
158 builder.setGithubContext("${os} Perf Tests")
159 builder.triggerOnlyOnComment()
160 builder.setCustomTriggerPhrase("(?i).*test\\W+${os}\\W+perf.*")
161 builder.triggerForBranch(branch)
162 builder.emitTrigger(newJob)
165 // Set a push trigger
166 TriggerBuilder builder = TriggerBuilder.triggerOnCommit()
167 builder.emitTrigger(newJob)