|
1 |
| -# NB: don't set `language: haskell` here |
2 |
| -# See also https://github.com/hvr/multi-ghc-travis for more information |
3 |
| - |
| 1 | +# This file has been generated -- see https://github.com/hvr/multi-ghc-travis |
| 2 | +language: c |
4 | 3 | sudo: false
|
| 4 | + |
| 5 | +cache: |
| 6 | + 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 | + |
5 | 14 | matrix:
|
6 | 15 | include:
|
7 |
| - # we have to use CABALVER=1.16 for GHC<7.8 as well, as there's |
8 |
| - # no package for earlier cabal versions in the PPA |
9 |
| - - env: GHCVER=7.0.4 CABALVER=1.16 |
10 |
| - addons: {apt: {packages: [ghc-7.0.4,cabal-install-1.16], sources: [hvr-ghc]}} |
11 |
| - - env: GHCVER=7.4.2 CABALVER=1.16 |
12 |
| - addons: {apt: {packages: [ghc-7.4.2,cabal-install-1.16], sources: [hvr-ghc]}} |
13 |
| - - env: GHCVER=7.6.3 CABALVER=1.16 |
14 |
| - addons: {apt: {packages: [ghc-7.6.3,cabal-install-1.16], sources: [hvr-ghc]}} |
15 |
| - - env: GHCVER=7.8.4 CABALVER=1.18 |
16 |
| - addons: {apt: {packages: [ghc-7.8.4,cabal-install-1.18], sources: [hvr-ghc]}} |
17 |
| - - env: GHCVER=7.10.2 CABALVER=1.22 |
18 |
| - addons: {apt: {packages: [ghc-7.10.2,cabal-install-1.22], sources: [hvr-ghc]}} |
19 |
| - - env: GHCVER=head CABALVER=1.22 |
20 |
| - addons: {apt: {packages: [ghc-head,cabal-install-1.22], sources: [hvr-ghc]}} |
| 16 | + - env: CABALVER=1.16 GHCVER=7.0.4 |
| 17 | + compiler: ": #GHC 7.0.4" |
| 18 | + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4], sources: [hvr-ghc]}} |
| 19 | + - env: CABALVER=1.16 GHCVER=7.4.2 |
| 20 | + compiler: ": #GHC 7.4.2" |
| 21 | + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} |
| 22 | + - env: CABALVER=1.16 GHCVER=7.6.3 |
| 23 | + compiler: ": #GHC 7.6.3" |
| 24 | + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} |
| 25 | + - env: CABALVER=1.18 GHCVER=7.8.4 |
| 26 | + compiler: ": #GHC 7.8.4" |
| 27 | + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} |
| 28 | + - env: CABALVER=1.22 GHCVER=7.10.1 |
| 29 | + compiler: ": #GHC 7.10.1" |
| 30 | + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} |
| 31 | + - env: CABALVER=1.22 GHCVER=7.10.2 |
| 32 | + compiler: ": #GHC 7.10.2" |
| 33 | + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} |
| 34 | + - env: CABALVER=1.24 GHCVER=8.0.1 |
| 35 | + compiler: ": #GHC 8.0.1" |
| 36 | + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} |
| 37 | + - env: CABALVER=1.24 GHCVER=head |
| 38 | + compiler: ": #GHC head" |
| 39 | + addons: {apt: {packages: [cabal-install-1.24,ghc-head], sources: [hvr-ghc]}} |
21 | 40 | allow_failures:
|
22 |
| - - env: GHCVER=7.0.4 CABALVER=1.16 |
23 |
| - - env: GHCVER=7.4.2 CABALVER=1.16 |
24 |
| - - env: GHCVER=head CABALVER=1.22 |
| 41 | + - env: CABALVER=1.16 GHCVER=7.0.4 |
| 42 | + - env: CABALVER=1.16 GHCVER=7.4.2 |
| 43 | + - env: CABALVER=1.24 GHCVER=head |
| 44 | + |
25 | 45 |
|
26 |
| -# Note: the distinction between `before_install` and `install` is not |
27 |
| -# important. |
28 | 46 | before_install:
|
| 47 | + - unset CC |
29 | 48 | - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
30 |
| - - cabal --version |
31 | 49 |
|
32 | 50 | install:
|
33 |
| - - travis_retry cabal update |
34 |
| - - cabal install --only-dependencies --enable-tests --enable-benchmarks |
35 |
| - |
36 |
| -# Here starts the actual work to be performed for the package under |
37 |
| -# test; any command which exits with a non-zero exit code causes the |
38 |
| -# build to fail. |
39 |
| -script: |
40 |
| - - autoreconf |
| 51 | + - cabal --version |
| 52 | + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
| 53 | + - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; |
| 54 | + then |
| 55 | + zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > |
| 56 | + $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; |
| 57 | + fi |
| 58 | + - travis_retry cabal update -v |
| 59 | + - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config |
| 60 | + - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt |
| 61 | + - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt |
41 | 62 |
|
42 |
| - # -v2 provides useful information for debugging |
43 |
| - - cabal configure --enable-tests --enable-benchmarks -v2 |
| 63 | +# check whether current requested install-plan matches cached package-db snapshot |
| 64 | + - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; |
| 65 | + then |
| 66 | + echo "cabal build-cache HIT"; |
| 67 | + rm -rfv .ghc; |
| 68 | + cp -a $HOME/.cabsnap/ghc $HOME/.ghc; |
| 69 | + cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; |
| 70 | + else |
| 71 | + echo "cabal build-cache MISS"; |
| 72 | + rm -rf $HOME/.cabsnap; |
| 73 | + mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; |
| 74 | + cabal install --only-dependencies --enable-tests --enable-benchmarks; |
| 75 | + fi |
44 | 76 |
|
45 |
| - # this builds all libraries and executables |
46 |
| - # (including tests/benchmarks) |
47 |
| - - cabal build |
| 77 | +# snapshot package-db on cache miss |
| 78 | + - if [ ! -d $HOME/.cabsnap ]; |
| 79 | + then |
| 80 | + echo "snapshotting package-db to build-cache"; |
| 81 | + mkdir $HOME/.cabsnap; |
| 82 | + cp -a $HOME/.ghc $HOME/.cabsnap/ghc; |
| 83 | + cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; |
| 84 | + fi |
48 | 85 |
|
| 86 | +# Here starts the actual work to be performed for the package under test; |
| 87 | +# any command which exits with a non-zero exit code causes the build to fail. |
| 88 | +script: |
| 89 | + - if [ -f configure.ac ]; then autoreconf -i; fi |
| 90 | + - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging |
| 91 | + - cabal build # this builds all libraries and executables (including tests/benchmarks) |
49 | 92 | - cabal test
|
50 | 93 | - cabal check
|
| 94 | + - cabal sdist # tests that a source-distribution can be generated |
51 | 95 |
|
52 |
| - # tests that a source-distribution can be generated |
53 |
| - - cabal sdist |
54 |
| - |
55 |
| - # check that the generated source-distribution can be built & installed |
56 |
| - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; |
57 |
| - cd dist/; |
58 |
| - if [ -f "$SRC_TGZ" ]; then |
59 |
| - cabal install "$SRC_TGZ"; |
60 |
| - else |
61 |
| - echo "expected '$SRC_TGZ' not found"; |
62 |
| - exit 1; |
63 |
| - fi |
| 96 | +# Check that the resulting source distribution can be built & installed. |
| 97 | +# If there are no other `.tar.gz` files in `dist`, this can be even simpler: |
| 98 | +# `cabal install --force-reinstalls dist/*-*.tar.gz` |
| 99 | + - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && |
| 100 | + (cd dist && cabal install --force-reinstalls "$SRC_TGZ") |
64 | 101 |
|
65 | 102 | # EOF
|
0 commit comments