diff --git a/features/minimal-printf/Jenkinsfile b/features/minimal-printf/Jenkinsfile new file mode 100644 index 0000000000..43123237d8 --- /dev/null +++ b/features/minimal-printf/Jenkinsfile @@ -0,0 +1,120 @@ +// Jenkins configuration. +properties ([ + buildDiscarder( + logRotator(artifactDaysToKeepStr: '', + artifactNumToKeepStr: '', + daysToKeepStr: '30', + numToKeepStr: '100' + ) + ) +]) + +// RaaS credentials and settings. +raas_username = "ci" +raas_password = "ci" +raas_timeout = 1200 + +// Test combinations, for each listed target, each toolchain is build and tested on RaaS instance. +targets = [ + "K64F": ["toolchains": [ "ARM", "IAR", "GCC_ARM"], "raas": "eeva.mbedcloudtesting.com"], + "NUCLEO_F429ZI": ["toolchains": [ "ARM", "IAR", "GCC_ARM"], "raas": "ruka.mbedcloudtesting.com"], +] + +// Map toolchains to compiler labels to find suitable node on Jenkins. +def nodes = [ + ARM: "armcc", + IAR: "iar_arm", + GCC_ARM: "arm-none-eabi-gcc", + SXOS: "linux" +] + +// Initial maps for parallel build steps +def buildStepsForParallel = [:] +def testStepsForParallel = [:] + +for (target in targets.keySet()) { + for (toolchain_key in targets[target]["toolchains"]) { + echo "Include for build: ${target} ${toolchain_key}" + + def stepName = "${target} ${toolchain_key}" + buildStepsForParallel[stepName] = buildStep(target, nodes[toolchain_key], toolchain_key) + } +} + +for (target in targets.keySet()) { + for (toolchain_key in targets[target]["toolchains"]) { + echo "Include for test: ${target} ${toolchain_key}" + + def stepName = "${target} ${toolchain_key}" + testStepsForParallel[stepName] = testStep(target, nodes[toolchain_key], toolchain_key) + } +} + +// Actually run the steps in parallel - parallel takes a map as an argument, hence the above. +timestamps { + parallel buildStepsForParallel + parallel testStepsForParallel +} + +// Create build steps for parallel execution. +def buildStep(target, compilerLabel, toolchain) { + return { + stage("Build_${target}_${toolchain}") { + node("${compilerLabel}") { + deleteDir() + + echo "buildStep: ${target} ${compilerLabel} ${toolchain}" + dir("test") { + + // checkout PR. + checkout scm + + // checkout newest Mbed OS release. + sh "mbed new ." + + if (toolchain == "GCC_ARM") { + // use custom release profile from minimal-printf to override functions in GCC. + sh "mbed test -vv --compile -m ${target} -t ${toolchain} -n '*minimal-printf*' --build ci --stats-depth 10 --profile ./profiles/release.json" + } else { + // use default release profile for ARM and IAR. + sh "mbed test -vv --compile -m ${target} -t ${toolchain} -n '*minimal-printf*' --build ci --stats-depth 10" + } + + // stash build directory for testins step. + stash name: "minimal-printf-greentea-${target}-${toolchain}", includes: "ci/**" + } + + step([$class: 'WsCleanup']) + } + } + } +} + +def testStep(target, compilerLabel, toolchain) { + return { + stage("Light suite ${target}_${toolchain}") { + node("${compilerLabel}") { + deleteDir() + + echo "testStep: ${target} ${toolchain}" + + // unstash build directory containing greentea tests. + unstash "minimal-printf-greentea-${target}-${toolchain}" + + // setup RaaS environment. + env.RAAS_USERNAME = raas_username + env.RAAS_PASSWORD = raas_password + env.RAAS_PYCLIENT_FORCE_REMOTE_ALLOCATION = 1 + env.RAAS_PYCLIENT_ALLOCATION_QUEUE_TIMEOUT = raas_timeout + + raas = targets[target]["raas"] + + // execute greentea on RaaS. + execute("mbedgt --grm ${target}:raas_client:${raas}:80 -vV --test-spec ./ci/test_spec.json --polling-timeout 240") + + // Clean up workarea. + step([$class: 'WsCleanup']) + } + } + } +}