message: travis: Properly cache and error on timeout (MarcoFalke)
diff: @@ -28,6 +28,7 @@ env:
  - WINEDEBUG=fixme-all
  - DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache python3"
  - DIST=DEB
  + - CACHE_ERR_MSG="Error! Initial build successful, but not enough time remains to run later build stages and tests. Please manually re-run this job by using the travis restart button or asking a bitcoin maintainer to restart. The next run should not time out because the build cache has been saved."
  matrix:
  include:
  @@ -132,8 +133,12 @@ install:
  before_script:
  - set -o errexit; source .travis/before_script.sh
  script:
  - - if [ $SECONDS -gt 1980 ]; then set +o errexit; echo "Travis early exit to cache current state"; false; else set -o errexit; source .travis/script_a.sh; fi
  - - if [ $SECONDS -gt 1980 ]; then set +o errexit; echo "Travis early exit to cache current state"; false; else set -o errexit; source .travis/script_b.sh; fi
  + - export CONTINUE=1
  + - if [ $SECONDS -gt 1980 ]; then export CONTINUE=0; fi # Likely the depends build took very long
  + - if [ $CONTINUE = "1" ]; then set -o errexit; source .travis/script_a.sh; else set +o errexit; echo "$CACHE_ERR_MSG"; false; fi
  + - if [ $SECONDS -gt 1980 ]; then export CONTINUE=0; fi # Likely the build took very long
  + - if [ $CONTINUE = "1" ]; then set -o errexit; source .travis/script_b.sh; else set +o errexit; echo "$CACHE_ERR_MSG"; false; fi
  +
  after_script:
  - set -o errexit; cd $TRAVIS_BUILD_DIR; source .travis/after_script.sh
  after_failure:
  