Skip to content

Commit ca35950

Browse files
authored
Address travis timeout issues (purescript#2647)
These commits amend the CI scripts so that if a build does time out, the next one can continue where the previous left off. For more info see https://gist.github.com/hdgarrood/29fa8ebcd5b5acd679cf429fd0a93e3e This enables us to enable OSX builds again (which I have done).
1 parent e7664bd commit ca35950

2 files changed

Lines changed: 47 additions & 24 deletions

File tree

.travis.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,38 @@ dist: trusty # because of perf issues
33
sudo: required
44
matrix:
55
include:
6-
# The 'compiler' key is a hack to get Travis to use different caches for
7-
# each job in a build, in order to avoid the separate jobs stomping on each
8-
# other's caches. See https://github.com/travis-ci/travis-ci/issues/4393
9-
#
106
# We use trusty boxes because they seem to be a bit faster.
11-
- compiler: cc-linux-lts-normal
12-
os: linux
7+
- os: linux
138
dist: trusty
149
sudo: required
1510
env: BUILD_TYPE=normal DEPLOY=true
1611

17-
# - compiler: cc-linux-nightly-normal
18-
# os: linux
12+
# - os: linux
1913
# dist: trusty
2014
# sudo: required
2115
# env: BUILD_TYPE=normal STACKAGE_NIGHTLY=true
2216
# allow_failures: true
2317

24-
- compiler: cc-linux-ghc8.0-normal
25-
os: linux
18+
- os: linux
2619
dist: trusty
2720
sudo: required
2821
env: BUILD_TYPE=normal STACK_YAML=stack-ghc-8.0.yaml
2922

30-
- compiler: cc-linux-lts-sdist
31-
os: linux
23+
- os: linux
3224
dist: trusty
3325
sudo: required
3426
env: BUILD_TYPE=sdist COVERAGE=true
3527

36-
- compiler: cc-linux-lts-haddock
37-
os: linux
28+
- os: linux
3829
dist: trusty
3930
sudo: required
4031
env: BUILD_TYPE=haddock
4132

42-
# - compiler: cc-osx-lts-normal
43-
# os: osx
44-
# env: BUILD_TYPE=normal DEPLOY=true
45-
46-
# - compiler: cc-osx-lts-sdist
47-
# os: osx
48-
# env: BUILD_TYPE=sdist
33+
- os: osx
34+
env: BUILD_TYPE=normal DEPLOY=true
35+
36+
- os: osx
37+
env: BUILD_TYPE=sdist
4938
addons:
5039
apt:
5140
packages:
@@ -54,6 +43,11 @@ cache:
5443
directories:
5544
- $HOME/.local/bin
5645
- $HOME/.stack
46+
# Maximum amount of time in seconds spent attempting to upload a new cache
47+
# before aborting. Since our cache can get rather large, increasing this
48+
# value helps avoid situations where caches fail to be stored. The default
49+
# value is 180 (at the time of writing).
50+
timeout: 1000
5751
install:
5852
- | # Install stack.
5953
if test ! -f "$HOME/.local/bin/stack"
@@ -66,9 +60,20 @@ install:
6660
mv stack "$HOME/.local/bin/"
6761
fi
6862
- npm install -g bower # for psc-docs / psc-publish tests
69-
# Fix the CC environment variable, because Travis changes it
70-
- export CC=gcc
7163
- export OS_NAME=$(./travis/convert-os-name.sh)
64+
# Install 'timeout'
65+
- |
66+
if [ "$TRAVIS_OS_NAME" == "osx" ]
67+
then
68+
if ! which gtimeout >/dev/null
69+
then
70+
brew update
71+
brew install coreutils
72+
fi
73+
export TIMEOUT=gtimeout
74+
else
75+
export TIMEOUT=timeout
76+
fi
7277
script:
7378
- travis/build.sh
7479
before_deploy:

travis/build.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,25 @@
22
set -e
33

44
STACK="stack --no-terminal --jobs=1"
5-
$STACK setup
5+
6+
# Setup & install dependencies or abort
7+
ret=0
8+
$TIMEOUT 40m $STACK --install-ghc build \
9+
--only-dependencies --test --haddock \
10+
|| ret=$?
11+
case "$ret" in
12+
0) # continue
13+
;;
14+
124)
15+
echo "Timed out while installing dependencies."
16+
echo "Try pushing a new commit to build again."
17+
exit 1
18+
;;
19+
*)
20+
echo "Failed to install dependencies."
21+
exit 1
22+
;;
23+
esac
624

725
# Set up configuration
826
STACK_EXTRA_FLAGS=""

0 commit comments

Comments
 (0)