Skip to content

Commit 8c0b113

Browse files
committed
WIP: new-build based script
1 parent 6cb1360 commit 8c0b113

File tree

2 files changed

+67
-70
lines changed

2 files changed

+67
-70
lines changed

.travis.yml

Lines changed: 66 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,97 @@
1-
# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
1+
# This file has been generated by `make_travis_yml_2.hs`
2+
# see https://github.com/hvr/multi-ghc-travis for more information
23
language: c
34
sudo: false
45

6+
git:
7+
submodules: false # whether to recursively clone submodules
8+
59
cache:
610
directories:
7-
- $HOME/.cabsnap
811
- $HOME/.cabal/packages
12+
- $HOME/.cabal/store
913

1014
before_cache:
1115
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
12-
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
16+
# remove files that are regenerated by 'cabal update'
17+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
18+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
19+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
20+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
21+
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
1322

1423
matrix:
1524
include:
16-
- env: CABALVER=1.16 GHCVER=7.0.4 NOTEST=1
17-
compiler: ": #GHC 7.0.4"
18-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,zlib1g-dev], sources: [hvr-ghc]}}
19-
- env: CABALVER=1.16 GHCVER=7.2.2 NOTEST=1
20-
compiler: ": #GHC 7.2.2"
21-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,zlib1g-dev], sources: [hvr-ghc]}}
22-
- env: CABALVER=1.16 GHCVER=7.4.2
23-
compiler: ": #GHC 7.4.2"
24-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,zlib1g-dev], sources: [hvr-ghc]}}
25-
- env: CABALVER=1.16 GHCVER=7.6.3
26-
compiler: ": #GHC 7.6.3"
27-
addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,zlib1g-dev], sources: [hvr-ghc]}}
28-
- env: CABALVER=1.18 GHCVER=7.8.4
29-
compiler: ": #GHC 7.8.4"
30-
addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,zlib1g-dev], sources: [hvr-ghc]}}
31-
- env: CABALVER=1.22 GHCVER=7.10.1
32-
compiler: ": #GHC 7.10.1"
33-
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,zlib1g-dev], sources: [hvr-ghc]}}
34-
- env: CABALVER=head GHCVER=head NOTEST=1
35-
compiler: ": #GHC head"
36-
addons: {apt: {packages: [cabal-install-head,ghc-head,zlib1g-dev], sources: [hvr-ghc]}}
37-
- env: CABALVER=head GHCVER=head
38-
compiler: ": #GHC head"
25+
- compiler: "ghc-7.0.4"
26+
env: TEST=--disable-tests
27+
addons: {apt: {packages: [cabal-install-head,ghc-7.0.4,zlib1g-dev], sources: [hvr-ghc]}}
28+
- compiler: "ghc-7.2.2"
29+
env: TEST=--disable-tests
30+
addons: {apt: {packages: [cabal-install-head,ghc-7.2.2,zlib1g-dev], sources: [hvr-ghc]}}
31+
- compiler: "ghc-7.4.2"
32+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
33+
addons: {apt: {packages: [cabal-install-head,ghc-7.4.2,zlib1g-dev], sources: [hvr-ghc]}}
34+
- compiler: "ghc-7.6.3"
35+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
36+
addons: {apt: {packages: [cabal-install-head,ghc-7.6.3,zlib1g-dev], sources: [hvr-ghc]}}
37+
- compiler: "ghc-7.8.4"
38+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
39+
addons: {apt: {packages: [cabal-install-head,ghc-7.8.4,zlib1g-dev], sources: [hvr-ghc]}}
40+
- compiler: "ghc-7.10.3"
41+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
42+
addons: {apt: {packages: [cabal-install-head,ghc-7.10.3,zlib1g-dev], sources: [hvr-ghc]}}
43+
- compiler: "ghc-8.0.1"
44+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
45+
addons: {apt: {packages: [cabal-install-head,ghc-8.0.1,zlib1g-dev], sources: [hvr-ghc]}}
46+
- compiler: "ghc-8.0.2"
47+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
48+
addons: {apt: {packages: [cabal-install-head,ghc-8.0.2,zlib1g-dev], sources: [hvr-ghc]}}
49+
- compiler: "ghc-head"
50+
# env: CABALVER=head TEST=--disable-tests BENCH=--disable-benchmarks
3951
addons: {apt: {packages: [cabal-install-head,ghc-head,zlib1g-dev], sources: [hvr-ghc]}}
4052

