image: node:latest

cache:
  paths:
  - node_modules/
  - /usr/local/lib/node_modules/

stages:
- test
- pages

test:
  stage: test
  script:
  - npm install --global yarn
  - yarn install
  - yarn test
  artifacts:
    paths:
    - coverage

pages:
  stage: pages
  dependencies:
  - test
  script:
  - mkdir public/
  - mv coverage/ public/coverage/
  artifacts:
    paths:
      - public
  only:
    - master
