forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
75 lines (63 loc) · 2.85 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
// 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.ArchivalSettings;
import jobs.generation.Utilities;
def project = GithubProject
def branch = GithubBranchName
def static getBuildJobName(def configuration, def os) {
return configuration.toLowerCase() + '_' + os.toLowerCase()
}
['Windows_NT', 'Windows_NT_FullFramework', 'Ubuntu14.04', 'Ubuntu16.04', 'OSX10.12'].each { os ->
['Debug', 'Release'].each { config ->
[true, false].each { isPR ->
// Calculate job name
def jobName = getBuildJobName(config, os)
def buildCommand = '';
def osBase = os
def machineAffinity = 'latest-or-auto'
// Calculate the build command
if (os == 'Windows_NT') {
buildCommand = ".\\build\\cibuild.cmd -configuration $config"
machineAffinity = 'Windows.10.Amd64.ClientRS4.DevEx.Open'
} else if (os == 'Windows_NT_FullFramework') {
buildCommand = ".\\build\\cibuild.cmd -configuration $config -fullMSBuild"
osBase = 'Windows_NT'
machineAffinity = 'Windows.10.Amd64.ClientRS4.DevEx.Open'
} else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build/cibuild.sh --configuration $config"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (osBase == 'Windows_NT') {
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
}
if (os == 'Windows_NT' || os == 'Windows_NT_FullFramework') {
Utilities.setMachineAffinity(newJob, machineAffinity)
}
else {
Utilities.setMachineAffinity(newJob, osBase, machineAffinity)
}
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
if (isPR) {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "$os $config")
}
Utilities.addXUnitDotNETResults(newJob, "artifacts/$config/TestResults/*.xml", false)
def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles("artifacts/$config/log/*")
archiveSettings.addFiles("artifacts/$config/TestResults/*")
archiveSettings.setFailIfNothingArchived()
archiveSettings.setArchiveOnFailure()
Utilities.addArchival(newJob, archiveSettings)
}
}
}