From c18b9147aad1cf291ca4201a9327c120ead20bcd Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 9 May 2017 16:35:22 +0100 Subject: [PATCH] Tidy up travis scripts to only set the active build type variables --- .travis.yml | 30 +++++++++++++----------- scripts/travis/compile.sh | 48 +++++++++++++++++++++++++++++++++++++++ scripts/travis/setup.sh | 48 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 scripts/travis/compile.sh create mode 100644 scripts/travis/setup.sh diff --git a/.travis.yml b/.travis.yml index 0b4910113..14fe13851 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,16 @@ env: global: - RENDERDOC_TRAVIS_BUILD=1 RENDERDOC_CI_BUILD=1 +# variables for the matrix, which are implicitly unset if omitted +# +# DOCS_BUILD - set for docs builds, unset for code builds +# +# At least one of these should be set: +# +# LINUX_BUILD - set for linux builds +# APPLE_BUILD - set for OSX builds +# ANDROID_BUILD - set for android builds + matrix: fast_finish: true include: @@ -17,36 +27,30 @@ matrix: - os: linux dist: trusty sudo: false - env: CODE_BUILD=0 LINUX_BUILD=0 APPLE_BUILD=0 DOCS_BUILD=1 ANDROID_BUILD=0 + env: DOCS_BUILD=1 - os: linux dist: trusty sudo: required - env: CODE_BUILD=1 LINUX_BUILD=1 APPLE_BUILD=0 DOCS_BUILD=0 ANDROID_BUILD=0 + env: LINUX_BUILD=1 compiler: gcc - os: linux dist: trusty sudo: required - env: CODE_BUILD=1 LINUX_BUILD=1 APPLE_BUILD=0 DOCS_BUILD=0 ANDROID_BUILD=0 + env: LINUX_BUILD=1 compiler: clang - os: linux dist: trusty sudo: required - env: CODE_BUILD=1 LINUX_BUILD=0 APPLE_BUILD=0 DOCS_BUILD=0 ANDROID_BUILD=1 + env: ANDROID_BUILD=1 compiler: clang - os: osx osx_image: xcode8.2 - env: CODE_BUILD=1 LINUX_BUILD=0 APPLE_BUILD=1 DOCS_BUILD=0 ANDROID_BUILD=0 + env: APPLE_BUILD=1 compiler: clang # install dependencies install: - - if [[ "$DOCS_BUILD" == "1" ]]; then . ./scripts/travis/docs_setup.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$LINUX_BUILD" == 1 ]]; then . ./scripts/travis/linux_setup.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$ANDROID_BUILD" == 1 ]]; then . ./scripts/travis/android_setup.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$APPLE_BUILD" == 1 ]]; then . ./scripts/travis/osx_setup.sh ; fi + - . ./scripts/travis/setup.sh script: - - if [[ "$DOCS_BUILD" == "1" ]]; then . ./scripts/travis/docs_compile.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$LINUX_BUILD" == 1 ]]; then . ./scripts/travis/linux_compile.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$ANDROID_BUILD" == 1 ]]; then . ./scripts/travis/android_compile.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$CODE_BUILD" == "1" ]] && [[ "$APPLE_BUILD" == 1 ]]; then . ./scripts/travis/osx_compile.sh ; fi + - . ./scripts/travis/compile.sh diff --git a/scripts/travis/compile.sh b/scripts/travis/compile.sh new file mode 100644 index 000000000..ee4b40fa0 --- /dev/null +++ b/scripts/travis/compile.sh @@ -0,0 +1,48 @@ +if [[ "$DOCS_BUILD" == "1" ]]; then + + echo "== Compiling documentation build."; + + . ./scripts/travis/docs_compile.sh; + +else + + echo "== Compiling code build."; + + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + + if [[ "$LINUX_BUILD" == "1" ]]; then + + . ./scripts/travis/linux_compile.sh; + + elif [[ "$ANDROID_BUILD" == "1" ]]; then + + . ./scripts/travis/android_compile.sh; + + else + + echo "Unknown configuration building on linux - not targetting linux or android."; + exit 1; + + fi + + elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + + if [[ "$APPLE_BUILD" == "1" ]]; then + + . ./scripts/travis/osx_compile.sh + + else + + echo "Unknown configuration building on OSX - not targetting OSX."; + exit 1; + + fi + + else + + echo "Unknown travis OS: $TRAVIS_OS_NAME."; + exit 1; + + fi + +fi diff --git a/scripts/travis/setup.sh b/scripts/travis/setup.sh new file mode 100644 index 000000000..9dd43ed27 --- /dev/null +++ b/scripts/travis/setup.sh @@ -0,0 +1,48 @@ +if [[ "$DOCS_BUILD" == "1" ]]; then + + echo "== Setting up documentation build."; + + . ./scripts/travis/docs_setup.sh; + +else + + echo "== Setting up code build."; + + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + + if [[ "$LINUX_BUILD" == "1" ]]; then + + . ./scripts/travis/linux_setup.sh; + + elif [[ "$ANDROID_BUILD" == "1" ]]; then + + . ./scripts/travis/android_setup.sh; + + else + + echo "Unknown configuration building on linux - not targetting linux or android."; + exit 1; + + fi + + elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + + if [[ "$APPLE_BUILD" == "1" ]]; then + + . ./scripts/travis/osx_setup.sh + + else + + echo "Unknown configuration building on OSX - not targetting OSX."; + exit 1; + + fi + + else + + echo "Unknown travis OS: $TRAVIS_OS_NAME."; + exit 1; + + fi + +fi