image: node:6

# Set up MySQL test-database
services:
  - mysql:latest

# Configure test-database
variables:
  MYSQL_DATABASE: db
  MYSQL_ROOT_PASSWORD: secret
  
# Install node libraries
before_script:
  - npm install
  
# Run JEST tests
run_tests:
  stage: test
  script:
    - npm test
    
# Publish coverage report on gitlab-pages
pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r coverage/* .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

