version: 2
jobs:
    build:
        working_directory: ~/schemats
        docker: # run the steps with Docker
            - image: node:14
            - image: keinos/sqlite3:latest
            - image: postgres:9.6
              environment:
                  POSTGRES_USER: ubuntu
                  POSTGRES_DB: schemats_test
                  POSTGRES_HOST_AUTH_METHOD: trust
            - image: mysql:5.7
              environment:
                  MYSQL_DATABASE: schemats_test
                  MYSQL_ALLOW_EMPTY_PASSWORD: true
        steps: # a collection of executable commands
            - checkout # special step to check out source code to working directory
            - run: yarn
            - run:
                  environment:
                      POSTGRES_URL: 'postgres://ubuntu:@localhost/schemats_test'
                      MYSQL_URL: 'mysql://root:@localhost/schemats_test'
                  command: yarn coverage:ci
            - store_artifacts:
                  path: coverage
                  prefix: coverage
