# Use Travis CI's container infrastructure to enable caching.
sudo: false

# "haskell" will set up the whole haskell-platform.  We don't need that.
language: c

addons:
  apt:
    packages:
    - libgmp-dev
  # Just use the default version of PostgreSQL installed on Travis CI.
  # postgresql: "9.1"

env:
  - ARGS=""
  # - ARGS="--resolver lts-3"
  - ARGS="--resolver lts-4"
  - ARGS="--resolver lts"
  - ARGS="--resolver nightly"

before_install:
  - mkdir -p $HOME/.local/bin
  - export PATH=$HOME/.local/bin:$PATH
  - travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v1.0.4/stack-1.0.4-linux-x86_64.tar.gz | tar xz --strip-components=1 -C ~/.local/bin
  - stack $ARGS --no-terminal setup
  - stack ghc -- --version
  - stack $ARGS --no-terminal --skip-ghc-check install hspec-discover
    
install:
  - cp secrets.m4.example secrets.m4
  - make files
  - stack $ARGS --no-terminal --skip-ghc-check build

before_script:
  - psql -c 'create database betty_test;' -U postgres

script:
  - stack $ARGS --no-terminal --skip-ghc-check test

# Speed up subsequent builds using Stack caching.  
cache:
  directories:
    - $HOME/.stack

# Use Travis CI's container infrastructure to enable caching.
sudo: false

# "haskell" will set up the whole haskell-platform.  We don't need that.
language: c

addons:
  apt:
    packages:
    - libgmp-dev
  # Just use the default version of PostgreSQL installed on Travis CI.
  # postgresql: "9.1"

env:
  - ARGS=""
  # - ARGS="--resolver lts-3"
  - ARGS="--resolver lts-4"
  - ARGS="--resolver lts"
  - ARGS="--resolver nightly"

before_install:
  - mkdir -p $HOME/.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'
  - stack $ARGS --no-terminal setup
  - stack ghc -- --version
  - stack $ARGS --no-terminal --skip-ghc-check install hspec-discover
    
install:
  - cp secrets.m4.example secrets.m4
  - make files
  - stack $ARGS --no-terminal --skip-ghc-check build

before_script:
  - psql -c 'create database betty_test;' -U postgres

script:
  - stack $ARGS --no-terminal --skip-ghc-check test

# Speed up subsequent builds using Stack caching.  
cache:
  directories:
    - $HOME/.stack

Update install method of Stack on Travis CI.
Update install method of Stack on Travis CI.

Following documentation at http://docs.haskellstack.org/en/stable/travis_ci/
