#
# General config
#
branches:
  only:
  - master
  - stable
sudo: required
language: cpp

git:
  depth: false

# Enable caching
cache:
  timeout: 1000
  directories:
  - build
  - travis/mtime_cache

# Enable docker support
services:
- docker

notifications:
  email:
    on_failure: always
    on_success: change
    recipients:
    - secure: "VWnsiQkt1xjgRo1hfNiNQqvLSr0fshFmLV7jJlUixhCr094mgD0U2bNKdUfebm28Byg9UyDYPbOFDC0sx7KydKiL1q7FKKXkyZH0k04wUu8XiNw+fYkDpmPnQs7G2n8oJ/GFJnr1Wp/1KI3qX5LX3xot4cJfx1I5iFC2O+p+ng6v/oSX+pewlMv4i7KL16ftHHHMo80N694v3g4B2NByn4GU2/bjVQcqlBp/TiVaUa5Nqu9DxZi/n9CJqGEaRHOblWyMO3EyTZsn45BNSWeQ3DtnMwZ73rlIr9CaEgCeuArc6RGghUAVqRI5ao+N5apekIaILwTgL6AJn+Lw/+NRPa8xclgd0rKqUQJMJCDZKjKz2lmIs3bxfELOizxJ3FJQ5R95FAxeAZ6rb/j40YqVVTw2IMBDnEE0J5ZmpUYNUtPti/Adf6GD9Fb2y8sLo0XDJzkI8OxYhfgjSy5KYmRj8O5MXcP2MAE8LQauNO3MaFnL9VMVOTZePJrPozQUgM021uyahf960+QNI06Uqlmg+PwWkSdllQlxHHplOgW7zClFhtSUpnJxcsUBzgg4kVg80gXUwAQkaDi7A9Wh2bs+TvMlmHzBwg+2SaAfWDgjeJIeOaipDkF1uSGzC+EHAiiKYMLd4Aahoi8SuelJUucoyJyLAq00WdUFQIh/izVhM4Y="

#
# Configurations
#
jobs:
  include:

    ###
    # Stage: Build Carl
    ###
    # ubuntu-20.04 - DefaultDebugTravis
    - stage: Build Carl
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebugTravis TASK=TestDocker LINUX=ubuntu-20.04 COMPILER=gcc
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build_carl.sh
      before_cache:
        - docker cp carl:/opt/carl/. .
      deploy:
        - provider: script
          skip_cleanup: true
          script: bash travis/deploy_docker.sh carl
    # ubuntu-20.04 - DefaultReleaseTravis
    - stage: Build Carl
      os: linux
      compiler: gcc
      env: CONFIG=DefaultReleaseTravis TASK=TestDockerDoxygen LINUX=ubuntu-20.04 COMPILER=gcc
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build_carl.sh
      before_cache:
        - docker cp carl:/opt/carl/. .
      deploy:
        - provider: script
          skip_cleanup: true
          script: bash travis/deploy_docker.sh carl

    ###
    # Stage: Build (1st run)
    ###
    # ubuntu-18.04 - DefaultDebug
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-18.04 - DefaultRelease
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-9 - DefaultDebug
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/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 TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultDebug
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultRelease
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultDebugTravis
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebugTravis TASK=TestDocker LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultReleaseTravis
    - stage: Build (1st run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultReleaseTravis TASK=TestDockerDoxygen LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - rm -rf build
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build1
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;

    ###
    # Stage: Build (2nd run)
    ###
    # ubuntu-18.04 - DefaultDebug
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-18.04 - DefaultRelease
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-9 - DefaultDebug
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/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 TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultDebug
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultRelease
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultDebugTravis
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebugTravis TASK=TestDocker LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultReleaseTravis
    - stage: Build (2nd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultReleaseTravis TASK=TestDockerDoxygen LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Build2
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;

    ###
    # Stage: Build (3rd run)
    ###
    # ubuntu-18.04 - DefaultDebug
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-18.04 - DefaultRelease
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-9 - DefaultDebug
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/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 TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultDebug
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultRelease
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultDebugTravis
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebugTravis TASK=TestDocker LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultReleaseTravis
    - stage: Build (3rd run)
      os: linux
      compiler: gcc
      env: CONFIG=DefaultReleaseTravis TASK=TestDockerDoxygen LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh BuildLast
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;

    ###
    # Stage: Tasks
    ###
    # ubuntu-18.04 - DefaultDebug
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-18.04 - DefaultRelease
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=ubuntu-18.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-9 - DefaultDebug
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-9 - DefaultRelease
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=debian-9 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultDebug
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebug TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # debian-10 - DefaultRelease
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultRelease TASK=Test LINUX=debian-10 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
    # ubuntu-20.04 - DefaultDebugTravis
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultDebugTravis TASK=TestDocker LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
      deploy:
        - provider: script
          skip_cleanup: true
          script: bash travis/deploy_docker.sh storm
    # ubuntu-20.04 - DefaultReleaseTravis
    - stage: Tasks
      os: linux
      compiler: gcc
      env: CONFIG=DefaultReleaseTravis TASK=TestDockerDoxygen LINUX=ubuntu-20.04 COMPILER=gcc
      install:
        - travis/skip_test.sh
      before_script:
        - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # Workaround for nonblocking mode
      script:
        - travis/build.sh Tasks
      before_cache:
        - docker cp storm:/opt/storm/. .
      after_failure:
        - find build -iname '*err*.log' -type f -print -exec cat {} \;
      deploy:
        - provider: script
          skip_cleanup: true
          script: bash travis/deploy_docker.sh storm
        - provider: pages
          skip_cleanup: true
          github_token: $GITHUB_TOKEN
          local_dir: build/doc/html/
          repo: moves-rwth/storm-doc
          target_branch: master
          on:
            branch: master