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

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
  - ${HOME}/.local/bin/stack setup
  - ${HOME}/.local/bin/stack install hspec-discover
  - ${HOME}/.local/bin/stack install --only-dependencies -j 4

test:
  script:
    - export PGHOST=postgres
    - export PGUSER=$POSTGRES_USER
    - export PGPASS=$POSTGRES_PASSWORD
    - export PGDATABASE=$POSTGRES_DB
    - ${HOME}/.local/bin/stack test --coverage

after_script:
  - ${HOME}/.local/bin/stack hpc report betty

Use absolute path to stack binary in Gitlab CI.
Use absolute path to stack binary in Gitlab CI.

Unsure if setting up $PATH worked or not; don't want to speculate any
further.
