From ac09a6123875b7c5b0b398b645c6101ecae1f09a Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 15 Jun 2015 22:03:23 -0300 Subject: [PATCH] Travis: split build by target instead of vehicle This way we can group together the builds that are fast so we pay the "setup price" just once. Let the long PX4 build on its own VM because it's the one that takes most of the time building NuttX. By grouping the projects by target it's also easier to split the build in more VMs if we want to speed up the build. --- .travis.yml | 7 ++----- Tools/scripts/build_all_travis.sh | 32 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10c3a6a422..14610974fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,8 @@ env: # via the "travis encrypt" command using the project repo's public key - secure: "FjIwqZQV2FhNPWYITX5LZXTE38yYqBaQdbm3QmbEg/30wnPTm1ZOLIU7o/aSvX615ImR8kHoryvFPDQDWc6wWfqTEs3Ytq2kIvcIJS2Y5l/0PFfpWJoH5gRd6hDThnoi+1oVMLvj1+bhn4yFlCCQ2vT/jxoGfiQqqgvHtv4fLzI=" matrix: - - TRAVIS_BUILD_TYPE=ArduPlane - - TRAVIS_BUILD_TYPE=ArduCopter - - TRAVIS_BUILD_TYPE=APMrover2 - - TRAVIS_BUILD_TYPE=AntennaTracker - - TRAVIS_BUILD_TYPE=Tools/Replay + - TRAVIS_BUILD_TARGET="px4-v2" + - TRAVIS_BUILD_TARGET="sitl linux apm2 navio" addons: coverity_scan: diff --git a/Tools/scripts/build_all_travis.sh b/Tools/scripts/build_all_travis.sh index 5e72bd271d..14b3208dc9 100755 --- a/Tools/scripts/build_all_travis.sh +++ b/Tools/scripts/build_all_travis.sh @@ -10,12 +10,10 @@ set -x . ~/.profile -travis_build_type_or_empty() { - if [ -z "$TRAVIS_BUILD_TYPE" ] || [ "$TRAVIS_BUILD_TYPE" = "$1" ]; then - return 0 - fi - return 1 -} +# If TRAVIS_BUILD_TARGET is not set, default to all of them +if [ -z "$TRAVIS_BUILD_TARGET" ]; then + TRAVIS_BUILD_TARGET="sitl linux apm2 navio px4-v2" +fi declare -A build_platforms declare -A build_concurrency @@ -35,19 +33,21 @@ build_concurrency=(["apm2"]="-j2" build_extra_clean=(["px4-v2"]="make px4-cleandep") -for d in "${!build_platforms[@]}"; do - if ! travis_build_type_or_empty "$d"; then - continue - fi +echo "Targets: $TRAVIS_BUILD_TARGET" +for t in $TRAVIS_BUILD_TARGET; do + for v in ${!build_platforms[@]}; do + if [[ ${build_platforms[$v]} != *$t* ]]; then + continue + fi + echo "Building $v for ${t}..." - pushd $d - for p in ${build_platforms["$d"]}; do + pushd $v make clean - if [ ${build_extra_clean[$p]+_} ]; then - ${build_extra_clean[$p]} + if [ ${build_extra_clean[$t]+_} ]; then + ${build_extra_clean[$t]} fi - make $p ${build_concurrency[$p]} + make $t ${build_concurrency[$t]} + popd done - popd done