|
1 | | -# Use new container infrastructure to enable caching |
2 | | -sudo: false |
3 | | - |
4 | | -# Do not choose a language; we provide our own build tools. |
5 | | -language: generic |
6 | | - |
7 | | -# Caching so the next build will be fast too. |
8 | | -cache: |
9 | | - directories: |
10 | | - - $HOME/.cabsnap |
11 | | - - $HOME/.cabal/packages |
12 | | - - $HOME/.stack |
13 | | - - $HOME/.cabal/store |
14 | | - # alternatively: |
15 | | - #- $HOME/.stack/bin |
16 | | - #- $HOME/.stack/precompiled |
17 | | - #- $HOME/.stack/programs |
18 | | - #- $HOME/.stack/setup-exe-cache |
19 | | - #- $HOME/.stack/snapshots |
20 | | - |
21 | | -before_cache: |
22 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log |
23 | | - # remove files that are regenerated by 'cabal update' |
24 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* |
25 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json |
26 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache |
27 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar |
28 | | - - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx |
29 | | - |
30 | | -# The different configurations we want to test. We have |
31 | | -# - BUILD=cabal which uses cabal-install(<2.0) |
32 | | -# - BUILD=canew which uses cabal-install 2.0 "new-build" |
33 | | -# - BUILD=stack which uses Stack. |
34 | | -# |
35 | | -# We set the compiler values here to tell Travis to use a different |
36 | | -# cache file per set of arguments. |
37 | | -# |
38 | | -# If you need to have different apt packages for each combination in the |
39 | | -# matrix, you can use a line such as: |
40 | | -# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}} |
41 | | -matrix: |
42 | | - include: |
43 | | - |
44 | | - ##### OSX test via stack ##### |
45 | | - |
46 | | - ##### CABAL ##### |
47 | | - |
48 | | - - env: BUILD=cabal GHCVER=8.6.5 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7 |
49 | | - compiler: ": #cabal 8.6.5" |
50 | | - addons: {apt: {packages: [cabal-install-1.24,ghc-8.6.5,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 | | - ##### CANEW ##### |
59 | | - |
60 | | - - env: BUILD=canew GHCVER=8.8.1 CABALVER=3.0 HAPPYVER=1.19.5 ALEXVER=3.1.7 |
61 | | - compiler: ": #cabal new 8.8.1" |
62 | | - addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}} |
63 | | - |
64 | | - ##### STACK ##### |
65 | | - |
66 | | - # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS |
67 | | - # variable, such as using --stack-yaml to point to a different file. |
68 | | - - env: BUILD=stack ARGS="" |
69 | | - compiler: ": #stack default" |
70 | | - addons: {apt: {packages: [libgmp-dev]}} |
71 | | - |
72 | | - - env: BUILD=stack ARGS="--stack-yaml stack-8.8.4.yaml" |
73 | | - compiler: ": #stack 8.8.4" |
74 | | - addons: {apt: {packages: [libgmp-dev]}} |
75 | | - |
76 | | - - env: BUILD=stack ARGS="--stack-yaml stack-8.6.5.yaml" |
77 | | - compiler: ": #stack 8.6.5" |
78 | | - addons: {apt: {packages: [libgmp-dev]}} |
79 | | - |
80 | | - # Nightly builds are allowed to fail |
81 | | - - env: BUILD=stack ARGS="--resolver nightly" |
82 | | - compiler: ": #stack nightly" |
83 | | - addons: {apt: {packages: [libgmp-dev]}} |
84 | | - |
85 | | - allow_failures: |
86 | | - #- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 |
87 | | - - env: BUILD=stack ARGS="--resolver nightly" |
88 | | - - env: BUILD=stack ARGS="" |
89 | | - |
90 | | -before_install: |
91 | | -# Using compiler above sets CC to an invalid value, so unset it |
92 | | -- unset CC |
93 | | - |
94 | | -# We want to always allow newer versions of packages when building on GHC HEAD |
95 | | -- CABALARGS="" |
96 | | -- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi |
97 | | - |
98 | | -# Download and unpack the stack executable |
99 | | -- 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 |
100 | | -- mkdir -p ~/.local/bin |
101 | | -- | |
102 | | - if [ `uname` = "Darwin" ] |
103 | | - then |
104 | | - travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin |
105 | | - else |
106 | | - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' |
107 | | - fi |
108 | | -
|
109 | | - # Use the more reliable S3 mirror of Hackage |
110 | | - #mkdir -p $HOME/.cabal |
111 | | - #echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config |
112 | | - #echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config |
113 | | -
|
114 | | - #if [ "$CABALVER" != "1.16" ] |
115 | | - #then |
116 | | - # echo 'jobs: $ncpus' >> $HOME/.cabal/config |
117 | | - #fi |
118 | | -- PKGNAME='brittany' |
119 | | -- JOBS='1' |
120 | | -- | |
121 | | - function better_wait() { |
122 | | - date |
123 | | - time "$@" & # send the long living command to background! |
124 | | -
|
125 | | - set +x |
126 | | - MINUTES=0 |
127 | | - LIMIT=30 |
128 | | - while kill -0 $! >/dev/null 2>&1; do |
129 | | - echo -n -e " \b" # never leave evidences! |
130 | | -
|
131 | | - if [ $MINUTES == $LIMIT ]; then |
132 | | - break; |
133 | | - fi |
134 | | -
|
135 | | - MINUTES=$((MINUTES+1)) |
136 | | -
|
137 | | - sleep 60 |
138 | | - done |
139 | | - wait $! |
140 | | - set -x |
141 | | - } |
142 | | -
|
143 | | -install: |
144 | | -- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
145 | | -- if [ -f configure.ac ]; then autoreconf -i; fi |
146 | | -- | |
147 | | - set -ex |
148 | | - case "$BUILD" in |
149 | | - stack) |
150 | | - stack -j$JOBS --no-terminal --install-ghc $ARGS test --bench --only-dependencies --flag brittany:brittany-test-perf |
151 | | - ;; |
152 | | - cabal*) |
153 | | - cabal --version |
154 | | - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
155 | | - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; |
156 | | - then |
157 | | - zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >$HOME/.cabal/packages/hackage.haskell.org/00-index.tar; |
158 | | - fi |
159 | | - travis_retry cabal update -v |
160 | | - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config |
161 | | - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt |
162 | | - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt |
163 | | -
|
164 | | - # check whether current requested install-plan matches cached package-db snapshot |
165 | | - if diff -u $HOME/.cabsnap/installplan.txt installplan.txt; |
166 | | - then |
167 | | - echo "cabal build-cache HIT"; |
168 | | - rm -rfv .ghc; |
169 | | - cp -a $HOME/.cabsnap/ghc $HOME/.ghc; |
170 | | - cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; |
171 | | - else |
172 | | - echo "cabal build-cache MISS"; |
173 | | - rm -rf $HOME/.cabsnap; |
174 | | - mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; |
175 | | - cabal install -j$JOBS --only-dependencies --enable-tests --enable-benchmarks --ghc-options="-j1 +RTS -M700M -RTS"; |
176 | | - fi |
177 | | -
|
178 | | - # snapshot package-db on cache miss |
179 | | - if [ ! -d $HOME/.cabsnap ]; |
180 | | - then |
181 | | - echo "snapshotting package-db to build-cache"; |
182 | | - mkdir $HOME/.cabsnap; |
183 | | - cp -a $HOME/.ghc $HOME/.cabsnap/ghc; |
184 | | - cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; |
185 | | - fi |
186 | | - ;; |
187 | | - canew) |
188 | | - cabal --version |
189 | | - travis_retry cabal update -v |
190 | | - echo 'packages: .' > cabal.project |
191 | | - echo 'package brittany' > cabal.project.local |
192 | | - echo ' ghc-options: -Werror -with-rtsopts=-N1 -j1 +RTS -M700M -RTS' >> cabal.project.local |
193 | | - echo ' flags: +brittany-test-perf' >> cabal.project.local |
194 | | - rm -f cabal.project.freeze |
195 | | - cabal new-build -j$JOBS --enable-test --enable-benchmarks --dep |
196 | | - cabal new-build -j$JOBS --disable-tests --disable-benchmarks --dep |
197 | | - ;; |
198 | | - esac |
199 | | - set +ex |
200 | | -
|
201 | | -script: |
202 | | -- | |
203 | | - set -ex |
204 | | - case "$BUILD" in |
205 | | - stack) |
206 | | - better_wait stack -j$JOBS --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps --ghc-options="-j1 +RTS -M700M -RTS -Werror -with-rtsopts=-N1" --flag brittany:brittany-test-perf |
207 | | - ;; |
208 | | - cabal) |
209 | | - if [ -f configure.ac ]; then autoreconf -i; fi |
210 | | - cabal configure --enable-tests --enable-benchmarks -v --flags="brittany-test-perf" # -v2 provides useful information for debugging |
211 | | - better_wait cabal build -j$JOBS --ghc-options="-j1 +RTS -M700M -RTS -Werror" # this builds all libraries and executables (including tests/benchmarks) |
212 | | - time cabal test --ghc-options="-with-rtsopts=-N1" |
213 | | - ;; |
214 | | - cabaldist) |
215 | | - # cabal check |
216 | | - cabal sdist # tests that a source-distribution can be generated |
217 | | -
|
218 | | - # Check that the resulting source distribution can be built & installed. |
219 | | - # If there are no other `.tar.gz` files in `dist`, this can be even simpler: |
220 | | - # `cabal install --force-reinstalls dist/*-*.tar.gz` |
221 | | - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && |
222 | | - (cd dist && better_wait cabal install -j$JOBS --force-reinstalls "$SRC_TGZ" --ghc-options="-j1 +RTS -M700M -RTS") |
223 | | - ;; |
224 | | - canew) |
225 | | - better_wait cabal new-build -j$JOBS --disable-tests --disable-benchmarks |
226 | | - better_wait cabal new-build -j$JOBS --enable-tests --enable-benchmarks |
227 | | - time cabal new-test -j1 |
228 | | - ;; |
229 | | - esac |
230 | | - set +ex |
| 1 | +language: minimal |
0 commit comments