diff --git a/.travis.yml b/.travis.yml index 26478356a..f8ac4ef4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,9 +52,7 @@ jobs: script: - travis/build_carl.sh after_success: - - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - - docker commit carl movesrwth/carl:travis-debug; - - docker push movesrwth/carl:travis-debug; + - travis/deploy_carl.sh # ubuntu-18.04 - DefaultReleaseTravis - stage: Build Carl os: linux @@ -67,9 +65,7 @@ jobs: script: - travis/build_carl.sh after_success: - - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - - docker commit carl movesrwth/carl:travis; - - docker push movesrwth/carl:travis; + - travis/deploy_carl.sh ### # Stage: Build (1st run) @@ -507,9 +503,7 @@ jobs: after_failure: - find build -iname '*err*.log' -type f -print -exec cat {} \; after_success: - - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - - docker commit storm movesrwth/storm:travis-debug; - - docker push movesrwth/storm:travis-debug; + - travis/deploy_storm.sh # ubuntu-18.04 - DefaultReleaseTravis - stage: Test all os: linux @@ -526,9 +520,7 @@ jobs: after_failure: - find build -iname '*err*.log' -type f -print -exec cat {} \; after_success: - - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - - docker commit storm movesrwth/storm:travis; - - docker push movesrwth/storm:travis; + - travis/deploy_storm.sh # ubuntu-18.04 - DefaultDebug - stage: Test all os: linux diff --git a/travis/deploy_carl.sh b/travis/deploy_carl.sh new file mode 100755 index 000000000..f66974c00 --- /dev/null +++ b/travis/deploy_carl.sh @@ -0,0 +1,39 @@ +#!/bin/bash -x + +set -e + +OS=$TRAVIS_OS_NAME + +case $OS in +linux) + # Only deploy for non pull requests + if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + # Deploy as debug/release + case "$CONFIG" in + *DebugTravis) + docker commit carl movesrwth/carl:travis-debug + docker push movesrwth/carl:travis-debug + ;; + *ReleaseTravis) + docker commit carl movesrwth/carl:travis + docker push movesrwth/carl:travis + ;; + *) + echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 + ;; + esac + fi + ;; + +osx) + echo "Building carl on Mac OSX not used." + exit 1 + ;; + +*) + # Unknown OS + echo "Unsupported OS: $OS" + exit 1 +esac + diff --git a/travis/deploy_storm.sh b/travis/deploy_storm.sh new file mode 100755 index 000000000..f026eaae6 --- /dev/null +++ b/travis/deploy_storm.sh @@ -0,0 +1,39 @@ +#!/bin/bash -x + +set -e + +OS=$TRAVIS_OS_NAME + +case $OS in +linux) + # Only deploy for non pull requests + if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + # Deploy as debug/release + case "$CONFIG" in + *DebugTravis) + docker commit storm movesrwth/storm:travis-debug + docker push movesrwth/storm:travis-debug + ;; + *ReleaseTravis) + docker commit storm movesrwth/storm:travis + docker push movesrwth/storm:travis + ;; + *) + echo "Unrecognized value of CONFIG: $CONFIG"; exit 1 + ;; + esac + fi + ;; + +osx) + echo "Building Storm on Mac OSX not used." + exit 1 + ;; + +*) + # Unknown OS + echo "Unsupported OS: $OS" + exit 1 +esac + diff --git a/travis/generate_travis.py b/travis/generate_travis.py index 89483ba9e..258ea6e2c 100644 --- a/travis/generate_travis.py +++ b/travis/generate_travis.py @@ -97,15 +97,7 @@ if __name__ == "__main__": buildConfig += " - travis/build_carl.sh\n" # Upload to DockerHub buildConfig += " after_success:\n" - buildConfig += ' - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";\n' - if "Debug" in build_type: - buildConfig += " - docker commit carl movesrwth/carl:travis-debug;\n" - buildConfig += " - docker push movesrwth/carl:travis-debug;\n" - elif "Release" in build_type: - buildConfig += " - docker commit carl movesrwth/carl:travis;\n" - buildConfig += " - docker push movesrwth/carl:travis;\n" - else: - assert False + buildConfig += " - travis/deploy_carl.sh\n" s += buildConfig # Generate all configurations @@ -169,15 +161,7 @@ if __name__ == "__main__": # 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 movesrwth/storm:travis-debug;\n" - buildConfig += " - docker push movesrwth/storm:travis-debug;\n" - elif "Release" in build_type: - buildConfig += " - docker commit storm movesrwth/storm:travis;\n" - buildConfig += " - docker push movesrwth/storm:travis;\n" - else: - assert False + buildConfig += " - travis/deploy_storm.sh\n" s += buildConfig if "Travis" in build_type and "Release" in build_type: allow_failures.append(allow_fail)