Skip to content

Commit a5faefc

Browse files
committed
Use non-new-build travis setup
1 parent 162d9ac commit a5faefc

File tree

1 file changed

+47
-33
lines changed

1 file changed

+47
-33
lines changed

.travis.yml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
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
32
language: c
43
sudo: false
54

65
cache:
76
directories:
7+
- $HOME/.cabsnap
88
- $HOME/.cabal/packages
9-
- $HOME/.cabal/store
109

1110
before_cache:
1211
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
1312
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
1413

1514
matrix:
1615
include:
17-
- env: CABALVER=1.24 GHCVER=7.0.4
16+
- env: CABALVER=1.16 GHCVER=7.0.4
1817
compiler: ": #GHC 7.0.4"
19-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.0.4], sources: [hvr-ghc]}}
20-
- env: CABALVER=1.24 GHCVER=7.2.2
18+
addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4], sources: [hvr-ghc]}}
19+
- env: CABALVER=1.16 GHCVER=7.2.2
2120
compiler: ": #GHC 7.2.2"
22-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.2.2], sources: [hvr-ghc]}}
23-
- env: CABALVER=1.24 GHCVER=7.6.3
21+
addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}}
22+
- env: CABALVER=1.16 GHCVER=7.6.3
2423
compiler: ": #GHC 7.6.3"
25-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}
26-
- env: CABALVER=1.24 GHCVER=7.8.4
24+
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}}
25+
- env: CABALVER=1.18 GHCVER=7.8.4
2726
compiler: ": #GHC 7.8.4"
28-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}
29-
- env: CABALVER=1.24 GHCVER=7.10.3
27+
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
28+
- env: CABALVER=1.22 GHCVER=7.10.3
3029
compiler: ": #GHC 7.10.3"
31-
addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}
30+
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}}
3231
- env: CABALVER=1.24 GHCVER=8.0.1
3332
compiler: ": #GHC 8.0.1"
3433
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}}
@@ -45,8 +44,6 @@ before_install:
4544

4645
install:
4746
- cabal --version
48-
- BENCH=${BENCH---enable-benchmarks}
49-
- TEST=${TEST---enable-tests}
5047
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
5148
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
5249
then
@@ -55,29 +52,46 @@ install:
5552
fi
5653
- travis_retry cabal update -v
5754
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
58-
- cabal new-build ${TEST} ${BENCH} --dep
55+
- cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
56+
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
57+
58+
# check whether current requested install-plan matches cached package-db snapshot
59+
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
60+
then
61+
echo "cabal build-cache HIT";
62+
rm -rfv .ghc;
63+
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
64+
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
65+
else
66+
echo "cabal build-cache MISS";
67+
rm -rf $HOME/.cabsnap;
68+
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
69+
cabal install --only-dependencies --enable-tests --enable-benchmarks;
70+
fi
71+
72+
# snapshot package-db on cache miss
73+
- if [ ! -d $HOME/.cabsnap ];
74+
then
75+
echo "snapshotting package-db to build-cache";
76+
mkdir $HOME/.cabsnap;
77+
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
78+
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
79+
fi
5980

6081
# Here starts the actual work to be performed for the package under test;
6182
# any command which exits with a non-zero exit code causes the build to fail.
6283
script:
6384
- if [ -f configure.ac ]; then autoreconf -i; fi
64-
# this builds all libraries and executables (including tests/benchmarks)
65-
- cabal new-build ${TEST} ${BENCH} -v2 # -v2 provides useful information for debugging
66-
67-
# there's no 'cabal new-test' yet, so let's emulate for now
68-
- TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) );
69-
RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
70-
if dist-newstyle/build/*/build/$T/$T; then echo "= $T OK =";
71-
else echo "= $T FAILED ="; RC=false; fi; done; $RC
72-
- cabal sdist # test that a source-distribution can be generated
85+
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
86+
- cabal build # this builds all libraries and executables (including tests/benchmarks)
87+
- cabal test
88+
- cabal check
89+
- cabal sdist # tests that a source-distribution can be generated
7390

74-
# Check that the resulting source distribution can be built w/o and w tests
75-
- SRC_BASENAME=$(cabal info . | awk '{print $2;exit}')
76-
- tar -C dist/ -xf dist/$SRC_BASENAME.tar.gz
77-
- "echo 'packages: *.cabal' > dist/$SRC_BASENAME/cabal.project"
78-
- cd dist/$SRC_BASENAME/
79-
- cabal new-build --disable-tests --disable-benchmarks
80-
- rm -rf ./dist-newstyle
81-
- cabal new-build ${TEST} ${BENCH}
91+
# Check that the resulting source distribution can be built & installed.
92+
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
93+
# `cabal install --force-reinstalls dist/*-*.tar.gz`
94+
- SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
95+
(cd dist && cabal install --force-reinstalls "$SRC_TGZ")
8296

8397
# EOF

0 commit comments

Comments
 (0)