mbed-os/Jenkinsfile

70 lines
2.0 KiB
Plaintext
Raw Normal View History

2016-08-08 06:49:57 +00:00
// List of targets to compile
2016-08-09 13:49:49 +00:00
def targets = [
2016-08-08 06:49:57 +00:00
//"LPC1768",
//"NUCLEO_F401RE",
//"NRF51822",
"K64F"
]
2016-08-09 13:49:49 +00:00
// Map toolchains to compiler labels on Jenkins
2016-08-08 06:49:57 +00:00
def toolchains = [
//ARM: "armcc",
//IAR: "iar_arm",
GCC_ARM: "arm-none-eabi-gcc"
]
// Initial maps for parallel build steps
def stepsForParallel = [:]
// Jenkins pipeline does not support map.each, we need to use oldschool for loop
2016-08-09 13:49:49 +00:00
for (int i = 0; i < targets.size(); i++) {
2016-08-08 06:49:57 +00:00
for(int j = 0; j < toolchains.size(); j++) {
2016-08-09 13:49:49 +00:00
def target = targets.get(i)
2016-08-08 06:49:57 +00:00
def toolchain = toolchains.keySet().asList().get(j)
def compilerLabel = toolchains.get(toolchain)
def stepName = "${target} ${toolchain}"
2016-08-09 13:49:49 +00:00
stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain)
2016-08-08 06:49:57 +00:00
}
}
/* Jenkins does not allow stages inside parallel execution,
* https://issues.jenkins-ci.org/browse/JENKINS-26107 will solve this by adding labeled blocks
*/
stage "build mbed-os targets"
// Actually run the steps in parallel - parallel takes a map as an argument, hence the above.
parallel stepsForParallel
stage "build testapps"
parallel testapp: {
build job: 'ARMmbed/mbed-client-testapp/master', parameters: [[$class: 'StringParameterValue', name: 'mbed_os_revision', value: "${env.GIT_REVISION}"]]
}, cliapp: {
build job: 'ARMmbed/mbed-client-cliapp/master', parameters: [[$class: 'StringParameterValue', name: 'mbed_os_revision', value: "${env.GIT_REVISION}"]]
}, failFast: true
2016-08-09 13:49:49 +00:00
/* End of execution, internal functions below */
2016-08-08 06:49:57 +00:00
def execute(cmd) {
if (isUnix()) {
sh "${cmd}"
} else {
bat "${cmd}"
}
}
2016-08-09 13:49:49 +00:00
//Create build steps for parallel execution
def buildStep(target, compilerLabel, toolchain) {
2016-08-08 06:49:57 +00:00
return {
node ("${compilerLabel}") {
deleteDir()
dir("mbed-os") {
checkout scm
2016-08-08 07:17:27 +00:00
execute ("git log -1 --no-merges --pretty=format:'%H' > GIT_REVISION")
2016-08-08 07:04:06 +00:00
env.GIT_REVISION = readFile ("GIT_REVISION")
2016-08-08 06:49:57 +00:00
execute ("mbed deploy --protocol ssh")
execute ("mbed test --compile -m ${target} -t ${toolchain} -c")
}
}
}
}