From 6349a198467c0b5cb9462f1ee9d7c6a47f797a16 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Wed, 21 Oct 2015 11:24:23 -0700 Subject: [PATCH] Add xplat CI support --- netci.groovy | 96 +++++++++++++++++++++++++++++++++----------- scripts/ci_build.cmd | 3 ++ 2 files changed, 75 insertions(+), 24 deletions(-) create mode 100644 scripts/ci_build.cmd diff --git a/netci.groovy b/netci.groovy index 5df1b3b7a..f37f53af3 100644 --- a/netci.groovy +++ b/netci.groovy @@ -4,34 +4,82 @@ import jobs.generation.Utilities; import jobs.generation.InternalUtilities; def project = 'dotnet/cli' -// Define build strings -def debugBuildString = '''./build.sh''' -// Generate the builds for debug +def osList = ['Ubuntu', 'OSX', 'Windows_NT'] -def linuxDebugJob = job(InternalUtilities.getFullJobName(project, 'linux_debug', false)) { - label('ubuntu') - steps { - shell(debugBuildString) - } +def machineLabelMap = ['Ubuntu':'ubuntu', + 'OSX':'mac', + 'Windows_NT':'windows'] + +def static getBuildJobName(def configuration, def os) { + return configuration.toLowerCase() + '_' + os.toLowerCase() } -InternalUtilities.addPrivatePermissions(linuxDebugJob) -InternalUtilities.addPrivateScm(linuxDebugJob, project) -Utilities.addStandardOptions(linuxDebugJob) -Utilities.addStandardNonPRParameters(linuxDebugJob) -Utilities.addGithubPushTrigger(linuxDebugJob) + +['Debug', 'Release'].each { configuration -> + osList.each { os -> + // Calculate names + def lowerConfiguration = configuration.toLowerCase() + + // Calculate job name + def jobName = getBuildJobName(configuration, os) + def buildCommand = ''; + + def osGroup = osGroupMap[os] + + // Calculate the build command + if (os == 'Windows_NT') { + // On Windows we build the mscorlibs too. + buildCommand = ".\scripts\ci_build.cmd ${lowerConfiguration}" + } + else { + // On other OS's we skipmscorlib but run the pal tests + buildCommand = "./scripts/ci_build.sh ${lowerConfiguration}" + } + + // Create the new job + def newCommitJob = job(Utilities.getFullJobName(project, jobName, false)) { + // Set the label. + label(machineLabelMap[os]) + steps { + if (os == 'Windows_NT') { + // Batch + batchFile(buildCommand) + } + else { + // Shell + shell(buildCommand) + } + } + } + + InternalUtilities.addPrivatePermissions(newCommitJob) + InternalUtilities.addPrivateScm(newCommitJob, project) + Utilities.addStandardOptions(newCommitJob) + Utilities.addStandardNonPRParameters(newCommitJob) + Utilities.addGithubPushTrigger(newCommitJob) -def linuxDebugPRJob = job(InternalUtilities.getFullJobName(project, 'linux_debug', true)) { - label('ubuntu') - steps { - shell(debugBuildString) - } + def newPRJob = job(Utilities.getFullJobName(project, jobName, true)) { + // Set the label. + label(machineLabelMap[os]) + steps { + if (os == 'Windows_NT') { + // Batch + batchFile(buildCommand) + } + else { + // Shell + shell(buildCommand) + } + } + } + + + InternalUtilities.addPrivatePermissions(newPRJob) + InternalUtilities.addPrivatePRTestSCM(newPRJob, project) + Utilities.addStandardOptions(newPRJob) + Utilities.addStandardPRParameters(newPRJob, project) + Utilities.addGithubPRTrigger(newPRJob, "${os} ${configuration} Build") + } } - -InternalUtilities.addPrivatePermissions(linuxDebugPRJob) -InternalUtilities.addPrivatePRTestSCM(linuxDebugPRJob, project) -Utilities.addStandardOptions(linuxDebugPRJob) -Utilities.addStandardPRParameters(linuxDebugPRJob, project) -Utilities.addGithubPRTrigger(linuxDebugPRJob, 'Linux Debug Build') diff --git a/scripts/ci_build.cmd b/scripts/ci_build.cmd new file mode 100644 index 000000000..d3ad32cbc --- /dev/null +++ b/scripts/ci_build.cmd @@ -0,0 +1,3 @@ +@echo off + +CALL %~dp0..\build.cmd \ No newline at end of file