@@ -1,91 +1,178 @@
1+# Copy these contents into the root directory of your Github project in a file
2+# named .travis.yml
3+
14# Use new container infrastructure to enable caching
25sudo: false
36
47# Choose a lightweight base image; we provide our own build tools.
58language: c
69
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]}}
727matrix:
828 include:
9− - env: CABALVER=1.18 GHCVER=7.6.3 BUILD=cabal
10− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}}
11−
12− - env: CABALVER=1.18 GHCVER=7.8.4 BUILD=cabal
13− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
14−
15− - env: CABALVER=1.22 GHCVER=7.10.1 BUILD=cabal
16− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
17−
18− - env: CABALVER=1.22 GHCVER=7.10.2 BUILD=cabal
19− addons: {apt: {packages: [libfcgi-dev,cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
20−
21− - env: CABALVER=head GHCVER=head BUILD=cabal
22− addons: {apt: {packages: [libfcgi-dev,cabal-install-head,ghc-head], sources: [hvr-ghc]}}
23−
24− - env: ARGS= BUILD=stack
25− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
26−
27− - env: ARGS="--resolver lts-4" BUILD=stack
28− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
29−
30− - env: ARGS="--resolver lts-3" BUILD=stack
31− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
32−
33− - env: ARGS="--resolver lts" BUILD=stack
34− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
35−
36− - env: ARGS="--resolver nightly" BUILD=stack
37− addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
38−
39− - env: ARGS= BUILD=stack
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.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
32+ compiler: ": #GHC 7.6.3"
33+ addons: {apt: {packages: [libfcgi-dev,cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
34+ - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
35+ compiler: ": #GHC 7.8.4"
36+ addons: {apt: {packages: [libfcgi-dev,cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
37+ - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
38+ compiler: ": #GHC 7.10.3"
39+ addons: {apt: {packages: [libfcgi-dev,cabal-install-1.22,ghc-7.10.3,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: [libfcgi-dev,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=""
50+ compiler: ": #stack default"
51+ addons: {apt: {packages: [libfcgi-dev,ghc-7.10.3], sources: [hvr-ghc]}}
52+
53+ #- env: BUILD=stack ARGS="--resolver lts-2"
54+ # compiler: ": #stack 7.8.4"
55+ # addons: {apt: {packages: [libfcgi-dev,ghc-7.8.4], sources: [hvr-ghc]}}
56+
57+ - env: BUILD=stack ARGS="--resolver lts-3"
58+ compiler: ": #stack 7.10.2"
59+ addons: {apt: {packages: [libfcgi-dev,ghc-7.10.2], sources: [hvr-ghc]}}
60+
61+ - env: BUILD=stack ARGS="--resolver lts-5"
62+ compiler: ": #stack 7.10.3"
63+ addons: {apt: {packages: [libfcgi-dev,ghc-7.10.3], sources: [hvr-ghc]}}
64+
65+ # Nightly builds are allowed to fail
66+ - env: BUILD=stack ARGS="--resolver nightly"
67+ compiler: ": #stack nightly"
68+ addons: {apt: {packages: [libfcgi-dev,libgmp,libgmp-dev]}}
69+
70+ # Build on OS X in addition to Linux
71+ - env: BUILD=stack ARGS=""
72+ compiler: ": #stack default osx"
4073 os: osx
4174
42− - env: ARGS="--resolver lts-3" BUILD=stack
75+ #- env: BUILD=stack ARGS="--resolver lts-2"
76+ # compiler: ": #stack 7.8.4 osx"
77+ # os: osx
78+
79+ - env: BUILD=stack ARGS="--resolver lts-3"
80+ compiler: ": #stack 7.10.2 osx"
4381 os: osx
4482
45− - env: ARGS="--resolver lts" BUILD=stack
83+ - env: BUILD=stack ARGS="--resolver lts-5"
84+ compiler: ": #stack 7.10.3 osx"
4685 os: osx
4786
48− - env: ARGS="--resolver nightly" BUILD=stack
87+ - env: BUILD=stack ARGS="--resolver nightly"
88+ compiler: ": #stack nightly osx"
4989 os: osx
5090
5191 allow_failures:
52− - env: CABALVER=head GHCVER=head BUILD=cabal
92+ - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
93+ - env: BUILD=stack ARGS="--resolver nightly"
5394
5495before_install:
55−# Set up path and additional build tools
56−- ./.travis-setup.sh
57−- case "$BUILD" in
58− stack)
59− export PATH=$HOME/.local/bin:$HOME/.cabal/bin:$PATH;
60− stack --version;;
61− cabal)
62− export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.cabal/bin:$PATH;
63− ghc --version;
64− cabal --version;;
65− esac
96+# Using compiler above sets CC to an invalid value, so unset it
97+- unset CC
98+
99+# We want to always allow newer versions of packages when building on GHC HEAD
100+- CABALARGS=""
101+- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
102+
103+# Download and unpack the stack executable
104+- 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
105+- mkdir -p ~/.local/bin
106+- |
107+ if [ `uname` = "Darwin" ]
108+ then
109+ travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
110+
111+ # brew no longer has fcgi
112+ # brew install fcgi
113+ grep -v wai-handler-fastcgi < stack.yaml > tmp
114+ mv tmp stack.yaml
115+ else
116+ travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
117+ fi
118+
119+ # Use the more reliable S3 mirror of Hackage
120+ mkdir -p $HOME/.cabal
121+ echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
122+ echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
123+
124+ if [ "$CABALVER" != "1.16" ]
125+ then
126+ echo 'jobs: $ncpus' >> $HOME/.cabal/config
127+ fi
128+
129+# Get the list of packages from the stack.yaml file
130+- PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
66131
67132install:
68−- case "$BUILD" in
133+- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
134+- if [ -f configure.ac ]; then autoreconf -i; fi
135+- |
136+ case "$BUILD" in
69137 stack)
70− stack $ARGS setup --no-terminal;;
138+ stack --no-terminal --install-ghc $ARGS test --only-dependencies
139+ ;;
71140 cabal)
72− travis_retry cabal update;
73− cabal unpack wai-logger;
74− mv wai-logger-* wai-logger;
75− cabal install hspec doctest HTTP temporary;
76− cabal-meta install --force-reinstalls --enable-tests;;
141+ cabal --version
142+ travis_retry cabal update
143+
144+ # Due to dependency on wai-logger (which depends on some packages here),
145+ # we can't build just dependencies
146+ #
147+ # cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
148+ cabal install hspec-discover
149+ ;;
77150 esac
78151
79152script:
80−- case "$BUILD" in
153+- |
154+ set -ex
155+ case "$BUILD" in
81156 stack)
82− stack $ARGS --no-terminal test --haddock;;
157+ stack --no-terminal $ARGS test --haddock --no-haddock-deps
158+ ;;
83159 cabal)
84− mega-sdist --test;;
160+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
161+
162+ ORIGDIR=$(pwd)
163+ for dir in $PACKAGES
164+ do
165+ cd $dir
166+ cabal check || [ "$CABALVER" == "1.16" ]
167+ cabal sdist
168+ NAMEVER=$(cabal info . | awk '{print $2;exit}')
169+ SRC_TGZ=dist/$NAMEVER.tar.gz
170+ tar zxf $SRC_TGZ
171+ cd $NAMEVER
172+ cabal configure --enable-tests
173+ cabal build
174+ cd $ORIGDIR
175+ done
176+ ;;
85177 esac
86−
87−# Caching so the next build will be fast too.
88−cache:
89− directories:
90− - $HOME/.stack
91− - $HOME/.cabal/packages
178+ set +ex