Move ShortText to Distribution.Utils.ShortText to avoid cycles
[cabal.git] / travis-script.sh
blob898526038015fdbe77588f0a2b85f31999bc49e1
1 #!/bin/sh
3 # ATTENTION! Before editing this file, maybe you can make a
4 # separate script to do your test? We don't want individual
5 # Travis builds to take too long (they time out at 50min and
6 # it's generally unpleasant if the build takes that long.)
7 # If you make a separate matrix entry in .travis.yml it can
8 # be run in parallel.
10 . ./travis-common.sh
12 CABAL_BDIR="${PWD}/dist-newstyle/build/Cabal-${CABAL_VERSION}"
13 CABAL_INSTALL_BDIR="${PWD}/dist-newstyle/build/cabal-install-${CABAL_VERSION}"
14 CABAL_INSTALL_SETUP="${CABAL_INSTALL_BDIR}/setup/setup"
15 # --hide-successes uses terminal control characters which mess up
16 # Travis's log viewer. So just print them all!
17 TEST_OPTIONS=""
19 # ---------------------------------------------------------------------
20 # Update the Cabal index
21 # ---------------------------------------------------------------------
23 timed cabal update
25 # ---------------------------------------------------------------------
26 # Install happy if necessary
27 # ---------------------------------------------------------------------
29 if ! command -v happy; then
30 timed cabal install happy
33 # ---------------------------------------------------------------------
34 # Setup our local project
35 # ---------------------------------------------------------------------
37 cp cabal.project.travis cabal.project.local
39 # ---------------------------------------------------------------------
40 # Cabal
41 # ---------------------------------------------------------------------
43 # Needed to work around some bugs in nix-local-build code.
44 export CABAL_BUILDDIR="${CABAL_BDIR}"
46 # NB: Best to do everything for a single package together as it's
47 # more efficient (since new-build will uselessly try to rebuild
48 # Cabal otherwise).
49 timed cabal new-build Cabal Cabal:package-tests Cabal:unit-tests
51 # NB: the '|| exit $?' workaround is required on old broken versions of bash
52 # that ship with OS X. See https://github.com/haskell/cabal/pull/3624 and
53 # http://stackoverflow.com/questions/14970663/why-doesnt-bash-flag-e-exit-when-a-subshell-fails
55 # Run tests
56 (cd Cabal && timed ${CABAL_BDIR}/build/package-tests/package-tests $TEST_OPTIONS) || exit $?
57 (cd Cabal && timed ${CABAL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
59 # Run haddock (hack: use the Setup script from package-tests!)
60 (cd Cabal && timed cabal act-as-setup --build-type=Simple -- haddock --builddir=${CABAL_BDIR}) || exit $?
62 # Redo the package tests with different versions of GHC
63 # TODO: reenable me
64 # if [ "x$TEST_OLDER" = "xYES" -a "x$TRAVIS_OS_NAME" = "xlinux" ]; then
65 # CABAL_PACKAGETESTS_WITH_GHC=/opt/ghc/7.0.4/bin/ghc \
66 # ./dist/setup/setup test package-tests --show-details=streaming
67 # CABAL_PACKAGETESTS_WITH_GHC=/opt/ghc/7.2.2/bin/ghc \
68 # ./dist/setup/setup test package-tests --show-details=streaming
69 # fi
71 # Check for package warnings
72 (cd Cabal && timed cabal check) || exit $?
74 unset CABAL_BUILDDIR
76 if [ "x$CABAL_LIB_ONLY" = "xYES" ]; then
77 exit 0;
80 # ---------------------------------------------------------------------
81 # cabal-install
82 # ---------------------------------------------------------------------
84 # Needed to work around some bugs in nix-local-build code.
85 export CABAL_BUILDDIR="${CABAL_INSTALL_BDIR}"
87 timed cabal new-build cabal-install:cabal \
88 cabal-install:integration-tests \
89 cabal-install:integration-tests2 \
90 cabal-install:unit-tests \
91 cabal-install:solver-quickcheck
93 # The integration-tests2 need the hackage index, and need it in the secure
94 # format, which is not necessarily the default format of the bootstrap cabal.
95 # If the format does match then this will be very quick.
96 timed ${CABAL_INSTALL_BDIR}/build/cabal/cabal update
98 # Run tests
99 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/unit-tests/unit-tests $TEST_OPTIONS) || exit $?
100 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/solver-quickcheck/solver-quickcheck $TEST_OPTIONS --quickcheck-tests=1000) || exit $?
101 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/integration-tests/integration-tests $TEST_OPTIONS) || exit $?
102 (cd cabal-install && timed ${CABAL_INSTALL_BDIR}/build/integration-tests2/integration-tests2 $TEST_OPTIONS) || exit $?
104 # Haddock
105 (cd cabal-install && timed ${CABAL_INSTALL_SETUP} haddock --builddir=${CABAL_INSTALL_BDIR} ) || exit $?
107 (cd cabal-install && timed cabal check) || exit $?
109 unset CABAL_BUILDDIR
111 # Check what we got
112 ${CABAL_INSTALL_BDIR}/build/cabal/cabal --version