1- language : c
1+ # This is the complex Travis configuration, which is intended for use
2+ # on open source libraries which need compatibility across multiple GHC
3+ # versions, must work with cabal-install, and should be
4+ # cross-platform. For more information and other options, see:
5+ #
6+ # https://docs.haskellstack.org/en/stable/travis_ci/
7+ #
8+ # Copy these contents into the root directory of your Github project in a file
9+ # named .travis.yml
10+
11+ # Use new container infrastructure to enable caching
212sudo : false
313
14+ # Do not choose a language; we provide our own build tools.
15+ language : generic
16+
17+ # Caching so the next build will be fast too.
418cache :
519 directories :
620 - $HOME/.ghc
721 - $HOME/.cabal
822 - $HOME/.stack
923
24+ # The different configurations we want to test. We have BUILD=cabal which uses
25+ # cabal-install, and BUILD=stack which uses Stack. More documentation on each
26+ # of those below.
27+ #
28+ # We set the compiler values here to tell Travis to use a different
29+ # cache file per set of arguments.
30+ #
31+ # If you need to have different apt packages for each combination in the
32+ # matrix, you can use a line such as:
33+ # addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
1034matrix :
1135 include :
12- - env : BUILD=cabal GHCVER=7.4.1 CABALVER=1.24
13- compiler : " : #GHC 7.4.1"
14- addons : {apt: {packages: [cabal-install-1.24,ghc-7.4.1], sources: [hvr-ghc]}}
15- - env : BUILD=cabal GHCVER=7.4.2 CABALVER=1.24
36+ # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
37+ # https://github.com/hvr/multi-ghc-travis
38+ # - env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
39+ # compiler: ": #GHC 7.0.4"
40+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
41+ # - env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
42+ # compiler: ": #GHC 7.2.2"
43+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
44+ - env : BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
1645 compiler : " : #GHC 7.4.2"
17- addons : {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}}
18- # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's
19- # no package for earlier cabal versions in the PPA
20- # - env: BUILD=cabal GHCVER=7.6.1 CABALVER=1.16
21- # compiler: ": #GHC 7.6.1"
22- # addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.1], sources: [hvr-ghc]}}
23- - env : BUILD=cabal GHCVER=7.6.2 CABALVER=1.24
24- compiler : " : #GHC 7.6.2"
25- addons : {apt: {packages: [cabal-install-1.24,ghc-7.6.2], sources: [hvr-ghc]}}
26- - env : BUILD=cabal GHCVER=7.6.3 CABALVER=1.24
46+ addons : {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
47+ - env : BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
2748 compiler : " : #GHC 7.6.3"
28- addons : {apt: {packages: [cabal-install-1.24 ,ghc-7.6.3], sources: [hvr-ghc]}}
29- - env : BUILD=cabal GHCVER=7.8.4 CABALVER=1.24
49+ addons : {apt: {packages: [cabal-install-1.16 ,ghc-7.6.3,happy-1.19.5,alex-3.1.7 ], sources: [hvr-ghc]}}
50+ - env : BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
3051 compiler : " : #GHC 7.8.4"
31- addons : {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}
32- - env : BUILD=cabal GHCVER=7.10.1 CABALVER=1.24
33- compiler : " : #GHC 7.10.1"
34- addons : {apt: {packages: [cabal-install-1.24,ghc-7.10.1], sources: [hvr-ghc]}}
35- - env : BUILD=cabal GHCVER=7.10.2 CABALVER=1.24
36- compiler : " : #GHC 7.10.2"
37- addons : {apt: {packages: [cabal-install-1.24,ghc-7.10.2], sources: [hvr-ghc]}}
38- - env : BUILD=cabal GHCVER=7.10.3 CABALVER=1.24
52+ addons : {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
53+ - env : BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
3954 compiler : " : #GHC 7.10.3"
40- addons : {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}
41-
42- - env : BUILD=cabal GHCVER=head CABALVER=head
55+ addons : {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
56+ - env : BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
57+ compiler : " : #GHC 8.0.2"
58+ addons : {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
59+ - env : BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7
60+ compiler : " : #GHC 8.2.2"
61+ addons : {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
62+
63+ # Build with the newest GHC and cabal-install. This is an accepted failure,
64+ # see below.
65+ - env : BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
4366 compiler : " : #GHC HEAD"
44- addons : {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
67+ addons : {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
68+
69+ # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
70+ # variable, such as using --stack-yaml to point to a different file.
71+ - env : BUILD=stack ARGS=""
72+ compiler : " : #stack default"
73+ addons : {apt: {packages: [libgmp-dev]}}
4574
4675 - env : BUILD=stack ARGS="--resolver lts-2"
4776 compiler : " : #stack 7.8.4"
48- addons : {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc ]}}
77+ addons : {apt: {packages: [libgmp-dev ]}}
4978
5079 - env : BUILD=stack ARGS="--resolver lts-3"
5180 compiler : " : #stack 7.10.2"
52- addons : {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc ]}}
81+ addons : {apt: {packages: [libgmp-dev ]}}
5382
54- - env : BUILD=stack ARGS="--resolver lts-5 "
83+ - env : BUILD=stack ARGS="--resolver lts-6 "
5584 compiler : " : #stack 7.10.3"
56- addons : {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
85+ addons : {apt: {packages: [libgmp-dev]}}
86+
87+ - env : BUILD=stack ARGS="--resolver lts-7"
88+ compiler : " : #stack 8.0.1"
89+ addons : {apt: {packages: [libgmp-dev]}}
90+
91+ - env : BUILD=stack ARGS="--resolver lts-9"
92+ compiler : " : #stack 8.0.2"
93+ addons : {apt: {packages: [libgmp-dev]}}
5794
95+ - env : BUILD=stack ARGS="--resolver lts-10"
96+ compiler : " : #stack 8.2.2"
97+ addons : {apt: {packages: [libgmp-dev]}}
98+
99+ # Nightly builds are allowed to fail
58100 - env : BUILD=stack ARGS="--resolver nightly"
59101 compiler : " : #stack nightly"
60102 addons : {apt: {packages: [libgmp-dev]}}
61103
62- # GHC incompatible with OS X on Travis
104+ # Build on macOS in addition to Linux
105+ - env : BUILD=stack ARGS=""
106+ compiler : " : #stack default osx"
107+ os : osx
108+
109+ # Travis includes an macOS which is incompatible with GHC 7.8.4
63110 # - env: BUILD=stack ARGS="--resolver lts-2"
64111 # compiler: ": #stack 7.8.4 osx"
65112 # os: osx
@@ -68,89 +115,114 @@ matrix:
68115 compiler : " : #stack 7.10.2 osx"
69116 os : osx
70117
71- - env : BUILD=stack ARGS="--resolver lts-5 "
118+ - env : BUILD=stack ARGS="--resolver lts-6 "
72119 compiler : " : #stack 7.10.3 osx"
73120 os : osx
74121
122+ - env : BUILD=stack ARGS="--resolver lts-7"
123+ compiler : " : #stack 8.0.1 osx"
124+ os : osx
125+
126+ - env : BUILD=stack ARGS="--resolver lts-9"
127+ compiler : " : #stack 8.0.2 osx"
128+ os : osx
129+
130+ - env : BUILD=stack ARGS="--resolver lts-10"
131+ compiler : " : #stack 8.2.2 osx"
132+ os : osx
133+
75134 - env : BUILD=stack ARGS="--resolver nightly"
76135 compiler : " : #stack nightly osx"
77136 os : osx
78137
79138 allow_failures :
80- - env : BUILD=cabal GHCVER=head CABALVER=head
139+ - env : BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
81140 - env : BUILD=stack ARGS="--resolver nightly"
82141
83142before_install :
84- - unset CC
85- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH
86- - mkdir -p ~/.local/bin
87- - |
88- if [ `uname` = "Darwin" ];
89- then
90- curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
91- else
92- curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack';
93- fi
94-
95- - |
96- echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
97- echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
98-
99- if [ "$CABALVER" != "1.16" ]
100- then
101- echo 'jobs: $ncpus' >> $HOME/.cabal/config
102- fi
103-
104- echo 'constraint: Cabal installed' >> $HOME/.cabal/config
105- echo 'constraint: array installed' >> $HOME/.cabal/config
106- echo 'constraint: base installed' >> $HOME/.cabal/config
107- echo 'constraint: bin-package-db installed' >> $HOME/.cabal/config
108- echo 'constraint: binary installed' >> $HOME/.cabal/config
109- echo 'constraint: bytestring installed' >> $HOME/.cabal/config
110- echo 'constraint: containers installed' >> $HOME/.cabal/config
111- echo 'constraint: deepseq installed' >> $HOME/.cabal/config
112- echo 'constraint: directory installed' >> $HOME/.cabal/config
113- echo 'constraint: filepath installed' >> $HOME/.cabal/config
114- echo 'constraint: ghc installed' >> $HOME/.cabal/config
115- echo 'constraint: ghc-prim installed' >> $HOME/.cabal/config
116- echo 'constraint: haskeline installed' >> $HOME/.cabal/config
117- echo 'constraint: hoopl installed' >> $HOME/.cabal/config
118- echo 'constraint: hpc installed' >> $HOME/.cabal/config
119- echo 'constraint: integer-gmp installed' >> $HOME/.cabal/config
120- echo 'constraint: integer-simple installed' >> $HOME/.cabal/config
121- echo 'constraint: pretty installed' >> $HOME/.cabal/config
122- echo 'constraint: process installed' >> $HOME/.cabal/config
123- echo 'constraint: rts installed' >> $HOME/.cabal/config
124- echo 'constraint: template-haskell installed' >> $HOME/.cabal/config
125- echo 'constraint: terminfo installed' >> $HOME/.cabal/config
126- echo 'constraint: time installed' >> $HOME/.cabal/config
127- echo 'constraint: unix installed' >> $HOME/.cabal/config
128- echo 'constraint: xhtml installed' >> $HOME/.cabal/config
143+ # Using compiler above sets CC to an invalid value, so unset it
144+ - unset CC
145+
146+ # We want to always allow newer versions of packages when building on GHC HEAD
147+ - CABALARGS=""
148+ - if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
149+
150+ # Download and unpack the stack executable
151+ - 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
152+ - mkdir -p ~/.local/bin
153+ - |
154+ if [ `uname` = "Darwin" ]
155+ then
156+ travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
157+ else
158+ travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
159+ fi
160+
161+ # Use the more reliable S3 mirror of Hackage
162+ mkdir -p $HOME/.cabal
163+ echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
164+ echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
165+
166+ if [ "$CABALVER" != "1.16" ]
167+ then
168+ echo 'jobs: $ncpus' >> $HOME/.cabal/config
169+ fi
129170
130171install :
131- - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
132- - if [ -f configure.ac ]; then autoreconf -i; fi
133- - |
134- case "$BUILD" in
135- stack)
136- stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies;;
137- cabal)
138- cabal --version;
139- travis_retry cabal update;
140- cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1;;
141- esac
172+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
173+ - if [ -f configure.ac ]; then autoreconf -i; fi
174+ - |
175+ set -ex
176+ case "$BUILD" in
177+ stack)
178+ # Add in extra-deps for older snapshots, as necessary
179+ stack --no-terminal --install-ghc $ARGS test --bench --dry-run || ( \
180+ stack --no-terminal $ARGS build cabal-install && \
181+ stack --no-terminal $ARGS solver --update-config)
182+
183+ # Build the dependencies
184+ stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
185+ ;;
186+ cabal)
187+ cabal --version
188+ travis_retry cabal update
189+
190+ # Get the list of packages from the stack.yaml file. Note that
191+ # this will also implicitly run hpack as necessary to generate
192+ # the .cabal files needed by cabal-install.
193+ PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
194+
195+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
196+ ;;
197+ esac
198+ set +ex
142199
143200script :
144- - case "$BUILD" in
145- stack)
146- stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps;;
147- cabal)
148- cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror";
149- cabal build;
150- cabal check || [ "$CABALVER" == "1.16" ];
151- cabal test;
152- cabal sdist;
153- cabal copy;
154- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
155- (cd dist && cabal install --force-reinstalls "$SRC_TGZ");;
156- esac
201+ - |
202+ set -ex
203+ case "$BUILD" in
204+ stack)
205+ stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
206+ ;;
207+ cabal)
208+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
209+
210+ ORIGDIR=$(pwd)
211+ for dir in $PACKAGES
212+ do
213+ cd $dir
214+ cabal check || [ "$CABALVER" == "1.16" ]
215+ cabal sdist
216+ PKGVER=$(cabal info . | awk '{print $2;exit}')
217+ SRC_TGZ=$PKGVER.tar.gz
218+ cd dist
219+ tar zxfv "$SRC_TGZ"
220+ cd "$PKGVER"
221+ cabal configure --enable-tests --ghc-options -O0
222+ cabal build
223+ cabal test
224+ cd $ORIGDIR
225+ done
226+ ;;
227+ esac
228+ set +ex
0 commit comments