git.iko.soy/typeable/pandoc
on master help sign in
Try new travis stack+cabal script.
commit1a877947623b0acbde10b1a799c1de30fc25a906 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 17 Feb 2016, 10:13 (11 years ago) parentb8dadc6
1 file changed+124−75
.travis.yml+124−75
.travis.yml+124−75
@@ -1,87 +1,136 @@
1−# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2−language: c
1+# Copy these contents into the root directory of your Github project in a file
2+# named .travis.yml
3+
4+# Use new container infrastructure to enable caching
35sudo: false
46
7+# Choose a lightweight base image; we provide our own build tools.
8+language: c
9+
10+# Caching so the next build will be fast too.
511cache:
612 directories:
7− - $HOME/.cabsnap
8− - $HOME/.cabal/packages
9−
10−before_cache:
11− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
12− - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
13+ - $HOME/.ghc
14+ - $HOME/.cabal
15+ - $HOME/.stack
1316
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]}}
1427matrix:
1528 include:
16− - env: CABALVER=1.16 GHCVER=7.4.2 GHCOPTS=-Werror
17− compiler: ": #GHC 7.4.2"
18− addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
19− - env: CABALVER=1.16 GHCVER=7.6.3 GHCOPTS=-Werror
20− compiler: ": #GHC 7.6.3"
21− addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
22− - env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS=-Werror
23− compiler: ": #GHC 7.8.4"
24− addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
25− - env: CABALVER=1.22 GHCVER=7.10.2 GHCOPTS=-Werror
26− compiler: ": #GHC 7.10.2"
27− addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
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.4.2 CABALVER=1.16
32+ compiler: ": #GHC 7.4.2"
33+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}}
34+ - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16
35+ compiler: ": #GHC 7.6.3"
36+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
37+ - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18
38+ compiler: ": #GHC 7.8.4"
39+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
40+ - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22
41+ compiler: ": #GHC 7.10.3"
42+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
43+
44+ # Build with the newest GHC and cabal-install. This is an accepted failure,
45+ # see below.
46+ - env: BUILD=cabal GHCVER=head CABALVER=head
47+ compiler: ": #GHC HEAD"
48+ addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
49+
50+ # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
51+ # variable, such as using --stack-yaml to point to a different file.
52+ - env: BUILD=stack ARGS="--resolver lts-3"
53+ compiler: ": #stack 7.10.2"
54+ addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}}
55+
56+ - env: BUILD=stack ARGS="--resolver lts-5"
57+ compiler: ": #stack 7.10.3"
58+ addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
59+
60+ # Nightly builds are allowed to fail
61+ - env: BUILD=stack ARGS="--resolver nightly"
62+ compiler: ": #stack nightly"
63+ addons: {apt: {packages: [libgmp-dev]}}
64+
65+ # Build on OS X in addition to Linux
66+ - env: BUILD=stack ARGS="--resolver lts-2"
67+ compiler: ": #stack 7.8.4 osx"
68+ os: osx
69+
70+ - env: BUILD=stack ARGS="--resolver lts-3"
71+ compiler: ": #stack 7.10.2 osx"
72+ os: osx
73+
74+ - env: BUILD=stack ARGS="--resolver lts-5"
75+ compiler: ": #stack 7.10.3 osx"
76+ os: osx
77+
78+ - env: BUILD=stack ARGS="--resolver nightly"
79+ compiler: ": #stack nightly osx"
80+ os: osx
81+
82+ allow_failures:
83+ - env: BUILD=cabal GHCVER=head CABALVER=head
84+ - env: BUILD=stack ARGS="--resolver nightly"
2885
2986before_install:
30− - unset CC
31− - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
87+# Using compiler above sets CC to an invalid value, so unset it
88+- unset CC
89+
90+# We want to always allow newer versions of packages when building on GHC HEAD
91+- CABALARGS=""
92+- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
93+
94+# Download and unpack the stack executable
95+- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH
96+- mkdir -p ~/.local/bin
97+- |
98+ if [ `uname` = "Darwin" ]
99+ then
100+ curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
101+ else
102+ curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
103+ fi
32104
33105install:
34− - cabal --version
35− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
36− - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
37− then
38− zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
39− $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
40− fi
41− - travis_retry cabal update -v
42− - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
43− - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
44− - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
45−
46−# check whether current requested install-plan matches cached package-db snapshot
47− - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
48− then
49− echo "cabal build-cache HIT";
50− rm -rfv .ghc;
51− cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
52− cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
53− else
54− echo "cabal build-cache MISS";
55− rm -rf $HOME/.cabsnap;
56− mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
57− cabal install --only-dependencies --enable-tests --enable-benchmarks;
58− fi
59−
60−# snapshot package-db on cache miss
61− - if [ ! -d $HOME/.cabsnap ];
62− then
63− echo "snapshotting package-db to build-cache";
64− mkdir $HOME/.cabsnap;
65− cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
66− cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
67− fi
68−
69−# Here starts the actual work to be performed for the package under test;
70−# any command which exits with a non-zero exit code causes the build to fail.
106+- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
107+- if [ -f configure.ac ]; then autoreconf -i; fi
108+- |
109+ case "$BUILD" in
110+ stack)
111+ stack --no-terminal --install-ghc $ARGS test --only-dependencies
112+ ;;
113+ cabal)
114+ cabal --version
115+ travis_retry cabal update
116+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS
117+ ;;
118+ esac
119+
71120script:
72− - if [ -f configure.ac ]; then autoreconf -i; fi
73− - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
74− - cabal build --ghc-options=$GHCOPTS # this builds all libraries and executables (including tests/benchmarks)
75− - cabal test
76− - cabal check
77−# Test that a source-distribution can be generated
78−# (with cabal >= 1.18 'cabal sdist' would work too):
79− - ./dist/setup/setup sdist
80−
81−# Check that the resulting source distribution can be built & installed.
82−# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
83−# `cabal install --force-reinstalls dist/*-*.tar.gz`
84− - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
85− (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
86−
87−# EOF
121+- |
122+ case "$BUILD" in
123+ stack)
124+ stack --no-terminal $ARGS test --haddock --no-haddock-deps
125+ ;;
126+ cabal)
127+ cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"
128+ cabal build
129+ cabal check || [ "$CABALVER" == "1.16" ]
130+ cabal test
131+ cabal sdist
132+ cabal copy
133+ SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \
134+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
135+ ;;
136+ esac