on master help sign in
Timeout on dependency installation
b0a23d4Diogo Biazus
.travis.yml+2−6
@@ -34,18 +34,14 @@ before_script:
34 - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
34 - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
35 - ./.travis/install-ghr.sh
35 - ./.travis/install-ghr.sh
36 - ./.travis/install-stack.sh
36 - ./.travis/install-stack.sh
37− - GHC_VERSION=$GHC_VERSION ./.travis/install-ghc.sh
38
37
39# Here starts the actual work to be performed for the package under test;
38# Here starts the actual work to be performed for the package under test;
40# any command which exits with a non-zero exit code causes the build to fail.
39# any command which exits with a non-zero exit code causes the build to fail.
41script:
40script:
41+ - ./.travis/install-dependencies.sh
42 - |
42 - |
43 # Run tests
43 # 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
44+ stack --no-terminal --jobs=2 --install-ghc --system-ghc test
48− fi
49 - |
45 - |
50 #Run HLint
46 #Run HLint
51 if [[ "$(uname)" = "Linux" ]]; then
47 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