# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:10-stretch

# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
  - postgres

variables:

# This folder is cached between builds
cache:
  paths:
  - node_modules/
  - ldap_credentials.json

stages:
  - build
  - tests

### Jobs ###

# Install dependencies, compile the bundle.js,
build:transpile:
  stage: build
  before_script:
    - export NODE_ENV=staging
  script:
    - npm ci 
    - npm run build
  artifacts:
    paths:
      - build/

tests:
  stage: tests
  script:
    - echo '{"dn":"dn", "passwd":"passwd"}' >> ldap_credentials.json
    - npm i
    - npm run test