forked from dotnet/symreader-converter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
73 lines (54 loc) · 2.4 KB
/
netci.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
// Groovy Script: http://www.groovy-lang.org/syntax.html
// Jenkins DSL: https://github.com/jenkinsci/job-dsl-plugin/wiki
import jobs.generation.Utilities;
static getJobName(def opsysName, def configName) {
return "${opsysName}_${configName}"
}
static addArchival(def job, def filesToArchive, def filesToExclude) {
def doNotFailIfNothingArchived = false
def archiveOnlyIfSuccessful = false
Utilities.addArchival(job, filesToArchive, filesToExclude, doNotFailIfNothingArchived, archiveOnlyIfSuccessful)
}
static addGithubPRTriggerForBranch(def job, def branchName, def jobName) {
def prContext = "prtest/${jobName.replace('_', '/')}"
def triggerPhrase = "(?i)^\\s*(@?dotnet-bot\\s+)?(re)?test\\s+(${prContext})(\\s+please)?\\s*\$"
def triggerOnPhraseOnly = false
Utilities.addGithubPRTriggerForBranch(job, branchName, prContext, triggerPhrase, triggerOnPhraseOnly)
}
static addXUnitDotNETResults(def job, def configName) {
def resultFilePattern = "**/artifacts/${configName}/TestResults/*.xml"
def skipIfNoTestFiles = false
Utilities.addXUnitDotNETResults(job, resultFilePattern, skipIfNoTestFiles)
}
static addBuildSteps(def job, def projectName, def opsysName, def configName, def isPR) {
def buildJobName = getJobName(opsysName, configName)
def buildFullJobName = Utilities.getFullJobName(projectName, buildJobName, isPR)
job.with {
steps {
batchFile(""".\\CIBuild.cmd -configuration ${configName} -prepareMachine""")
}
}
}
[true, false].each { isPR ->
['windows'].each { opsysName ->
['debug', 'release'].each { configName ->
def projectName = GithubProject
def branchName = GithubBranchName
def filesToArchive = "**/artifacts/${configName}/**"
def filesToExclude = "**/artifacts/${configName}/obj/**"
def jobName = getJobName(opsysName, configName)
def fullJobName = Utilities.getFullJobName(projectName, jobName, isPR)
def myJob = job(fullJobName)
Utilities.standardJobSetup(myJob, projectName, isPR, "*/${branchName}")
if (isPR) {
addGithubPRTriggerForBranch(myJob, branchName, jobName)
} else {
Utilities.addGithubPushTrigger(myJob)
}
addArchival(myJob, filesToArchive, filesToExclude)
addXUnitDotNETResults(myJob, configName)
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3')
addBuildSteps(myJob, projectName, opsysName, configName, isPR)
}
}
}