# Use a lightweight base image; we provide our own build tools.
language: c

matrix:
  include:
  - env: CABALVER=1.24 GHCVER=8.0.1
    addons: {apt: {packages: [cabal-install-1.24, ghc-8.0.1], sources: [hvr-ghc]}}
  - env: CABALVER=1.24 GHCVER=8.0.2
    addons: {apt: {packages: [cabal-install-1.24, ghc-8.0.2], sources: [hvr-ghc]}}
  - env: CABALVER=2.0 GHCVER=8.2.2
    addons: {apt: {packages: [cabal-install-2.0, ghc-8.2.2], sources: [hvr-ghc]}}
  - env: CABALVER=2.2 GHCVER=8.4.3
    addons: {apt: {packages: [cabal-install-2.2, ghc-8.4.3], sources: [hvr-ghc]}}
  - env: CABALVER=2.4 GHCVER=8.6.1
    addons: {apt: {packages: [cabal-install-2.4, ghc-8.6.1], sources: [hvr-ghc]}}

install:
 - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
 - cabal --version
 - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
 - travis_retry cabal update
 - cabal install --only-dependencies

script:
 - cabal configure -v2 --ghc-options='-Werror' # -v2 provides useful information for debugging
 - cabal build   # this builds all libraries and executables (including tests/benchmarks)
 - cabal check
