Skip to content

Commit

Permalink
Include stack installation in CI timeout mechanism
Browse files Browse the repository at this point in the history
This will help to abort CI builds early in order to preserve the cache
if necessary.
  • Loading branch information
hdgarrood committed Aug 7, 2018
1 parent 0361559 commit 7baf927
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Expand Up @@ -28,13 +28,9 @@ addons:
before_install:
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- stack setup
- stack --version
- stack install alex happy

script:
- ./travis-script.sh
- ./travis/timeout.sh ./travis/script.sh

notifications:
email: true
Expand Down
22 changes: 0 additions & 22 deletions travis-script.sh

This file was deleted.

10 changes: 10 additions & 0 deletions travis/script.sh
@@ -0,0 +1,10 @@
#!/bin/bash

set -x

curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
stack setup
stack --version
stack install alex happy
stack --no-terminal --jobs=1 build --only-dependencies
stack --no-terminal --jobs=1 test --flag pursuit:-dev --pedantic
17 changes: 17 additions & 0 deletions travis/timeout.sh
@@ -0,0 +1,17 @@
#!/bin/bash

timeout 40m $@
ret=$?
case "$ret" in
0)
# continue
;;
124)
echo "Timed out while executing command: $@."
echo "Try building again by pushing a new commit."
exit 1
;;
*)
exit "$ret"
;;
esac

0 comments on commit 7baf927

Please sign in to comment.