forked from dotnet/core-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
155 lines (134 loc) · 6.49 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// 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;
import jobs.generation.ArchivalSettings;
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = ['Linux:x64:Release', 'Linux:arm:Release', 'OSX:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT:arm:Debug', 'Tizen:armel: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(':')
// Calculate the job name
def jobName = getBuildJobName(configuration, os, architecture)
def buildCommand = '';
def osForGHTrigger = os
def version = "latest-or-auto"
def dockerRepository = "microsoft/dotnet-buildtools-prereqs"
def dockerContainer = ''
def dockerWorkingDirectory = "/src/core-setup"
def dockerCommand = ''
def crossbuildargs = ''
def buildArgs = "-ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}"
if (os != 'Windows_NT' && configuration == 'Release') {
buildArgs += " -strip-symbols"
}
// Calculate build command
if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd ${buildArgs}"
if ((architecture == 'arm' || architecture == 'arm64')) {
buildCommand += " -SkipTests=true"
}
}
else if (os == 'Tizen') {
dockerRepository = "hqueue/dotnetcore"
dockerContainer = "ubuntu1404_cross_prereqs_v4-tizen_rootfs"
dockerCommand = "docker run -e ROOTFS_DIR=/crossrootfs/${architecture}.tizen.build --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
buildArgs += " -DistroRid=tizen.4.0.0-${architecture} -SkipTests=true -DisableCrossgen=true -PortableBuild=false -CrossBuild=true -- /p:OverridePackageSource=https:%2F%2Ftizen.myget.org/F/dotnet-core/api/v3/index.json"
buildCommand = "${dockerCommand} ./build.sh ${buildArgs}"
}
else if (os == "Linux") {
// Prep for Portable Linux builds take place on Ubuntu 14.04
if (architecture == 'arm' || architecture == 'armel') {
dockerContainer = "ubuntu-14.04-cross-0cd4667-20172211042239"
dockerCommand = "docker run -e ROOTFS_DIR=/crossrootfs/${architecture} --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
buildArgs += " -DistroRid=linux-${architecture} -SkipTests=true -DisableCrossgen=true -CrossBuild=true"
buildCommand = "${dockerCommand} ./build.sh ${buildArgs}"
osForGHTrigger = "Linux"
os = "Ubuntu"
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh ${buildArgs}"
// Trigger a portable Linux build that runs on RHEL7.2
osForGHTrigger = "Linux"
os = "RHEL7.2"
}
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh ${buildArgs}"
os = "OSX10.12"
}
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, os, version)
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
if (!(architecture == 'arm' || architecture == 'armel') ) {
Utilities.addMSTestResults(newJob, '**/*-testResults.trx')
}
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${osForGHTrigger} ${architecture} ${configuration} Build")
ArchivalSettings settings = new ArchivalSettings();
def archiveString = ["tar.gz", "zip", "deb", "msi", "pkg", "exe", "nupkg"].collect { "Bin/*/packages/*.${it},Bin/*/corehost/*.${it}" }.join(",")
settings.addFiles(archiveString)
settings.setArchiveOnSuccess()
settings.setFailIfNothingArchived()
Utilities.addArchival(newJob, settings)
}
// **************************
// Define ARM64 building.
// **************************
//['Windows_NT'].each { os ->
// ['Release'].each { configurationGroup ->
// def newJobName = "${configurationGroup.toLowerCase()}_${os.toLowerCase()}_arm64"
// def arm64Users = ['ianhays', 'kyulee1', 'gkhanna79', 'weshaggard', 'stephentoub', 'rahku', 'ramarag']
// def newJob = job(Utilities.getFullJobName(project, newJobName, /* isPR */ false)) {
// steps {
// // build the world, but don't run the tests
// batchFile("build.cmd -ConfigurationGroup ${configurationGroup} -Architecure x64 -TargetArch arm64 -ToolsetDir C:\\ats2 -Framework netcoreapp1.1")
// }
// label("arm64")
//
// // Kick off the test run
// publishers {
// archiveArtifacts {
// pattern("artifacts/win10-arm64/packages/*.zip")
// pattern("artifacts/win10-arm64/corehost/*.nupkg")
// onlyIfSuccessful(true)
// allowEmpty(false)
// }
// }
// }
//
// // Set up standard options.
// Utilities.standardJobSetup(newJob, project, /* isPR */ false, "*/${branch}")
//
// // Set a daily trigger
// Utilities.addPeriodicTrigger(newJob, '@daily')
//
// // Set up a PR trigger that is only triggerable by certain members
// Utilities.addPrivateGithubPRTriggerForBranch(newJob, branch, "Windows_NT ARM64 ${configurationGroup} Build", "(?i).*test\\W+ARM64\\W+${os}\\W+${configurationGroup}", null, arm64Users)
//
// // Set up a per-push trigger
// Utilities.addGithubPushTrigger(newJob)
// }
//}
// Make the call to generate the help job
Utilities.createHelperJob(this, project, branch,
"Welcome to the ${project} Repository", // This is prepended to the help message
"Have a nice day!") // This is appended to the help message. You might put known issues here.