-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
68 lines (58 loc) · 2.5 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
sudo: false # Use the container-based infrastructure.
addons:
apt:
packages:
- libgmp-dev # Stack's GHC depends on this.
cache:
timeout: 600 # The cache is too big to upload in 180 seconds.
directories:
- $HOME/.stack # Global stack's cache.
- $HOME/.foldercache # Per exercise `.stack-work` cache.
env:
- RESOLVER="lts-12.4" CURRENT="YES" # Equal to each stack.yaml.
- RESOLVER="nightly" # Latest nightly snapshot.
matrix:
allow_failures: # The snapshot `nightly` is just an alias to
- env: RESOLVER="nightly" # the newest version released. We don't want
fast_finish: true # Travis to fail on new incompatible releases.
before_install:
- mkdir -p ${HOME}/bin # Create folder for stack.
- export PATH="${HOME}/bin:$PATH" # For stack
- export PATH="${TRAVIS_BUILD_DIR}/bin:$PATH" # For {,fetch-}configlet.
install:
- travis_retry fetch-configlet
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 -o pack.tgz
- tar xzf pack.tgz --wildcards --strip-components=1 -C ${HOME}/bin '*/stack'
- stack --resolver ${RESOLVER} --install-ghc install hlint
- stack --version
script:
- "sh ./bin/ensure-readmes-are-updated.sh"
- "sh ./bin/check-configlet-fmt.sh"
- |
differing_stack=""
expected_stack=$(grep 'RESOLVER.*CURRENT' .travis.yml | head -1 | cut -d'"' -f2)
echo "All exercises should have resolver $expected_stack"
for exercise in ${TRAVIS_BUILD_DIR}/exercises/*/ ; do
# This might allow lts-xyz for expected_stack=x.z, but hopefully `stack` fails in that case!
# Not a mistake we expect people to make
if grep -v "^resolver: ${expected_stack}\$" $exercise/stack.yaml; then
differing_stack="$differing_stack $(basename "$exercise")"
fi
done
if [ -n "$differing_stack" ]; then
echo "The following exercises have a different stack.yaml resolver:$differing_stack"
echo "They should instead be $expected_stack"
exit 1
fi
- |
set -e
configlet lint . # Check basic track configuration.
hlint ${TRAVIS_BUILD_DIR} # Run `hlint` on the entire repository.
# Explicit set exercises' resolver only if it's not the current one.
if [ "${CURRENT}" != "YES" ]; then
export SET_RESOLVER="--resolver ${RESOLVER}"
fi
for exercise in ${TRAVIS_BUILD_DIR}/exercises/*/ ; do
time bin/test-stub $exercise
time bin/test-all-examples $exercise
done