87ty78ot7iyu

Dependencies:   HCSR04

Committer:
mbed_official
Date:
Tue Nov 21 08:15:03 2017 +0000
Revision:
43:45429aa163a0
Child:
46:9282f93cd1ce
Add Jenkinsfile

.
Commit copied from https://github.com/ARMmbed/mbed-os-example-wifi

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 43:45429aa163a0 1 properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
mbed_official 43:45429aa163a0 2 [$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. Use format "pull/PR-NUMBER/head" to access mbed-os PR']
mbed_official 43:45429aa163a0 3 ]]])
mbed_official 43:45429aa163a0 4
mbed_official 43:45429aa163a0 5 if (params.mbed_os_revision == '') {
mbed_official 43:45429aa163a0 6 echo 'Use mbed OS revision from mbed-os.lib'
mbed_official 43:45429aa163a0 7 } else {
mbed_official 43:45429aa163a0 8 echo "Use mbed OS revisiong ${params.mbed_os_revision}"
mbed_official 43:45429aa163a0 9 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
mbed_official 43:45429aa163a0 10 echo "Revision is a Pull Request"
mbed_official 43:45429aa163a0 11 }
mbed_official 43:45429aa163a0 12 }
mbed_official 43:45429aa163a0 13
mbed_official 43:45429aa163a0 14 // List of targets with supported RF shields to compile
mbed_official 43:45429aa163a0 15 def targets = [
mbed_official 43:45429aa163a0 16 "UBLOX_EVK_ODIN_W2": ["builtin"],
mbed_official 43:45429aa163a0 17 "REALTEK_RTL8195AM": ["builtin"],
mbed_official 43:45429aa163a0 18 "K64F": ["WIFI_ESP8266"],
mbed_official 43:45429aa163a0 19 "NUCLEO_F401RE": ["WIFI_IDW01M1"],
mbed_official 43:45429aa163a0 20 "NUCLEO_F429ZI": ["WIFI_ESP8266"]
mbed_official 43:45429aa163a0 21 ]
mbed_official 43:45429aa163a0 22
mbed_official 43:45429aa163a0 23 // Map toolchains to compilers
mbed_official 43:45429aa163a0 24 def toolchains = [
mbed_official 43:45429aa163a0 25 ARM: "armcc",
mbed_official 43:45429aa163a0 26 GCC_ARM: "arm-none-eabi-gcc",
mbed_official 43:45429aa163a0 27 IAR: "IAR-linux"
mbed_official 43:45429aa163a0 28 ]
mbed_official 43:45429aa163a0 29
mbed_official 43:45429aa163a0 30 // Supported RF shields
mbed_official 43:45429aa163a0 31 def radioshields = [
mbed_official 43:45429aa163a0 32 "builtin",
mbed_official 43:45429aa163a0 33 "WIFI_IDW01M1",
mbed_official 43:45429aa163a0 34 "WIFI_ESP8266"
mbed_official 43:45429aa163a0 35 ]
mbed_official 43:45429aa163a0 36
mbed_official 43:45429aa163a0 37 def stepsForParallel = [:]
mbed_official 43:45429aa163a0 38
mbed_official 43:45429aa163a0 39 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
mbed_official 43:45429aa163a0 40 for (int i = 0; i < targets.size(); i++) {
mbed_official 43:45429aa163a0 41 for(int j = 0; j < toolchains.size(); j++) {
mbed_official 43:45429aa163a0 42 for(int k = 0; k < radioshields.size(); k++) {
mbed_official 43:45429aa163a0 43 def target = targets.keySet().asList().get(i)
mbed_official 43:45429aa163a0 44 def allowed_shields = targets.get(target)
mbed_official 43:45429aa163a0 45 def toolchain = toolchains.keySet().asList().get(j)
mbed_official 43:45429aa163a0 46 def compilerLabel = toolchains.get(toolchain)
mbed_official 43:45429aa163a0 47 def radioshield = radioshields.get(k)
mbed_official 43:45429aa163a0 48
mbed_official 43:45429aa163a0 49 def stepName = "${target} ${toolchain} ${radioshield}"
mbed_official 43:45429aa163a0 50 if(allowed_shields.contains(radioshield)) {
mbed_official 43:45429aa163a0 51 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield)
mbed_official 43:45429aa163a0 52 }
mbed_official 43:45429aa163a0 53 }
mbed_official 43:45429aa163a0 54 }
mbed_official 43:45429aa163a0 55 }
mbed_official 43:45429aa163a0 56
mbed_official 43:45429aa163a0 57 timestamps {
mbed_official 43:45429aa163a0 58 parallel stepsForParallel
mbed_official 43:45429aa163a0 59 }
mbed_official 43:45429aa163a0 60
mbed_official 43:45429aa163a0 61 def buildStep(target, compilerLabel, toolchain, radioShield) {
mbed_official 43:45429aa163a0 62 return {
mbed_official 43:45429aa163a0 63 stage ("${target}_${compilerLabel}_${radioShield}") {
mbed_official 43:45429aa163a0 64 node ("${compilerLabel}") {
mbed_official 43:45429aa163a0 65 deleteDir()
mbed_official 43:45429aa163a0 66 dir("mbed-os-example-wifi") {
mbed_official 43:45429aa163a0 67 checkout scm
mbed_official 43:45429aa163a0 68 def config_file = "mbed_app.json"
mbed_official 43:45429aa163a0 69
mbed_official 43:45429aa163a0 70 if ("${radioShield}" != "internal") {
mbed_official 43:45429aa163a0 71 // Replace default rf shield
mbed_official 43:45429aa163a0 72 execute("sed -i 's/\"value\": \"internal\"/\"value\": \"${radioShield}\"/' ${config_file}")
mbed_official 43:45429aa163a0 73 }
mbed_official 43:45429aa163a0 74
mbed_official 43:45429aa163a0 75 if ("${radioShield}" == "WIFI_IDW01M1") {
mbed_official 43:45429aa163a0 76 execute("rm .mbedignore")
mbed_official 43:45429aa163a0 77 }
mbed_official 43:45429aa163a0 78
mbed_official 43:45429aa163a0 79 // Set mbed-os to revision received as parameter
mbed_official 43:45429aa163a0 80 execute ("mbed deploy --protocol ssh")
mbed_official 43:45429aa163a0 81 if (params.mbed_os_revision != '') {
mbed_official 43:45429aa163a0 82 dir ("mbed-os") {
mbed_official 43:45429aa163a0 83 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
mbed_official 43:45429aa163a0 84 execute("git fetch origin ${params.mbed_os_revision}:PR")
mbed_official 43:45429aa163a0 85 execute("git checkout PR")
mbed_official 43:45429aa163a0 86 } else {
mbed_official 43:45429aa163a0 87 execute ("git checkout ${params.mbed_os_revision}")
mbed_official 43:45429aa163a0 88 }
mbed_official 43:45429aa163a0 89 }
mbed_official 43:45429aa163a0 90 }
mbed_official 43:45429aa163a0 91
mbed_official 43:45429aa163a0 92 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
mbed_official 43:45429aa163a0 93 }
mbed_official 43:45429aa163a0 94 stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 95 archive '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 96 step([$class: 'WsCleanup'])
mbed_official 43:45429aa163a0 97 }
mbed_official 43:45429aa163a0 98 }
mbed_official 43:45429aa163a0 99 }
mbed_official 43:45429aa163a0 100 }