version: 2
jobs:
  build:
    docker:
      - image: circleci/node:14
        environment:
          MSSQL_DB: master
          MSSQL_HOST: localhost
          MSSQL_PASSWORD: yourStrong(!)Password
          MSSQL_USER: sa
          MYSQL_DATABASE: winston
          MYSQL_PASSWORD: mysecretpassword
          MYSQL_ROOT_HOST: 127.0.0.1
          MYSQL_ROOT_PASSWORD: mysecretpassword
          MYSQL_USER: winston
          PGDATABASE: winston
          PGHOST: 127.0.0.1
          PGPASSWORD: mysecretpassword
          PGPORT: 5432
          PGUSER: winston
      - image: mysql/mysql-server:latest
        environment:
          MYSQL_DATABASE: winston
          MYSQL_PASSWORD: mysecretpassword
          MYSQL_ROOT_HOST: 127.0.0.1
          MYSQL_ROOT_PASSWORD: mysecretpassword
          MYSQL_USER: winston
      - image: mcr.microsoft.com/azure-sql-edge
        environment:
          ACCEPT_EULA: Y
          SA_PASSWORD: yourStrong(!)Password
      - image: postgres:latest
        environment:
          POSTGRES_DB: winston
          POSTGRES_PASSWORD: mysecretpassword
          POSTGRES_USER: winston

    working_directory: ~/winston-sql-transport

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: npm test
