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 # Docker Storm master
- os: linux - os: linux
compiler: gcc compiler: gcc
env: TASK=Test CONFIG=Release DOCKER=storm:travis PYTHON=python3
env: TASK=TestDocker CONFIG=Release DOCKER=storm:travis PYTHON=python3
script: script:
travis/build.sh travis/build.sh
deploy:
- provider: script
skip_cleanup: true
script: bash travis/deploy_docker.sh stormpy
# Docker Storm master in debug mode # Docker Storm master in debug mode
- os: linux - os: linux
compiler: gcc 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: script:
travis/build.sh travis/build.sh
deploy:
- provider: script
skip_cleanup: true
script: bash travis/deploy_docker.sh stormpy
# Docker Storm stable # Docker Storm stable
- os: linux - os: linux
compiler: gcc compiler: gcc

5
setup.py

@ -164,8 +164,6 @@ class CMakeBuild(build_ext):
def initialize_options(self): def initialize_options(self):
build_ext.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 # Set default values for custom cmdline flags
self.storm_dir = None self.storm_dir = None
self.disable_dft = None self.disable_dft = None
@ -175,6 +173,9 @@ class CMakeBuild(build_ext):
def finalize_options(self): def finalize_options(self):
build_ext.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 # Update setup config
self.config.update("storm_dir", self.storm_dir) self.config.update("storm_dir", self.storm_dir)
self.config.update("disable_dft", self.disable_dft) self.config.update("disable_dft", self.disable_dft)

47
travis/build-helper.sh

@ -11,11 +11,27 @@ travis_fold() {
# Helper for building and testing # Helper for building and testing
run() { 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 # 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 # Print version
python --version python --version
travis_fold end virtualenv
# Build pycarl # Build pycarl
travis_fold start build_pycarl travis_fold start build_pycarl
@ -29,11 +45,12 @@ run() {
python setup.py build_ext -j 1 develop python setup.py build_ext -j 1 develop
;; ;;
esac esac
travis_fold end build_pycarl
cd .. cd ..
travis_fold end build_pycarl
# Build stormpy # Build stormpy
travis_fold start build_stormpy travis_fold start build_stormpy
cd stormpy
case "$CONFIG" in case "$CONFIG" in
Debug*) Debug*)
python setup.py build_ext --storm-dir /opt/storm/build/ --debug -j 1 develop python setup.py build_ext --storm-dir /opt/storm/build/ --debug -j 1 develop
@ -44,27 +61,23 @@ run() {
esac esac
travis_fold end build_stormpy travis_fold end build_stormpy
# Perform task
case $TASK in
Test)
# Perform tasks
if [[ "$TASK" == *Test* ]]
then
# Run tests # Run tests
set +e set +e
python setup.py test python setup.py test
;;
fi
Documentation)
if [[ "$TASK" == *Documentation* ]]
then
# Generate documentation # Generate documentation
pip install sphinx sphinx_bootstrap_theme pip install sphinx sphinx_bootstrap_theme
cd doc cd doc
make html make html
touch build/html/.nojekyll touch build/html/.nojekyll
rm -r build/html/_sources rm -r build/html/_sources
;;
*)
echo "Unrecognized value of TASK: $TASK"
exit 1
esac
fi
} }
@ -72,4 +85,10 @@ run() {
# ignored). # ignored).
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" 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 run

15
travis/build.sh

@ -1,5 +1,12 @@
#!/bin/bash -x #!/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 N_JOBS=2
OS=$TRAVIS_OS_NAME OS=$TRAVIS_OS_NAME
@ -15,15 +22,21 @@ linux)
# Copy local content into container # Copy local content into container
docker exec stormpy mkdir /opt/stormpy docker exec stormpy mkdir /opt/stormpy
docker cp . stormpy:/opt/stormpy docker cp . stormpy:/opt/stormpy
# Install virtualenv
travis_fold start install_dependencies
docker exec stormpy apt-get update 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 docker exec stormpy apt-get install -qq -y python python3 virtualenv
travis_fold end install_dependencies
set +e set +e
# Execute main process # Execute main process
docker exec stormpy bash -c " docker exec stormpy bash -c "
export N_JOBS=$N_JOBS; export N_JOBS=$N_JOBS;
export OS=$OS; export OS=$OS;
export STLARG=;
export PYTHON=$PYTHON; export PYTHON=$PYTHON;
export CONFIG=$CONFIG; export CONFIG=$CONFIG;
export TASK=$TASK; 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