From c70a81558975d5f9b2d4d1cb922ffb3f6e237e92 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Tue, 4 Jul 2017 16:34:58 +0200 Subject: [PATCH] Refactored travis scripts --- .travis.yml | 240 +++++++++++++++++++------------------- travis/build-helper.sh | 6 +- travis/build.sh | 24 ++-- travis/generate_travis.py | 16 +-- 4 files changed, 143 insertions(+), 143 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b45b7f4a..e700009c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,59 +35,59 @@ jobs: - stage: Build (1st run) os: osx compiler: clang - env: BUILD=DefaultDebug COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultDebug Build1 + script: + travis/build.sh Build1 - stage: Build (1st run) os: osx compiler: clang - env: BUILD=DefaultRelease COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultRelease Build1 + script: + travis/build.sh Build1 # ubuntu-16.10 - stage: Build (1st run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultDebug Build1 + script: + travis/build.sh Build1 before_cache: docker cp storm:/storm/. . - stage: Build (1st run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultRelease Build1 + script: + travis/build.sh Build1 before_cache: docker cp storm:/storm/. . # debian-9 - stage: Build (1st run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultDebug Build1 + script: + travis/build.sh Build1 before_cache: docker cp storm:/storm/. . - stage: Build (1st run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultRelease Build1 + script: + travis/build.sh Build1 before_cache: docker cp storm:/storm/. . @@ -99,59 +99,59 @@ jobs: - stage: Build (2nd run) os: osx compiler: clang - env: BUILD=DefaultDebug COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultDebug Build2 + script: + travis/build.sh Build2 - stage: Build (2nd run) os: osx compiler: clang - env: BUILD=DefaultRelease COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultRelease Build2 + script: + travis/build.sh Build2 # ubuntu-16.10 - stage: Build (2nd run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultDebug Build2 + script: + travis/build.sh Build2 before_cache: docker cp storm:/storm/. . - stage: Build (2nd run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultRelease Build2 + script: + travis/build.sh Build2 before_cache: docker cp storm:/storm/. . # debian-9 - stage: Build (2nd run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultDebug Build2 + script: + travis/build.sh Build2 before_cache: docker cp storm:/storm/. . - stage: Build (2nd run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultRelease Build2 + script: + travis/build.sh Build2 before_cache: docker cp storm:/storm/. . @@ -163,59 +163,59 @@ jobs: - stage: Build (3rd run) os: osx compiler: clang - env: BUILD=DefaultDebug COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultDebug Build3 + script: + travis/build.sh Build3 - stage: Build (3rd run) os: osx compiler: clang - env: BUILD=DefaultRelease COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultRelease Build3 + script: + travis/build.sh Build3 # ubuntu-16.10 - stage: Build (3rd run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultDebug Build3 + script: + travis/build.sh Build3 before_cache: docker cp storm:/storm/. . - stage: Build (3rd run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultRelease Build3 + script: + travis/build.sh Build3 before_cache: docker cp storm:/storm/. . # debian-9 - stage: Build (3rd run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultDebug Build3 + script: + travis/build.sh Build3 before_cache: docker cp storm:/storm/. . - stage: Build (3rd run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultRelease Build3 + script: + travis/build.sh Build3 before_cache: docker cp storm:/storm/. . @@ -227,59 +227,59 @@ jobs: - stage: Build (4th run) os: osx compiler: clang - env: BUILD=DefaultDebug COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultDebug Build4 + script: + travis/build.sh Build4 - stage: Build (4th run) os: osx compiler: clang - env: BUILD=DefaultRelease COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultRelease Build4 + script: + travis/build.sh Build4 # ubuntu-16.10 - stage: Build (4th run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultDebug Build4 + script: + travis/build.sh Build4 before_cache: docker cp storm:/storm/. . - stage: Build (4th run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultRelease Build4 + script: + travis/build.sh Build4 before_cache: docker cp storm:/storm/. . # debian-9 - stage: Build (4th run) os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultDebug Build4 + script: + travis/build.sh Build4 before_cache: docker cp storm:/storm/. . - stage: Build (4th run) os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultRelease Build4 + script: + travis/build.sh Build4 before_cache: docker cp storm:/storm/. . @@ -291,59 +291,59 @@ jobs: - stage: Test all os: osx compiler: clang - env: BUILD=DefaultDebug COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultDebug COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultDebug TestAll + script: + travis/build.sh TestAll - stage: Test all os: osx compiler: clang - env: BUILD=DefaultRelease COMPILER=clang-4.0 STL=libc++ - install: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; + env: CONFIG=DefaultRelease COMPILER=clang-4.0 STL=libc++ + install: travis/install_osx.sh - script: export OS=osx; export COMPILER='clang-4.0'; export STL='libc++'; - travis/build.sh DefaultRelease TestAll + script: + travis/build.sh TestAll # ubuntu-16.10 - stage: Test all os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultDebug LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultDebug TestAll + script: + travis/build.sh TestAll before_cache: docker cp storm:/storm/. . - stage: Test all os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=ubuntu-16.10 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; + env: CONFIG=DefaultRelease LINUX=ubuntu-16.10 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='ubuntu-16.10'; - travis/build.sh DefaultRelease TestAll + script: + travis/build.sh TestAll before_cache: docker cp storm:/storm/. . # debian-9 - stage: Test all os: linux compiler: gcc - env: BUILD=DefaultDebug COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultDebug TestAll + script: + travis/build.sh TestAll before_cache: docker cp storm:/storm/. . - stage: Test all os: linux compiler: gcc - env: BUILD=DefaultRelease COMPILER=gcc-6 LINUX=debian-9 - install: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; + env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc-6 + install: travis/install_linux.sh - script: export OS=linux; export COMPILER='gcc-6'; export LINUX='debian-9'; - travis/build.sh DefaultRelease TestAll + script: + travis/build.sh TestAll before_cache: docker cp storm:/storm/. . diff --git a/travis/build-helper.sh b/travis/build-helper.sh index 30d44c3af..200d82852 100755 --- a/travis/build-helper.sh +++ b/travis/build-helper.sh @@ -152,10 +152,10 @@ echo CXX version: $($CXX --version) echo C++ Standard library location: $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1) echo Normalized C++ Standard library location: $(readlink -f $(echo '#include ' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1)) -case "$1" in +case "$CONFIG" in DefaultDebug) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;; DefaultRelease) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;; -*) echo "Error: you need to specify one of the supported postsubmit modes (see postsubmit.sh)."; exit 1 ;; +*) echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;; esac # Restore timestamps of files @@ -163,4 +163,4 @@ travis_fold start mtime ruby travis/mtime_cache/mtime_cache.rb -g travis/mtime_cache/globs.txt -c travis/mtime_cache/cache.json travis_fold end mtime -run "$2" +run "$1" diff --git a/travis/build.sh b/travis/build.sh index 6b7239449..e46685174 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -1,14 +1,11 @@ #!/bin/bash -x # Inspired by https://github.com/google/fruit -: ${N_JOBS:=2} -: ${TIMEOUT_MAC:=1800} -: ${TIMEOUT_LINUX:=2300} +N_JOBS=2 +TIMEOUT_MAC=1800 +TIMEOUT_LINUX=2300 -if [ "$STL" != "" ] -then - STLARG="-stdlib=$STL" -fi +OS=$TRAVIS_OS_NAME EXITCODE=42 @@ -16,7 +13,7 @@ EXITCODE=42 if [ -f build/skip.txt ] then # Remove flag s.t. tests will be executed - if [[ "$2" == "Build4" ]] + if [[ "$1" == "Build4" ]] then rm build/skip.txt fi @@ -38,22 +35,25 @@ linux) # Execute main process timeout $TIMEOUT_LINUX docker exec storm bash -c " + export CONFIG=$CONFIG; export COMPILER=$COMPILER; export N_JOBS=$N_JOBS; - export STLARG=$STLARG; + export STLARG=; export OS=$OS; cd storm; - travis/build-helper.sh $1 $2" + travis/build-helper.sh $1" EXITCODE=$? ;; osx) # Mac OSX + STLARG="-stdlib=libc++" + export CONFIG=$CONFIG export COMPILER export N_JOBS export STLARG export OS - gtimeout $TIMEOUT_MAC travis/build-helper.sh "$1" "$2" + gtimeout $TIMEOUT_MAC travis/build-helper.sh "$1" EXITCODE=$? ;; @@ -63,7 +63,7 @@ osx) exit 1 esac -if [[ $EXITCODE == 124 ]] && [[ "$2" == Build* ]] && [[ "$2" != "Build4" ]] +if [[ $EXITCODE == 124 ]] && [[ "$1" == Build* ]] && [[ "$1" != "Build4" ]] then exit 0 else diff --git a/travis/generate_travis.py b/travis/generate_travis.py index 7e1ab7735..4fca95f1b 100644 --- a/travis/generate_travis.py +++ b/travis/generate_travis.py @@ -77,11 +77,11 @@ if __name__ == "__main__": buildConfig += " - stage: {}\n".format(stage[0]) buildConfig += " os: osx\n" buildConfig += " compiler: {}\n".format(config[1]) - buildConfig += " env: BUILD={} COMPILER={} STL=libc++\n".format(build, compiler) - buildConfig += " install: export OS=osx; export COMPILER='{}'; export STL='libc++';\n".format(compiler) + buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler) + buildConfig += " install:\n" buildConfig += " travis/install_osx.sh\n" - buildConfig += " script: export OS=osx; export COMPILER='{}'; export STL='libc++';\n".format(compiler) - buildConfig += " travis/build.sh {} {}\n".format(build, stage[1]) + buildConfig += " script:\n" + buildConfig += " travis/build.sh {}\n".format(stage[1]) s += buildConfig # Linux via Docker @@ -94,11 +94,11 @@ if __name__ == "__main__": buildConfig += " - stage: {}\n".format(stage[0]) buildConfig += " os: linux\n" buildConfig += " compiler: {}\n".format(config[1]) - buildConfig += " env: BUILD={} COMPILER={} LINUX={}\n".format(build, compiler, linux) - buildConfig += " install: export OS=linux; export COMPILER='{}'; export LINUX='{}';\n".format(compiler, linux) + buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler) + buildConfig += " install:\n" buildConfig += " travis/install_linux.sh\n" - buildConfig += " script: export OS=linux; export COMPILER='{}'; export LINUX='{}';\n".format(compiler, linux) - buildConfig += " travis/build.sh {} {}\n".format(build, stage[1]) + buildConfig += " script:\n" + buildConfig += " travis/build.sh {}\n".format(stage[1]) buildConfig += " before_cache:\n" buildConfig += " docker cp storm:/storm/. .\n" s += buildConfig