on master help sign in
Timeout on dependency installation
commitb0a23d4cbea3ca90fc0f2be67da2e6986f7eb8c6 authorDiogo Biazus <diogo@biazus.me> dateWed 10 Jan 2018, 19:19 (9 years ago) parent0553f17
3 files changed+25−22
.travis.yml+2−6 .travis/install-dependencies.sh+23 .travis/install-ghc.sh−16
.travis.yml+2−6
@@ -34,18 +34,14 @@ before_script:
3434 - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
3535 - ./.travis/install-ghr.sh
3636 - ./.travis/install-stack.sh
37− - GHC_VERSION=$GHC_VERSION ./.travis/install-ghc.sh
3837
3938# Here starts the actual work to be performed for the package under test;
4039# any command which exits with a non-zero exit code causes the build to fail.
4140script:
41+ - ./.travis/install-dependencies.sh
4242 - |
4343 # Run tests
44− if [[ "$(uname)" = "Linux" ]]; then
45− stack --no-install-ghc --no-terminal --system-ghc test
46− else #Darwin
47− stack --no-install-ghc --system-ghc --no-terminal test project-m36:test:test-tutoriald
48− fi
44+ stack --no-terminal --jobs=2 --install-ghc --system-ghc test
4945 - |
5046 #Run HLint
5147 if [[ "$(uname)" = "Linux" ]]; then
.travis/install-dependencies.shnew file+23
@@ -0,0 +1,23 @@
1+# Run tests
2+if [[ "$(uname)" = "Darwin" ]]; then
3+ brew update && brew install coreutils
4+ timeout_cmd="gtimeout"
5+else
6+ timeout_cmd="timeout"
7+fi
8+$timeout_cmd 20m stack --no-terminal --jobs=2 --install-ghc --system-ghc build --only-dependencies
9+ret=$?
10+case "$ret" in
11+ 0)
12+ # continue
13+ ;;
14+ 124)
15+ echo "Timed out while installing dependencies."
16+ echo "Try building again by pushing a new commit."
17+ exit 1
18+ ;;
19+ *)
20+ echo "Failed to install dependencies; stack exited with $ret"
21+ exit "$ret"
22+ ;;
23+esac
.travis/install-ghc.shdeleted−16
@@ -1,16 +0,0 @@
1−#!/bin/sh
2−set -eux
3−#assume stack is installed
4−STACK=~/.local/bin/stack
5−
6−fetch_ghc_osx() {
7− echo "Using stack to install GHC $GHC_VERSION"
8− $STACK setup $GHC_VERSION
9−}
10−
11−if [ "$(uname)" = "Darwin" ]; then
12− fetch_ghc_osx
13−else
14− #installed by apt
15− echo "Linux GHC $GHC_VERSION via APT already installed."
16−fi