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.
This commit is contained in:
Lucas De Marchi 2015-06-15 22:03:23 -03:00 committed by Andrew Tridgell
parent a435269839
commit ac09a61238
2 changed files with 18 additions and 21 deletions

View File

@ -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:

View File

@ -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