|
1 |
| -# The Travis docs (https://docs.travis-ci.com/user/languages/haskell) |
2 |
| -# suggest that we use `language: haskell` and `ghc:` to specify GHC versions. |
3 |
| -# However, as of this writing, Travis only supported versions up to 7.8. |
4 |
| -# If Travis supports all versions we would like to test, then we could switch. |
5 |
| -# Until then, we use the https://github.com/hvr/multi-ghc-travis setup. |
6 |
| -language: c |
7 |
| -sudo: false |
| 1 | +sudo: false # Use the container-based infrastructure. |
| 2 | + |
8 | 3 | addons:
|
9 |
| - apt: &apt |
10 |
| - sources: |
11 |
| - - hvr-ghc |
12 |
| -cabal: &cabal cabal-install-1.22 |
13 |
| -env: |
14 |
| - global: |
15 |
| - - CABALVER=1.22 |
16 |
| -matrix: |
17 |
| - include: |
18 |
| - - env: GHCVER=7.6.3 |
19 |
| - addons: |
20 |
| - apt: |
21 |
| - <<: *apt |
22 |
| - packages: [ghc-7.6.3, *cabal] |
23 |
| - - env: GHCVER=7.8.4 |
24 |
| - addons: |
25 |
| - apt: |
26 |
| - <<: *apt |
27 |
| - packages: [ghc-7.8.4, *cabal] |
28 |
| - - env: GHCVER=7.10.3 |
29 |
| - addons: |
30 |
| - apt: |
31 |
| - <<: *apt |
32 |
| - packages: [ghc-7.10.3, *cabal] |
33 |
| - - env: GHCVER=8.0.1 |
34 |
| - addons: |
35 |
| - apt: |
36 |
| - <<: *apt |
37 |
| - packages: [ghc-8.0.1, *cabal] |
| 4 | + apt: |
| 5 | + packages: |
| 6 | + - libgmp-dev # Stack's GHC depends on this. |
| 7 | + |
38 | 8 | cache:
|
39 | 9 | directories:
|
40 |
| - - '$HOME/.ghc' |
41 |
| - - '$HOME/.cabal' |
| 10 | + - $HOME/.stack # Global stack's cache. |
| 11 | + - $HOME/.foldercache # Per exercise `.stack-work` cache. |
| 12 | + |
| 13 | +env: |
| 14 | + - RESOLVER="lts-2.22" # Last GHC 7.8.x snapshot. |
| 15 | + - RESOLVER="lts-6.4" # Last checked LTS snapshot (GHC 7.10.3). |
| 16 | + - RESOLVER="nightly-2016-06-21" # Last checked nightly snapshot (GHC 8.0.1). |
| 17 | + - RESOLVER="lts" # Latest LTS snapshot. |
| 18 | + - RESOLVER="nightly" # Latest nightly snapshot. |
| 19 | + |
| 20 | +matrix: |
| 21 | + allow_failures: # The snapshots `lts` and `nightly` are |
| 22 | + - env: RESOLVER="lts" # aliases to the most recent versions. |
| 23 | + - env: RESOLVER="nightly" # We don't want to fail when a new version |
| 24 | + fast_finish: true # is released, so we list them here. |
| 25 | + |
42 | 26 | before_install:
|
43 |
| - - './_test/bootstrap.sh' |
| 27 | + - mkdir -p ${HOME}/bin # Create folder for stack. |
| 28 | + - export PATH="${HOME}/bin:$PATH" # For stack |
| 29 | + - export PATH="${TRAVIS_BUILD_DIR}/bin:$PATH" # For {,fetch-}configlet. |
| 30 | + - export PATH="${TRAVIS_BUILD_DIR}/_test:$PATH" # For stackalize. |
| 31 | + |
44 | 32 | install:
|
45 |
| - - true |
| 33 | + - travis_retry fetch-configlet |
| 34 | + - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 -o pack.tgz |
| 35 | + - tar xzf pack.tgz --wildcards --strip-components=1 -C ${HOME}/bin '*/stack' |
| 36 | + |
46 | 37 | script:
|
47 |
| - - 'export PATH=/opt/cabal/$CABALVER/bin:/opt/ghc/$GHCVER/bin:$PATH' |
48 |
| - - 'runhaskell -Wall ./_test/check-exercises.hs' |
49 |
| - - './bin/fetch-configlet' |
50 |
| - - './bin/configlet .' |
| 38 | + - | |
| 39 | + set -e |
| 40 | + configlet . |
| 41 | + for exercise in ${TRAVIS_BUILD_DIR}/exercises/* ; do |
| 42 | + pushd ${exercise} |
| 43 | + # `stack --word-dir` fails if not targeting a subdirectory, so we just |
| 44 | + # symbolic-link `.stack-work` to a subfolder in the cache directory. |
| 45 | + mkdir -p "${HOME}/.foldercache/${exercise}/.stack-work" |
| 46 | + ln -f -s "${HOME}/.foldercache/${exercise}/.stack-work" |
| 47 | + stackalize --resolver lts-0.0 `# This resolver is not used. ` |
| 48 | + stack test --resolver "${RESOLVER}" `# Select the correct resolver. `\ |
| 49 | + --install-ghc `# Download GHC if not in cache.`\ |
| 50 | + --no-terminal `# Terminal detection is broken.`\ |
| 51 | + --pedantic `# Enable -Wall and -Werror. ` |
| 52 | + popd |
| 53 | + done |
0 commit comments