forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
68 lines (56 loc) · 2.44 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
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import the utility functionality.
import jobs.generation.Utilities;
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = ['Linux:x64:Release', 'Debian8.2:x64:Debug', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Debug', 'Ubuntu16.10:x64:Debug', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'RHEL7.2:x64:Release', 'CentOS7.1:x64:Debug']
//Temporarily removing OSX10.12 from the list of configuratons to build until we can find a way to troubleshoot it
// 'OSX10.12:x64:Release',
def static getBuildJobName(def configuration, def os, def architecture) {
return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()
}
platformList.each { platform ->
// Calculate names
def (os, architecture, configuration) = platform.tokenize(':')
def osUsedForMachineAffinity = os;
// Calculate job name
def jobName = getBuildJobName(configuration, os, architecture)
def buildCommand = '';
// Calculate the build command
if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd -Configuration ${configuration}"
}
else if (os == 'Windows_2016') {
buildCommand = ".\\build.cmd -Configuration ${configuration}"
}
else if (os == 'Ubuntu') {
buildCommand = "./build.sh --configuration ${configuration}"
}
else if (os == 'Linux') {
osUsedForMachineAffinity = 'Ubuntu16.04';
buildCommand = "./build.sh --configuration ${configuration}"
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh --configuration ${configuration}"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (os == 'Windows_NT' || os == 'Windows_2016') {
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
}
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity, 'latest-or-auto')
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addMSTestResults(newJob, '**/*.trx')
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${os} ${architecture} ${configuration} Build")
}