1
+ # # modified version of the complex Travis configuration.
2
+ # For more information and other options, see:
3
+ #
4
+ # https://docs.haskellstack.org/en/stable/travis_ci/
5
+ #
6
+
7
+ # Use new container infrastructure to enable caching
8
+ sudo : false
9
+
10
+ # Do not choose a language; we provide our own build tools.
11
+ language : generic
12
+
13
+ # Caching so the next build will be fast too.
14
+ cache :
15
+ directories :
16
+ - $HOME/.ghc
17
+ - $HOME/.cabal
18
+ - $HOME/.stack
19
+
20
+ # The different configurations we want to test. We have BUILD=cabal which uses
21
+ # cabal-install, and BUILD=stack which uses Stack. More documentation on each
22
+ # of those below.
23
+ #
24
+ # We set the compiler values here to tell Travis to use a different
25
+ # cache file per set of arguments.
26
+ #
27
+ # If you need to have different apt packages for each combination in the
28
+ # matrix, you can use a line such as:
29
+ # addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
30
+ matrix :
31
+ include :
32
+ # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
33
+ # https://github.com/hvr/multi-ghc-travis
34
+ - env : BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
35
+ compiler : " : #GHC 7.10.3"
36
+ addons : {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
37
+ - env : BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
38
+ compiler : " : #GHC 8.0.1"
39
+ addons : {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
40
+
41
+ # Build with the newest GHC and cabal-install. This is an accepted failure,
42
+ # see below.
43
+ - env : BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
44
+ compiler : " : #GHC HEAD"
45
+ addons : {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
46
+
47
+ # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
48
+ # variable, such as using --stack-yaml to point to a different file.
49
+ - env : BUILD=stack ARGS="--resolver lts-6"
50
+ compiler : " : #stack 7.10.3"
51
+ addons : {apt: {packages: [libgmp-dev]}}
52
+
53
+ - env : BUILD=stack ARGS="--resolver lts-7"
54
+ compiler : " : #stack 8.0.1"
55
+ addons : {apt: {packages: [libgmp-dev]}}
56
+
57
+ # Nightly builds are allowed to fail
58
+ - env : BUILD=stack ARGS="--resolver nightly"
59
+ compiler : " : #stack nightly"
60
+ addons : {apt: {packages: [libgmp-dev]}}
61
+
62
+ # Build on macOS in addition to Linux
63
+ - env : BUILD=stack ARGS="--resolver lts-7"
64
+ compiler : " : #stack 8.0.1 osx"
65
+ os : osx
66
+
67
+ allow_failures :
68
+ - env : BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
69
+ - env : BUILD=stack ARGS="--resolver nightly"
70
+
71
+
72
+ before_install :
73
+ # Using compiler above sets CC to an invalid value, so unset it
74
+ - unset CC
75
+
76
+ # We want to always allow newer versions of packages when building on GHC HEAD
77
+ - CABALARGS=""
78
+ - if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
79
+
80
+ # Download and unpack the stack executable
81
+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
82
+ - mkdir -p ~/.local/bin
83
+ - |
84
+ if [ `uname` = "Darwin" ]
85
+ then
86
+ travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
87
+ else
88
+ travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
89
+ fi
90
+
91
+ # Use the more reliable S3 mirror of Hackage
92
+ mkdir -p $HOME/.cabal
93
+ echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
94
+ echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
95
+
96
+ if [ "$CABALVER" != "1.16" ]
97
+ then
98
+ echo 'jobs: $ncpus' >> $HOME/.cabal/config
99
+ fi
100
+
101
+ install :
102
+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
103
+ - if [ -f configure.ac ]; then autoreconf -i; fi
104
+ - |
105
+ set -ex
106
+ case "$BUILD" in
107
+ stack)
108
+ stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
109
+ ;;
110
+ cabal)
111
+ cabal --version
112
+ travis_retry cabal update
113
+
114
+ # Get the list of packages from the stack.yaml file
115
+ PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
116
+
117
+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
118
+ ;;
119
+ esac
120
+ set +ex
121
+
122
+ script :
123
+ - |
124
+ set -ex
125
+ case "$BUILD" in
126
+ stack)
127
+ stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
128
+ ;;
129
+ cabal)
130
+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
131
+
132
+ ORIGDIR=$(pwd)
133
+ for dir in $PACKAGES
134
+ do
135
+ cd $dir
136
+ cabal check || [ "$CABALVER" == "1.16" ]
137
+ cabal sdist
138
+ PKGVER=$(cabal info . | awk '{print $2;exit}')
139
+ SRC_TGZ=$PKGVER.tar.gz
140
+ cd dist
141
+ tar zxfv "$SRC_TGZ"
142
+ cd "$PKGVER"
143
+ cabal configure --enable-tests
144
+ cabal build
145
+ cd $ORIGDIR
146
+ done
147
+ ;;
148
+ esac
149
+ set +ex
0 commit comments