forked from dotnet/source-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
101 lines (83 loc) · 3.46 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
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
99
100
import jobs.generation.Utilities;
def project = GithubProject;
def branch = GithubBranchName;
loggingOptions = "/clp:v=detailed /p:MinimalConsoleLogOutput=false";
def addBuildStepsAndSetMachineAffinity(def job, String os, String configuration) {
job.with {
steps {
if (os == "Windows_NT") {
batchFile("git submodule update --init --recursive");
batchFile(".\\build.cmd /p:Configuration=${configuration} ${loggingOptions}")
}
else {
shell("git submodule update --init --recursive");
shell("./build.sh /p:Configuration=${configuration} ${loggingOptions}")
}
};
};
Utilities.setMachineAffinity(job, os, "latest-or-auto");
}
def addPullRequestJob(String project, String branch, String os, String configuration, boolean runByDefault)
{
def newJobName = Utilities.getFullJobName(project, "${os}_${configuration}", true);
def contextString = "${os} ${configuration}";
def triggerPhrase = "(?i).*test\\W+${contextString}.*";
def newJob = job(newJobName);
addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
Utilities.standardJobSetup(newJob, project, true, "*/${branch}");
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString, triggerPhrase, !runByDefault);
}
def addPushJob(String project, String branch, String os, String configuration)
{
def shortJobName = "${os}_${configuration}";
def newJobName = Utilities.getFullJobName(project, shortJobName, false);
def newJob = job(newJobName);
addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
Utilities.standardJobSetup(newJob, project, false, "*/${branch}");
Utilities.addGithubPushTrigger(newJob);
}
["Ubuntu16.04", "Fedora24", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
addPullRequestJob(project, branch, os, "Release", true);
addPullRequestJob(project, branch, os, "Debug", false);
};
// Per push, run all the jobs
["Ubuntu16.04", "Fedora24", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
["Release", "Debug"].each { configuration ->
addPushJob(project, branch, os, configuration);
};
};
[true, false].each { isPR ->
["Linux_ARM"].each { os->
["Release", "Debug"].each { configuration ->
def shortJobName = "${os}_${configuration}";
def contextString = "${os} ${configuration}";
def triggerPhrase = "(?i).*test\\W+${contextString}.*";
def newJob = job(Utilities.getFullJobName(project, shortJobName, isPR)){
steps{
shell("git submodule update --init --recursive");
shell("./init-tools.sh")
if(os == "Linux_ARM"){
shell("./arm-ci.sh arm ./build.sh /p:Platform=arm /p:Configuration=${configuration} ${loggingOptions}")
}
if(os == "Tizen"){
shell("./arm-ci.sh armel ./build.sh /p:Platform=armel /p:Configuration=${configuration} ${loggingOptions}")
}
}
}
Utilities.setMachineAffinity(newJob, 'Ubuntu', 'arm-cross-latest');
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}");
if(isPR){
//We run Tizen Release and Ubuntu ARM Release
if(configuration == "Release"){
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString);
}
else{
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString, triggerPhrase);
}
}
else{
Utilities.addGithubPushTrigger(newJob);
}
}
}
}