on master help sign in
Updated Travis
commit991048ca9543d28c9530210a5d0edcf9a23fa6ae authorMichael Snoyman <michael@snoyman.com> dateMon 11 Apr 2016, 10:46 (11 years ago) parentfa3af0d
1 file changed+162−25
.travis.yml+162−25
.travis.yml+162−25
@@ -1,38 +1,175 @@
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
7−# GHC depends on GMP. You can add other dependencies here as well.
8−addons:
9− apt:
10− packages:
11− - libgmp-dev
12−
13−# The different configurations we want to test. You could also do things like
14−# change flags or use --stack-yaml to point to a different file.
15−env:
16−- ARGS=""
17−- ARGS="--resolver lts-2"
18−- ARGS="--resolver lts-3"
19−- ARGS="--resolver lts"
20−- ARGS="--resolver nightly"
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]}}
27+matrix:
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.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
32+ # compiler: ": #GHC 7.0.4"
33+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
34+ #- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
35+ # compiler: ": #GHC 7.2.2"
36+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
37+ #- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
38+ # compiler: ": #GHC 7.4.2"
39+ # addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
40+ - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
41+ compiler: ": #GHC 7.6.3"
42+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
43+ - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
44+ compiler: ": #GHC 7.8.4"
45+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
46+ - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
47+ compiler: ": #GHC 7.10.3"
48+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
49+
50+ # Build with the newest GHC and cabal-install. This is an accepted failure,
51+ # see below.
52+ - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
53+ compiler: ": #GHC HEAD"
54+ addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
55+
56+ # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
57+ # variable, such as using --stack-yaml to point to a different file.
58+ - env: BUILD=stack ARGS=""
59+ compiler: ": #stack default"
60+ addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
61+
62+ - env: BUILD=stack ARGS="--resolver lts-2"
63+ compiler: ": #stack 7.8.4"
64+ addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}}
65+
66+ - env: BUILD=stack ARGS="--resolver lts-3"
67+ compiler: ": #stack 7.10.2"
68+ addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}}
69+
70+ - env: BUILD=stack ARGS="--resolver lts-5"
71+ compiler: ": #stack 7.10.3"
72+ addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
73+
74+ # Nightly builds are allowed to fail
75+ - env: BUILD=stack ARGS="--resolver nightly"
76+ compiler: ": #stack nightly"
77+ addons: {apt: {packages: [libgmp,libgmp-dev]}}
78+
79+ # Build on OS X in addition to Linux
80+ - env: BUILD=stack ARGS=""
81+ compiler: ": #stack default osx"
82+ os: osx
83+
84+ - env: BUILD=stack ARGS="--resolver lts-2"
85+ compiler: ": #stack 7.8.4 osx"
86+ os: osx
87+
88+ - env: BUILD=stack ARGS="--resolver lts-3"
89+ compiler: ": #stack 7.10.2 osx"
90+ os: osx
91+
92+ - env: BUILD=stack ARGS="--resolver lts-5"
93+ compiler: ": #stack 7.10.3 osx"
94+ os: osx
95+
96+ - env: BUILD=stack ARGS="--resolver nightly"
97+ compiler: ": #stack nightly osx"
98+ os: osx
99+
100+ allow_failures:
101+ - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
102+ - env: BUILD=stack ARGS="--resolver nightly"
21103
22104before_install:
105+# Using compiler above sets CC to an invalid value, so unset it
106+- unset CC
107+
108+# We want to always allow newer versions of packages when building on GHC HEAD
109+- CABALARGS=""
110+- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
111+
23112# Download and unpack the stack executable
113+- 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
24114- mkdir -p ~/.local/bin
25−- export PATH=$HOME/.local/bin:$PATH
26−- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
115+- |
116+ if [ `uname` = "Darwin" ]
117+ then
118+ travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
119+ else
120+ travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
121+ fi
122+
123+ # Use the more reliable S3 mirror of Hackage
124+ mkdir -p $HOME/.cabal
125+ echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
126+ echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
127+
128+ if [ "$CABALVER" != "1.16" ]
129+ then
130+ echo 'jobs: $ncpus' >> $HOME/.cabal/config
131+ fi
132+
133+# Get the list of packages from the stack.yaml file
134+- PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
135+
136+install:
137+- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
138+- if [ -f configure.ac ]; then autoreconf -i; fi
139+- |
140+ set -ex
141+ case "$BUILD" in
142+ stack)
143+ stack --no-terminal --install-ghc $ARGS test --only-dependencies
144+ ;;
145+ cabal)
146+ cabal --version
147+ travis_retry cabal update
148+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
149+ ;;
150+ esac
151+ set +ex
27152
28−# This line does all of the work: installs GHC if necessary, build the library,
29−# executables, and test suites, and runs the test suites. --no-terminal works
30−# around some quirks in Travis's terminal implementation.
31153script:
32− - stack $ARGS --no-terminal --install-ghc build yaml:examples --pedantic
33− - stack $ARGS --no-terminal --install-ghc test --pedantic
154+- |
155+ set -ex
156+ case "$BUILD" in
157+ stack)
158+ stack --no-terminal $ARGS test --haddock --no-haddock-deps --pedantic
159+ ;;
160+ cabal)
161+ cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
34162
35−# Caching so the next build will be fast too.
36−cache:
37− directories:
38− - $HOME/.stack
163+ ORIGDIR=$(pwd)
164+ for dir in $PACKAGES
165+ do
166+ cd $dir
167+ cabal check || [ "$CABALVER" == "1.16" ]
168+ cabal sdist
169+ SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
170+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
171+ cd $ORIGDIR
172+ done
173+ ;;
174+ esac
175+ set +ex