image: haskell:8.0.1

services:
  - postgres:9.4

variables:
  POSTGRES_DB: betty_test
  POSTGRES_USER: betty
  POSTGRES_PASSWORD: betty
  
cache:
  paths:
    - $HOME/.stack

before_script:
  - export STACK_ROOT=$HOME/.stack
  - echo $STACK_ROOT
  - apt-get update -qq && apt-get install -qq -y m4 libpq-dev
  - cp secrets.m4.example secrets.m4
  - make files
  - cat config/postgresql.yml  
  - stack install hspec-discover 
  - stack install --only-dependencies
  - ls $STACK_ROOT  

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

image: haskell:8.0.1

services:
  - postgres:9.4

variables:
  POSTGRES_DB: betty_test
  POSTGRES_USER: betty
  POSTGRES_PASSWORD: betty
  
cache:
  paths:
    - $(pwd)/.stack

before_script:
  - export STACK_ROOT=$(pwd)/.stack
  - echo $STACK_ROOT
  - apt-get update -qq && apt-get install -qq -y m4 libpq-dev
  - cp secrets.m4.example secrets.m4
  - make files
  - cat config/postgresql.yml  
  - stack install hspec-discover 
  - stack install --only-dependencies
  - ls $STACK_ROOT  

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

Change STACK_ROOT in Gitlab CI conf.
Change STACK_ROOT in Gitlab CI conf.

Gitlab CI will cache only files within the project workspace,
according to documentation at
https://docs.gitlab.com/ce/ci/yaml/README.html#cache
