Sebastian Junges 5 years ago
parent
commit
4f19598e49
  1. 12
      .travis.yml
  2. 5
      setup.py
  3. 47
      travis/build-helper.sh
  4. 15
      travis/build.sh
  5. 48
      travis/deploy_docker.sh

12
.travis.yml

@ -28,15 +28,23 @@ jobs:
# Docker Storm master
- os: linux
compiler: gcc
env: TASK=Test CONFIG=Release DOCKER=storm:travis PYTHON=python3
env: TASK=TestDocker CONFIG=Release DOCKER=storm:travis PYTHON=python3
script:
travis/build.sh
deploy:
- provider: script
skip_cleanup: true
script: bash travis/deploy_docker.sh stormpy
# Docker Storm master in debug mode
- os: linux
compiler: gcc
env: TASK=Test CONFIG=Debug DOCKER=storm:travis-debug PYTHON=python3
env: TASK=TestDocker CONFIG=Debug DOCKER=storm:travis-debug PYTHON=python3
script:
travis/build.sh
deploy:
- provider: script
skip_cleanup: true
script: bash travis/deploy_docker.sh stormpy
# Docker Storm stable
- os: linux
compiler: gcc

5
setup.py

@ -164,8 +164,6 @@ class CMakeBuild(build_ext):
def initialize_options(self):
build_ext.initialize_options(self)
# Load setup config
self.config.load_from_file("build/build_config.cfg")
# Set default values for custom cmdline flags
self.storm_dir = None
self.disable_dft = None
@ -175,6 +173,9 @@ class CMakeBuild(build_ext):
def finalize_options(self):
build_ext.finalize_options(self)
# Load setup config
# This can only be done after the finalization step, because otherwise build_temp is not initialized yet.
self.config.load_from_file(os.path.join(self.build_temp, "build_config.cfg"))
# Update setup config
self.config.update("storm_dir", self.storm_dir)
self.config.update("disable_dft", self.disable_dft)

47
travis/build-helper.sh

@ -11,11 +11,27 @@ travis_fold() {
# Helper for building and testing
run() {
# We start in /opt/stormpy
cd ..
# Build carl-parser
travis_fold start build_carl_parser
git clone --single-branch -b master14 https://github.com/ths-rwth/carl-parser
cd carl-parser
mkdir build
cd build
cmake .. "${CMAKE_ARGS[@]}"
make carl-parser -j 1
cd ../..
travis_fold end build_carl_parser
# Create virtual environment
virtualenv --python=$PYTHON stormpy-env
source stormpy-env/bin/activate
travis_fold start virtualenv
virtualenv --python=$PYTHON venv
source venv/bin/activate
# Print version
python --version
travis_fold end virtualenv
# Build pycarl
travis_fold start build_pycarl
@ -29,11 +45,12 @@ run() {
python setup.py build_ext -j 1 develop
;;
esac
travis_fold end build_pycarl
cd ..
travis_fold end build_pycarl
# Build stormpy
travis_fold start build_stormpy
cd stormpy
case "$CONFIG" in
Debug*)
python setup.py build_ext --storm-dir /opt/storm/build/ --debug -j 1 develop
@ -44,27 +61,23 @@ run() {
esac
travis_fold end build_stormpy
# Perform task
case $TASK in
Test)
# Perform tasks
if [[ "$TASK" == *Test* ]]
then
# Run tests
set +e
python setup.py test
;;
fi
Documentation)
if [[ "$TASK" == *Documentation* ]]
then
# Generate documentation
pip install sphinx sphinx_bootstrap_theme
cd doc
make html
touch build/html/.nojekyll
rm -r build/html/_sources
;;
*)
echo "Unrecognized value of TASK: $TASK"
exit 1
esac
fi
}
@ -72,4 +85,10 @@ run() {
# ignored).
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
case "$CONFIG" in
Debug*) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$STLARG") ;;
Release*) CMAKE_ARGS=(-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="$STLARG") ;;
*) echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 ;;
esac
run

15
travis/build.sh

@ -1,5 +1,12 @@
#!/bin/bash -x
# Helper for travis folding
travis_fold() {
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r"
}
N_JOBS=2
OS=$TRAVIS_OS_NAME
@ -15,15 +22,21 @@ linux)
# Copy local content into container
docker exec stormpy mkdir /opt/stormpy
docker cp . stormpy:/opt/stormpy
# Install virtualenv
travis_fold start install_dependencies
docker exec stormpy apt-get update
# Install dependencies for carl-parser
docker exec stormpy apt-get install -qq -y maven uuid-dev
# Install virtualenv
docker exec stormpy apt-get install -qq -y python python3 virtualenv
travis_fold end install_dependencies
set +e
# Execute main process
docker exec stormpy bash -c "
export N_JOBS=$N_JOBS;
export OS=$OS;
export STLARG=;
export PYTHON=$PYTHON;
export CONFIG=$CONFIG;
export TASK=$TASK;

48
travis/deploy_docker.sh

@ -0,0 +1,48 @@
#!/bin/bash -x
set -e
OS=$TRAVIS_OS_NAME
# Do not deploy if credentials are not given
if [ "${TRAVIS_SECURE_ENV_VARS}" == "false" ]; then
echo "WARNING: Not deploying as no credentials are given."
exit 0;
fi
# Do not deploy for pull requests
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
exit 0;
fi
echo "Deploying $1 to Dockerhub"
case $OS in
linux)
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# Deploy as debug/release
case "$CONFIG" in
*Debug*)
docker commit $1 movesrwth/$1:travis-debug
docker push movesrwth/$1:travis-debug
;;
*Release*)
docker commit $1 movesrwth/$1:travis
docker push movesrwth/$1:travis
;;
*)
echo "Unrecognized value of CONFIG: $CONFIG"; exit 1
;;
esac
;;
osx)
echo "Docker deployment on Mac OSX not used."
exit 1
;;
*)
# Unknown OS
echo "Unsupported OS: $OS"
exit 1
esac
Loading…
Cancel
Save