@@ -1,12 +1,11 @@
1−# This file has been generated by `make_travis_yml_2.hs`
2−# see https://github.com/hvr/multi-ghc-travis for more information
1+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
32language: c
43sudo: false
54
65cache:
76 directories:
7+ - $HOME/.cabsnap
88 - $HOME/.cabal/packages
9− - $HOME/.cabal/store
109
1110before_cache:
1211 - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
@@ -14,15 +13,15 @@ before_cache:
1413
1514matrix:
1615 include:
17− - env: CABALVER=1.24 GHCVER=7.10.1
16+ - env: CABALVER=1.22 GHCVER=7.10.1
1817 compiler: ": #GHC 7.10.1"
19− addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.1], sources: [hvr-ghc]}}
20− - env: CABALVER=1.24 GHCVER=7.10.2
18+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}}
19+ - env: CABALVER=1.22 GHCVER=7.10.2
2120 compiler: ": #GHC 7.10.2"
22− addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.2], sources: [hvr-ghc]}}
23− - env: CABALVER=1.24 GHCVER=7.10.3
21+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
22+ - env: CABALVER=1.22 GHCVER=7.10.3
2423 compiler: ": #GHC 7.10.3"
25− addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}
24+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
2625 - env: CABALVER=1.24 GHCVER=8.0.1
2726 compiler: ": #GHC 8.0.1"
2827 addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
@@ -33,8 +32,6 @@ before_install:
3332
3433install:
3534 - cabal --version
36− - BENCH=${BENCH---enable-benchmarks}
37− - TEST=${TEST---enable-tests}
3835 - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
3936 - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
4037 then
@@ -43,29 +40,46 @@ install:
4340 fi
4441 - travis_retry cabal update -v
4542 - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
46− - cabal new-build ${TEST} ${BENCH} --dep
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 $HOME/.cabsnap/installplan.txt 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
4768
4869# Here starts the actual work to be performed for the package under test;
4970# any command which exits with a non-zero exit code causes the build to fail.
5071script:
5172 - if [ -f configure.ac ]; then autoreconf -i; fi
52− # this builds all libraries and executables (including tests/benchmarks)
53− - cabal new-build ${TEST} ${BENCH} -v2 # -v2 provides useful information for debugging
54−
55− # there's no 'cabal new-test' yet, so let's emulate for now
56− - TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) );
57− RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
58− if dist-newstyle/build/*/build/$T/$T; then echo "= $T OK =";
59− else echo "= $T FAILED ="; RC=false; fi; done; $RC
60− - cabal sdist # test that a source-distribution can be generated
73+ - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
74+ - cabal build # this builds all libraries and executables (including tests/benchmarks)
75+ - cabal test
76+ - cabal check
77+ - cabal sdist # tests that a source-distribution can be generated
6178
62− # Check that the resulting source distribution can be built w/o and w tests
63− - SRC_BASENAME=$(cabal info . | awk '{print $2;exit}')
64− - tar -C dist/ -xf dist/$SRC_BASENAME.tar.gz
65− - "echo 'packages: *.cabal' > dist/$SRC_BASENAME/cabal.project"
66− - cd dist/$SRC_BASENAME/
67− - cabal new-build --disable-tests --disable-benchmarks
68− - rm -rf ./dist-newstyle
69− - cabal new-build ${TEST} ${BENCH}
79+# Check that the resulting source distribution can be built & installed.
80+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
81+# `cabal install --force-reinstalls dist/*-*.tar.gz`
82+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
83+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
7084
7185# EOF