Browse Source

Travis: generate better docker container

tempestpy_adaptions
Matthias Volk 7 years ago
parent
commit
bdae2a7b5d
  1. 169
      .travis.yml
  2. 32
      travis/build-helper.sh
  3. 7
      travis/build.sh
  4. 112
      travis/generate_travis.py

169
.travis.yml

@ -1,5 +1,3 @@
# This file was inspired from https://github.com/google/fruit
#
# General config
#
@ -39,11 +37,11 @@ jobs:
# Stage: Build (1st run)
###
# ubuntu-17.10
# debian-9 - DefaultDebug
- stage: Build (1st run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc
install:
- rm -rf build
- travis/install_linux.sh
@ -53,10 +51,39 @@ jobs:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# debian-9 - DefaultRelease
- stage: Build (1st run)
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc
install:
- rm -rf build
- travis/install_linux.sh
script:
- travis/build.sh Build1
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultDebugTravis
- stage: Build (1st run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebugTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- rm -rf build
- travis/install_linux.sh
script:
- travis/build.sh Build1
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultReleaseTravis
- stage: Build (1st run)
os: linux
compiler: gcc
env: CONFIG=DefaultReleaseTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- rm -rf build
- travis/install_linux.sh
@ -71,11 +98,11 @@ jobs:
# Stage: Build (2nd run)
###
# ubuntu-17.10
# debian-9 - DefaultDebug
- stage: Build (2nd run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -84,10 +111,37 @@ jobs:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# debian-9 - DefaultRelease
- stage: Build (2nd run)
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh Build2
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultDebugTravis
- stage: Build (2nd run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebugTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh Build2
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultReleaseTravis
- stage: Build (2nd run)
os: linux
compiler: gcc
env: CONFIG=DefaultReleaseTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -101,11 +155,11 @@ jobs:
# Stage: Build (3rd run)
###
# ubuntu-17.10
# debian-9 - DefaultDebug
- stage: Build (3rd run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -114,10 +168,37 @@ jobs:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# debian-9 - DefaultRelease
- stage: Build (3rd run)
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh Build3
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultDebugTravis
- stage: Build (3rd run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebugTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh Build3
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultReleaseTravis
- stage: Build (3rd run)
os: linux
compiler: gcc
env: CONFIG=DefaultReleaseTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -131,11 +212,37 @@ jobs:
# Stage: Build (4th run)
###
# ubuntu-17.10
# debian-9 - DefaultDebug
- stage: Build (4th run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh BuildLast
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# debian-9 - DefaultRelease
- stage: Build (4th run)
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh BuildLast
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultDebugTravis
- stage: Build (4th run)
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultDebugTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -144,10 +251,11 @@ jobs:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultReleaseTravis
- stage: Build (4th run)
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultReleaseTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -161,11 +269,37 @@ jobs:
# Stage: Test all
###
# ubuntu-17.10
# debian-9 - DefaultDebug
- stage: Test all
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh TestAll
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# debian-9 - DefaultRelease
- stage: Test all
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=debian-9 COMPILER=gcc
install:
- travis/install_linux.sh
script:
- travis/build.sh TestAll
before_cache:
- docker cp storm:/storm/. .
after_failure:
- find build -iname '*err*.log' -type f -print -exec cat {} \;
# ubuntu-17.10 - DefaultDebugTravis
- stage: Test all
os: linux
compiler: gcc
env: CONFIG=DefaultDebug LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultDebugTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:
@ -178,10 +312,11 @@ jobs:
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
- docker commit storm mvolk/storm-debug:travis;
- docker push mvolk/storm-debug:travis;
# ubuntu-17.10 - DefaultReleaseTravis
- stage: Test all
os: linux
compiler: gcc
env: CONFIG=DefaultRelease LINUX=ubuntu-17.10 COMPILER=gcc
env: CONFIG=DefaultReleaseTravis LINUX=ubuntu-17.10 COMPILER=gcc
install:
- travis/install_linux.sh
script:

32
travis/build-helper.sh

@ -1,5 +1,4 @@
#!/bin/bash
# Inspired by https://github.com/google/fruit
set -e
@ -24,6 +23,23 @@ run() {
Build*)
if [[ "$1" == "Build1" ]]
then
if [[ "$CONFIG" == "*Travis" ]]
then
# Build Carl separately
travis_fold start install_carl
cd ..
git clone https://github.com/smtrat/carl.git
cd carl
mkdir build
cd build
cmake .. "${CARL_CMAKE_ARGS[@]}"
make lib_carl -j$N_JOBS
cd ../../storm
travis_fold end install_carl
fi
# CMake
travis_fold start cmake
mkdir build
@ -114,9 +130,17 @@ echo C++ Standard library location: $(echo '#include <vector>' | $CXX -x c++ -E
echo Normalized C++ Standard library location: $(readlink -f $(echo '#include <vector>' | $CXX -x c++ -E - | grep 'vector\"' | awk '{print $3}' | sed 's@/vector@@;s@\"@@g' | head -n 1))
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 "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;;
DefaultDebug*)
CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DSTORM_DEVELOPER=ON -DCMAKE_CXX_FLAGS="$STLARG")
CARL_CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG" -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON)
;;
DefaultRelease*)
CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DSTORM_DEVELOPER=OFF -DCMAKE_CXX_FLAGS="$STLARG")
CARL_CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG" -DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON -DTHREAD_SAFE=ON -DBUILD_ADDONS=ON -DBUILD_ADDON_PARSER=ON)
;;
*)
echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
;;
esac
# Restore timestamps of files

7
travis/build.sh

@ -1,5 +1,4 @@
#!/bin/bash -x
# Inspired by https://github.com/google/fruit
N_JOBS=2
TIMEOUT_MAC=1600
@ -29,8 +28,8 @@ linux)
set -e
docker run -d -it --name storm --privileged mvolk/storm-basesystem:$LINUX
# Copy local content into container
docker exec storm mkdir storm
docker cp . storm:/storm
docker exec storm mkdir opt/storm
docker cp . storm:/opt/storm
set +e
# Execute main process
@ -40,7 +39,7 @@ linux)
export N_JOBS=$N_JOBS;
export STLARG=;
export OS=$OS;
cd storm;
cd opt/storm;
travis/build-helper.sh $1"
EXITCODE=$?
;;

112
travis/generate_travis.py

@ -1,21 +1,19 @@
# Generate .travis.yml automatically
# Configuration for Linux
configs_linux = [
# OS, compiler
("ubuntu-17.10", "gcc", ""),
#("debian-9", "gcc", ""),
# OS, compiler, build type
("debian-9", "gcc", "DefaultDebug"),
("debian-9", "gcc", "DefaultRelease"),
("ubuntu-17.10", "gcc", "DefaultDebugTravis"),
("ubuntu-17.10", "gcc", "DefaultReleaseTravis"),
]
# Configurations for Mac
configs_mac = [
# OS, compiler
# ("osx", "clang", ""),
]
# Build types
build_types = [
"DefaultDebug",
"DefaultRelease",
# OS, compiler, build type
# ("osx", "clang", "DefaultDebug"),
# ("osx", "clang", "DefaultRelease"),
]
# Stages in travis
@ -31,8 +29,6 @@ stages = [
if __name__ == "__main__":
s = ""
# Initial config
s += "# This file was inspired from https://github.com/google/fruit\n"
s += "\n"
s += "#\n"
s += "# General config\n"
s += "#\n"
@ -79,58 +75,58 @@ if __name__ == "__main__":
# Mac OS X
for config in configs_mac:
osx = config[0]
compiler = "{}{}".format(config[1], config[2])
s += " # {}\n".format(osx)
compiler = config[1]
build_type = config[2]
s += " # {} - {}\n".format(osx, build_type)
buildConfig = ""
for build in build_types:
buildConfig += " - stage: {}\n".format(stage[0])
buildConfig += " os: osx\n"
buildConfig += " osx_image: xcode9.1\n"
buildConfig += " compiler: {}\n".format(config[1])
buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build, compiler)
buildConfig += " install:\n"
if stage[1] == "Build1":
buildConfig += " - rm -rf build\n"
buildConfig += " - travis/install_osx.sh\n"
buildConfig += " script:\n"
buildConfig += " - travis/build.sh {}\n".format(stage[1])
buildConfig += " after_failure:\n"
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
buildConfig += " - stage: {}\n".format(stage[0])
buildConfig += " os: osx\n"
buildConfig += " osx_image: xcode9.1\n"
buildConfig += " compiler: {}\n".format(compiler)
buildConfig += " env: CONFIG={} COMPILER={} STL=libc++\n".format(build_type, compiler)
buildConfig += " install:\n"
if stage[1] == "Build1":
buildConfig += " - rm -rf build\n"
buildConfig += " - travis/install_osx.sh\n"
buildConfig += " script:\n"
buildConfig += " - travis/build.sh {}\n".format(stage[1])
buildConfig += " after_failure:\n"
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
s += buildConfig
# Linux via Docker
for config in configs_linux:
linux = config[0]
compiler = "{}{}".format(config[1], config[2])
s += " # {}\n".format(linux)
compiler = config[1]
build_type = config[2]
s += " # {} - {}\n".format(linux, build_type)
buildConfig = ""
for build in build_types:
buildConfig += " - stage: {}\n".format(stage[0])
buildConfig += " os: linux\n"
buildConfig += " compiler: {}\n".format(config[1])
buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build, linux, compiler)
buildConfig += " install:\n"
if stage[1] == "Build1":
buildConfig += " - rm -rf build\n"
buildConfig += " - travis/install_linux.sh\n"
buildConfig += " script:\n"
buildConfig += " - travis/build.sh {}\n".format(stage[1])
buildConfig += " before_cache:\n"
buildConfig += " - docker cp storm:/storm/. .\n"
buildConfig += " after_failure:\n"
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
# Upload to dockerhub
if stage[1] == "TestAll":
buildConfig += " after_success:\n"
buildConfig += ' - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";\n'
if "Debug" in build:
buildConfig += " - docker commit storm mvolk/storm-debug:travis;\n"
buildConfig += " - docker push mvolk/storm-debug:travis;\n"
elif "Release" in build:
buildConfig += " - docker commit storm mvolk/storm:travis;\n"
buildConfig += " - docker push mvolk/storm:travis;\n"
else:
assert False
buildConfig += " - stage: {}\n".format(stage[0])
buildConfig += " os: linux\n"
buildConfig += " compiler: {}\n".format(compiler)
buildConfig += " env: CONFIG={} LINUX={} COMPILER={}\n".format(build_type, linux, compiler)
buildConfig += " install:\n"
if stage[1] == "Build1":
buildConfig += " - rm -rf build\n"
buildConfig += " - travis/install_linux.sh\n"
buildConfig += " script:\n"
buildConfig += " - travis/build.sh {}\n".format(stage[1])
buildConfig += " before_cache:\n"
buildConfig += " - docker cp storm:/storm/. .\n"
buildConfig += " after_failure:\n"
buildConfig += " - find build -iname '*err*.log' -type f -print -exec cat {} \;\n"
# Upload to DockerHub
if stage[1] == "TestAll" and "Travis" in build_type:
buildConfig += " after_success:\n"
buildConfig += ' - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";\n'
if "Debug" in build_type:
buildConfig += " - docker commit storm mvolk/storm-debug:travis;\n"
buildConfig += " - docker push mvolk/storm-debug:travis;\n"
elif "Release" in build_type:
buildConfig += " - docker commit storm mvolk/storm:travis;\n"
buildConfig += " - docker push mvolk/storm:travis;\n"
else:
assert False
s += buildConfig
print(s)
Loading…
Cancel
Save