# Use a minimal base image.
language: c

# Do not spam us with build status emails please.
notifications:
  email: false

addons:
  apt:
    sources:
      - fpcomplete-trusty
    packages:
      - stack
      # Haskell requires libgmp for big integers.
      - libgmp-dev

cache:
  directories:
    - $HOME/.stack
    - $TRAVIS_BUILD_DIR/server/.stack-work
    - $TRAVIS_BUILD_DIR/client-haskell/.stack-work

install:
  # Install the compiler. Pass --no-terminal to tell Stack it is not running in
  # an interactive terminal, so it prints messages sequentially instead of
  # updating them. The latter is less spammy but Travis does not support these
  # interactive terminal capabilities.
  - (cd server && stack setup -j2 --no-terminal)
  - (cd client-haskell && stack setup -j2 --no-terminal)

script:
  # Build and test.
  - (cd server && stack build -j2 --no-terminal)
  - (cd server && stack test  -j2 --no-terminal)
  - (cd client-haskell && stack build -j2 --no-terminal)
  - (cd client-haskell && stack test  -j2 --no-terminal)

# Use a minimal base image.
language: c

# Do not spam us with build status emails please.
notifications:
  email: false

addons:
  apt:
    sources:
      - fpcomplete-trusty
    packages:
      # Haskell requires libgmp for big integers.
      - libgmp-dev

cache:
  directories:
    - $HOME/.stack
    - $TRAVIS_BUILD_DIR/server/.stack-work
    - $TRAVIS_BUILD_DIR/client-haskell/.stack-work

before_install:
# Download and unpack the stack executable
# We need the latest version to work around some bugs in older versions of stack
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

install:
  # Install the compiler. Pass --no-terminal to tell Stack it is not running in
  # an interactive terminal, so it prints messages sequentially instead of
  # updating them. The latter is less spammy but Travis does not support these
  # interactive terminal capabilities.
  - (cd server && stack setup -j2 --no-terminal)
  - (cd client-haskell && stack setup -j2 --no-terminal)

script:
  # Build and test.
  - (cd server && stack build -j2 --no-terminal)
  - (cd server && stack test  -j2 --no-terminal)
  - (cd client-haskell && stack build -j2 --no-terminal)
  - (cd client-haskell && stack test  -j2 --no-terminal)

Install the latest version of stack
Install the latest version of stack

Travis keeps failing with this error otherwise:

AesonException "Error in $.packages.cassava.constraints.flags

Newer versions fix that.
