|
1 |
| -# NB: don't set `language: haskell` here |
| 1 | +# This .travis.yml is modified from the sample at |
| 2 | +# https://docs.haskellstack.org/en/stable/GUIDE/#travis-with-caching |
2 | 3 |
|
3 |
| -# Ensures that sudo is disabled, so that containerized builds are allowed |
| 4 | +# Use new container infrastructure to enable caching |
4 | 5 | sudo: false
|
5 | 6 |
|
6 |
| -# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for. |
| 7 | +# Do not choose a language; we provide our own build tools. |
| 8 | +language: generic |
| 9 | + |
| 10 | +# Caching so the next build will be fast too. |
| 11 | +cache: |
| 12 | + directories: |
| 13 | + - $HOME/.ghc |
| 14 | + - $HOME/.cabal |
| 15 | + - $HOME/.stack |
| 16 | + |
| 17 | +# The different configurations we want to test. We have BUILD=cabal which uses |
| 18 | +# cabal-install, and BUILD=stack which uses Stack. More documentation on each |
| 19 | +# of those below. |
| 20 | +# |
| 21 | +# We set the compiler values here to tell Travis to use a different |
| 22 | +# cache file per set of arguments. |
| 23 | +# |
| 24 | +# If you need to have different apt packages for each combination in the |
| 25 | +# matrix, you can use a line such as: |
| 26 | +# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}} |
7 | 27 | matrix:
|
8 |
| - include: |
9 |
| - - env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS="" JOPTS="-j2" |
10 |
| - addons: {apt: {packages: [cabal-install-1.18, ghc-7.8.4], sources: [hvr-ghc]}} |
11 |
| - - env: CABALVER=1.22 GHCVER=7.10.1 GHCOPTS="" JOPTS="-j2" |
12 |
| - addons: {apt: {packages: [cabal-install-1.22, ghc-7.10.1],sources: [hvr-ghc]}} |
| 28 | + include: |
| 29 | + # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: |
| 30 | + # https://github.com/hvr/multi-ghc-travis |
| 31 | + - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 |
| 32 | + compiler: ": #GHC 7.8.4" |
| 33 | + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} |
| 34 | + - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 |
| 35 | + compiler: ": #GHC 7.10.3" |
| 36 | + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} |
| 37 | + |
| 38 | + - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 |
| 39 | + compiler: ": #GHC 8.0.1" |
| 40 | + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} |
| 41 | + |
| 42 | + # Build with the newest GHC and cabal-install. This is an accepted failure, |
| 43 | + # see below. |
| 44 | + - env: BUILD=cabal GHCVER=head CABALVER=head |
| 45 | + compiler: ": #GHC HEAD" |
| 46 | + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} |
| 47 | + |
| 48 | + # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS |
| 49 | + # variable, such as using --stack-yaml to point to a different file. |
| 50 | + - env: BUILD=stack ARGS="--resolver lts-7" |
| 51 | + compiler: ": #stack 8.0.1" |
| 52 | + addons: {apt: {packages: [ghc-8.0.1], sources: [hvr-ghc]}} |
| 53 | + |
| 54 | + # Nightly builds are allowed to fail |
| 55 | + - env: BUILD=stack ARGS="--resolver nightly" |
| 56 | + compiler: ": #stack nightly" |
| 57 | + addons: {apt: {packages: [libgmp-dev]}} |
| 58 | + |
| 59 | + - env: BUILD=stack ARGS="--resolver lts-7" |
| 60 | + compiler: ": #stack 8.0.1 osx" |
| 61 | + os: osx |
| 62 | + |
| 63 | + # - env: BUILD=stack ARGS="--resolver nightly" |
| 64 | + # compiler: ": #stack nightly osx" |
| 65 | + # os: osx |
| 66 | + |
| 67 | + allow_failures: |
| 68 | + - env: BUILD=cabal GHCVER=head CABALVER=head |
| 69 | + - env: BUILD=stack ARGS="--resolver nightly" |
| 70 | + |
| 71 | + fast_finish: true |
13 | 72 |
|
14 |
| -# Note: the distinction between `before_install` and `install` is not important. |
15 | 73 | before_install:
|
16 |
| - - export PATH=/opt/ghc/$GHCVER/bin:$HOME/.cabal/bin:$PATH |
| 74 | +# Using compiler above sets CC to an invalid value, so unset it |
| 75 | +- unset CC |
| 76 | + |
| 77 | +# We want to always allow newer versions of packages when building on GHC HEAD |
| 78 | +- CABALARGS="" |
| 79 | +- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi |
| 80 | + |
| 81 | +# Download and unpack the stack executable |
| 82 | +- export PATH=$PATH:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin |
| 83 | +- mkdir -p ~/.local/bin |
| 84 | +- | |
| 85 | + if [ `uname` = "Darwin" ] |
| 86 | + then |
| 87 | + curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin |
| 88 | + else |
| 89 | + curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' |
| 90 | + fi |
17 | 91 |
|
18 | 92 | install:
|
19 |
| - - cabal-$CABALVER update |
20 |
| - - cabal-$CABALVER install alex happy |
21 |
| - - cabal-$CABALVER install $JOPTS --only-dependencies -fplugins |
| 93 | +- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
| 94 | +- if [ -f configure.ac ]; then autoreconf -i; fi |
| 95 | +- | |
| 96 | + case "$BUILD" in |
| 97 | + stack) |
| 98 | + ulimit -n 4096 |
| 99 | + stack --no-terminal --install-ghc $ARGS install |
| 100 | + ;; |
| 101 | + cabal) |
| 102 | + cabal --version |
| 103 | + travis_retry cabal update |
| 104 | + cabal install -j alex happy |
| 105 | + cabal install -j --only-dependencies -ffast --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS |
| 106 | + ;; |
| 107 | + esac |
22 | 108 |
|
23 |
| -# Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail. |
24 | 109 | script:
|
25 |
| - - cabal-$CABALVER configure -fplugins -v2 # -v2 provides useful information for debugging |
26 |
| - - cabal-$CABALVER build $JOPTS --ghc-options=$GHCOPTS # this builds all libraries and executables (including tests/benchmarks) |
27 |
| - - cabal-$CABALVER check |
| 110 | +- | |
| 111 | + case "$BUILD" in |
| 112 | + stack) |
| 113 | + ulimit -n 4096 |
| 114 | + stack --no-terminal $ARGS install |
| 115 | + ;; |
| 116 | + cabal) |
| 117 | + cabal configure -fplugins -v2 -ffast --ghc-options="-O0 -Wall -fno-warn-unused-do-bind -Werror" |
| 118 | + cabal build -j |
| 119 | + cabal check |
| 120 | + cabal copy |
| 121 | + cabal sdist |
| 122 | + SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \ |
| 123 | + (cd dist && cabal install -j --force-reinstalls "$SRC_TGZ") |
| 124 | + ;; |
| 125 | + esac |
0 commit comments