image: haskell:8.2

services:
  - postgres:9.4

variables:
  POSTGRES_DB: betty_test
  POSTGRES_USER: betty
  POSTGRES_PASSWORD: betty

cache:
  untracked: true
  paths:
    - $(pwd)/.stack/

before_script:
  - export STACK_ROOT=$(pwd)/.stack
  - apt-get update -qq && apt-get install -qq -y m4 libpq-dev make xz-utils
  - cp secrets.m4.example secrets.m4
  - make files
  - stack upgrade
  - stack install hspec-discover
  - stack install --only-dependencies -j 4

test:
  script:
    - export PGHOST=postgres
    - export PGUSER=$POSTGRES_USER
    - export PGPASS=$POSTGRES_PASSWORD
    - export PGDATABASE=$POSTGRES_DB
    - stack test --coverage

after_script:
  - stack hpc report betty

image: haskell:8.2

services:
  - postgres:9.4

variables:
  POSTGRES_DB: betty_test
  POSTGRES_USER: betty
  POSTGRES_PASSWORD: betty

cache:
  untracked: true
  paths:
    - $(pwd)/.stack/

before_script:
  - export STACK_ROOT=$(pwd)/.stack
  - export PATH=${HOME}/.local/bin:$PATH
  - apt-get update -qq && apt-get install -qq -y m4 libpq-dev make xz-utils
  - cp secrets.m4.example secrets.m4
  - make files
  - stack upgrade
  - stack install hspec-discover
  - stack install --only-dependencies -j 4

test:
  script:
    - export PGHOST=postgres
    - export PGUSER=$POSTGRES_USER
    - export PGPASS=$POSTGRES_PASSWORD
    - export PGDATABASE=$POSTGRES_DB
    - stack test --coverage

after_script:
  - stack hpc report betty

Update $PATH in Gitlab CI.
Update $PATH in Gitlab CI.

Stack installs stuff in ~/.local/; when running `stack upgrade` the
new stack binary will be in ~/.local/bin.

Simply upgrading stack did not make the aeson exception go away:

  $ stack install hspec-discover
  Downloading lts-10.3 build plan ...
  Downloaded lts-10.3 build plan.
  AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""
