# Thanks to:
# https://vadosware.io/post/zero-to-continuous-integrated-testing-a-haskell-project-with-gitlab/
#
#
image: nixos/nix:latest

variables:
  STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
  STACK_OPTS: "--system-ghc"

#before_script:
  #- apt-get update
  #- apt-get install make xz-utils

stages:
  - deps
  - test

deps:
  cache:
    paths:
      - /nix/store
      - node_modules/
  script:
    - nix-env -i git
    - nix-shell shell.nix --run 'yarn --skip-builds'

test:
  cache:
    # cache per branch name
    # key: ${CI_COMMIT_REF_SLUG}
    paths:
      - /nix/store
      - node_modules/
  script:
    # find 0.14.5 purescript version here:
    # https://lazamar.co.uk/nix-versions/
    - nix-env -i git
    - nix-shell shell.nix --run 'yarn --skip-builds'
    - nix-shell shell.nix --run test-ps
