|
| 1 | +language: c |
| 2 | + |
| 3 | +# explicitly request container-based infrastructure |
| 4 | +sudo: false |
| 5 | + |
| 6 | +# See also https://github.com/hvr/multi-ghc-travis for more information |
| 7 | +matrix: |
| 8 | + include: |
| 9 | + - env: CABALVER=1.18 GHCVER=7.8.4 |
| 10 | + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} |
| 11 | + - env: CABALVER=1.22 GHCVER=7.10.2 |
| 12 | + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2],sources: [hvr-ghc]}} |
| 13 | + - env: CABALVER=head GHCVER=head |
| 14 | + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} |
| 15 | + allow_failures: |
| 16 | + - env: CABALVER=head GHCVER=head |
| 17 | + |
| 18 | +before_install: |
| 19 | + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH |
| 20 | + |
| 21 | + # build SDL2 if necessary |
| 22 | + - bash travis-install-sdl2.sh |
| 23 | + - export PATH=$HOME/libsdl2/bin:$HOME/.cabal/bin:$PATH |
| 24 | + - export PKG_CONFIG_PATH=$HOME/libsdl2/lib/pkgconfig |
| 25 | + |
| 26 | +cache: |
| 27 | + directories: |
| 28 | + - $HOME/libsdl2 |
| 29 | + |
| 30 | +install: |
| 31 | + - cabal --version |
| 32 | + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" |
| 33 | + - travis_retry cabal update |
| 34 | + |
| 35 | +# install stuff that will confuse cabal otherwise |
| 36 | + - cabal install alex happy |
| 37 | + - cabal install gtk2hs-buildtools |
| 38 | + - cabal install "sdl2>=2.0.0" --extra-include-dirs=$HOME/libsdl2/include --extra-lib-dirs=$HOME/libsdl2/lib |
| 39 | + |
| 40 | + - cabal install --only-dependencies --enable-tests --enable-benchmarks |
| 41 | + |
| 42 | +# 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. |
| 43 | +script: |
| 44 | + - if [ -f configure.ac ]; then autoreconf -i; fi |
| 45 | + - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging |
| 46 | + - cabal build # this builds all libraries and executables (including tests/benchmarks) |
| 47 | + - cabal test |
| 48 | + - cabal check |
| 49 | + - cabal sdist # tests that a source-distribution can be generated |
| 50 | + |
| 51 | +# Check that the resulting source distribution can be built & installed. |
| 52 | +# If there are no other `.tar.gz` files in `dist`, this can be even simpler: |
| 53 | +# `cabal install --force-reinstalls dist/*-*.tar.gz` |
| 54 | + - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && |
| 55 | + (cd dist && cabal install --force-reinstalls "$SRC_TGZ") |
| 56 | + |
| 57 | +notifications: |
| 58 | + email: false |
| 59 | + |
0 commit comments