before_script:
  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  - docker pull mongodb:$MONGODB_VERSION
  - docker tag mongodb ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mongodb:$MONGODB_VERSION
  - docker push mongodb

image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:12.16.3

# Info: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
services:
  - name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mongodb:4.2.6
    alias: mongodb

variables:
  MONGODB_VERSION: '4.2.6'
  MONGODB_URL: 'mongodb://localhost:27017/test'
  JWT_SECRET: 'test'

# http://docs.gitlab.com/ee/ci/yaml/README.html#cache
cache:
  paths:
    - node_modules/

test_client:
  script:
    - cd app/client
    - npm install
    - npm run jest

test_server:
  script:
    - cd app/server
    - node ./scripts/build.js
    - npm run test