4153
allow_failures:
42-
- env: CABALVER=head GHCVER=head
54+
- compiler: "ghc-head"
4355

4456
before_install:
57+
- HC=${CC}
4558
- unset CC
46-
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
47-
- if [ "x$NOTEST" = "x" ]; then export CABFLAGS="--enable-tests"; else export CABFLAGS=""; fi
59+
- CABALVER=${CABALVER-head}
60+
- export PATH=/opt/ghc/bin:/opt/cabal/$CABALVER/bin:$PATH
61+
- PATH2=/opt/ghc/${HC/#ghc-}/bin:$PATH
4862

4963
install:
5064
- cabal --version
51-
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
52-
- if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
53-
then
54-
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
55-
$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
56-
fi
65+
- BENCH=${BENCH---enable-benchmarks}
66+
- TEST=${TEST---enable-tests}
67+
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
5768
- travis_retry cabal update -v
5869
- sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
59-
- cabal install --only-dependencies $CABFLAGS --dry -v > installplan.txt
60-
- sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
61-
62-
# check whether current requested install-plan matches cached package-db snapshot
63-
- if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
64-
then
65-
echo "cabal build-cache HIT";
66-
rm -rfv .ghc;
67-
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
68-
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
69-
else
70-
echo "cabal build-cache MISS";
71-
rm -rf $HOME/.cabsnap;
72-
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
73-
cabal install --only-dependencies $CABFLAGS;
74-
fi
75-
76-
# snapshot package-db on cache miss
77-
- if [ ! -d $HOME/.cabsnap ];
78-
then
79-
echo "snapshotting package-db to build-cache";
80-
mkdir $HOME/.cabsnap;
81-
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
82-
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
83-
fi
70+
- cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2
8471

8572
# Here starts the actual work to be performed for the package under test;
8673
# any command which exits with a non-zero exit code causes the build to fail.
8774
script:
8875
- if [ -f configure.ac ]; then autoreconf -i; fi
89-
- cabal configure $CABFLAGS -v2 # -v2 provides useful information for debugging
90-
- cabal build # this builds all libraries and executables (including tests/benchmarks)
91-
- if [ "x$NOTEST" = "x" ]; then cabal test; fi
92-
- cabal sdist # tests that a source-distribution can be generated
76+
- SRC_BASENAME=$(PATH=${PATH2} cabal info . | awk '{print $2;exit}')
77+
# this builds all libraries and executables (including tests/benchmarks)
78+
- cabal new-build -w ${HC} ${TEST} ${BENCH}
79+
80+
# there's no 'cabal new-test' yet, so let's emulate for now
81+
- TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) )
82+
- if [ "$TEST" != "--enable-tests" ]; then TESTS=(); fi
83+
- shopt -s globstar;
84+
RC=true; for T in ${TESTS[@]}; do echo "== $T ==";
85+
if dist-newstyle/build/**/$SRC_BASENAME/**/build/$T/$T; then echo "= $T OK =";
86+
else echo "= $T FAILED ="; RC=false; fi; done; $RC
87+
- cabal sdist # test that a source-distribution can be generated
9388

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

10097
# EOF

zlib.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ description: This package provides a pure interface for compressing and
1818
provides access to the full zlib feature set.
1919
build-type: Simple
2020
cabal-version: >= 1.10
21-
tested-with: GHC ==7.0.4, GHC ==7.2.2, GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.1, GHC ==7.11.*
21+
tested-with: GHC ==7.0.4, GHC ==7.2.2, GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1, GHC==8.0.2, GHC ==8.1.*
2222

2323
extra-source-files: changelog
2424
-- zlib C sources (for Windows)

0 commit comments

Comments
 (0)