From 5933dbf62abdae14c8153e681dccd7f4a1f2aa00 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 15 Jun 2016 18:12:12 -0700 Subject: [PATCH] Have .travis.yml point to scripts in the .travis directory. (#156) --- .travis.yml | 86 +++++++++------------------------------ .travis/before_install.sh | 70 +++++++++++++++++++++++++++++++ .travis/script.sh | 52 +++++++++++++++++++++++ 3 files changed, 142 insertions(+), 66 deletions(-) create mode 100755 .travis/before_install.sh create mode 100755 .travis/script.sh diff --git a/.travis.yml b/.travis.yml index 4b5536857..4fa39be15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,77 +28,31 @@ language: cpp -env: - - BUILD_TARGET="posix" - - BUILD_TARGET="cc2538" +sudo: required -compiler: - - clang - - gcc +before_install: + - .travis/before_install.sh -os: - - linux - - osx +script: + - .travis/script.sh matrix: include: - env: BUILD_TARGET="pretty-check" compiler: clang os: linux - exclude: - - compiler: clang - env: BUILD_TARGET="cc2538" - - os: osx - env: BUILD_TARGET="cc2538" - -before_install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install python-pexpect; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo easy_install pexpect; fi - -install: - - if [ "$BUILD_TARGET" == "pretty-check" ]; then - pushd ~ && - wget https://sourceforge.net/projects/astyle/files/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz/download -O astyle.tar.gz && - tar xzvf astyle.tar.gz && - pushd astyle/build/gcc && LDFLAGS=" " make && - export PATH=$PWD/bin:$PATH && - popd && - popd && - astyle --version ; - fi - - - if [ "$BUILD_TARGET" == "cc2538" ] && [ "$TRAVIS_OS_NAME" == "linux" ] ; then - sudo apt-get install lib32z1 && - pushd ~ && - wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 && - tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 && - export PATH=$PWD/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH && - popd && - arm-none-eabi-gcc --version ; - fi - - - if [ "$BUILD_TARGET" == "cc2538" ] && [ "$TRAVIS_OS_NAME" == "osx" ] ; then - pushd ~ && - wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 && - tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 && - export PATH=$PWD/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH && - popd && - arm-none-eabi-gcc --version ; - fi - -script: - - if [ "$BUILD_TARGET" == "pretty-check" ]; then - ./bootstrap && - ./configure && - make pretty-check ; - fi - - - if [ "$BUILD_TARGET" == "posix" ]; then - ./bootstrap && - make -f Makefile-Standalone distcheck ; - fi - - - if [ "$BUILD_TARGET" == "cc2538" ]; then - ./bootstrap && - make -f examples/cc2538/Makefile-cc2538 ; - fi + - env: BUILD_TARGET="posix" + compiler: clang + os: linux + - env: BUILD_TARGET="posix" + compiler: clang + os: osx + - env: BUILD_TARGET="posix" + compiler: gcc + os: linux + - env: BUILD_TARGET="posix" + compiler: gcc + os: osx + - env: BUILD_TARGET="cc2538" + compiler: gcc + os: linux diff --git a/.travis/before_install.sh b/.travis/before_install.sh new file mode 100755 index 000000000..4e2b67f9c --- /dev/null +++ b/.travis/before_install.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (c) 2016, Nest Labs, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +die() { + echo " *** ERROR: " $* + exit 1 +} + +set -x + +cd /tmp || die + +[ $TRAVIS_OS_NAME != linux ] || { + sudo apt-get install python-pexpect || die + + [ $BUILD_TARGET != cc2538 ] || { + sudo apt-get install lib32z1 || die + wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die + tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die + export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die + arm-none-eabi-gcc --version || die + } +} + +[ $TRAVIS_OS_NAME != osx ] || { + sudo easy_install pexpect || die + + [ $BUILD_TARGET != cc2538 ] || { + wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 || die + tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-mac.tar.bz2 || die + export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die + arm-none-eabi-gcc --version || die + } +} + +[ $BUILD_TARGET != pretty-check ] || { + wget https://sourceforge.net/projects/astyle/files/astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz/download -O astyle.tar.gz || die + tar xzvf astyle.tar.gz || die + cd astyle/build/gcc || die + LDFLAGS=" " make || die + cd ../../.. + export PATH=/tmp/astyle/build/gcc/bin:$PATH || die + astyle --version || die +} diff --git a/.travis/script.sh b/.travis/script.sh new file mode 100755 index 000000000..aef1e4608 --- /dev/null +++ b/.travis/script.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (c) 2016, Nest Labs, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +die() { + echo " *** ERROR: " $* + exit 1 +} + +set -x + +./bootstrap || die + +[ $BUILD_TARGET != pretty-check ] || { + export PATH=/tmp/astyle/build/gcc/bin:$PATH || die + ./configure || die + make pretty || die +} + +[ $BUILD_TARGET != posix ] || { + make -f Makefile-Standalone distcheck || die +} + +[ $BUILD_TARGET != cc2538 ] || { + export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die + make -f examples/cc2538/Makefile-cc2538 || die +}