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