1
- # The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for.
2
- env :
3
- - CABALVER=1.18 GHCVER=7.6.3
4
- - CABALVER=1.18 GHCVER=7.8.3
5
- - CABALVER=1.22 GHCVER=7.10.1
6
- - CABALVER=head GHCVER=head # see section about GHC HEAD snapshots
7
-
8
- # Note: the distinction between `before_install` and `install` is not important.
1
+ # This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2
+ language : c
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
+
14
+ matrix :
15
+ include :
16
+ - env : CABALVER=1.16 GHCVER=7.6.3
17
+ compiler : " : #GHC 7.6.3"
18
+ addons : {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
19
+ - env : CABALVER=1.18 GHCVER=7.8.4
20
+ compiler : " : #GHC 7.8.4"
21
+ addons : {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
22
+ - env : CABALVER=1.22 GHCVER=7.10.1
23
+ compiler : " : #GHC 7.10.1"
24
+ addons : {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
25
+
9
26
before_install :
10
- - travis_retry sudo add-apt-repository -y ppa:hvr/ghc
11
- - travis_retry sudo apt-get update
12
- - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex
27
+ - unset CC
13
28
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
14
29
15
30
install :
16
31
- cabal --version
17
32
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
18
- - travis_retry cabal update
19
- - cabal install --only-dependencies --enable-tests --enable-benchmarks
33
+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
34
+ then
35
+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
36
+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
37
+ fi
38
+ - travis_retry cabal update -v
39
+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
40
+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
41
+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
20
42
21
- matrix :
22
- allow_failures :
23
- - env : CABALVER=head GHCVER=head
43
+ # check whether current requested install-plan matches cached package-db snapshot
44
+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
45
+ then
46
+ echo "cabal build-cache HIT";
47
+ rm -rfv .ghc;
48
+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
49
+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
50
+ else
51
+ echo "cabal build-cache MISS";
52
+ rm -rf $HOME/.cabsnap;
53
+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
54
+ cabal install --only-dependencies --enable-tests --enable-benchmarks;
55
+ fi
56
+
57
+ # snapshot package-db on cache miss
58
+ - if [ ! -d $HOME/.cabsnap ];
59
+ then
60
+ echo "snapshotting package-db to build-cache";
61
+ mkdir $HOME/.cabsnap;
62
+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
63
+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
64
+ fi
24
65
25
- # Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail.
66
+ # Here starts the actual work to be performed for the package under test;
67
+ # any command which exits with a non-zero exit code causes the build to fail.
26
68
script :
27
69
- if [ -f configure.ac ]; then autoreconf -i; fi
28
70
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
@@ -31,12 +73,10 @@ script:
31
73
- cabal check
32
74
- cabal sdist # tests that a source-distribution can be generated
33
75
34
- # The following scriptlet checks that the resulting source distribution can be built & installed
35
- - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
36
- cd dist/;
37
- if [ -f "$SRC_TGZ" ]; then
38
- cabal install --force-reinstalls "$SRC_TGZ";
39
- else
40
- echo "expected '$SRC_TGZ' not found";
41
- exit 1;
42
- fi
76
+ # Check that the resulting source distribution can be built & installed.
77
+ # If there are no other `.tar.gz` files in `dist`, this can be even simpler:
78
+ # `cabal install --force-reinstalls dist/*-*.tar.gz`
79
+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
80
+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
81
+
82
+ # EOF
0 commit comments