version: 2
workflows:
  version: 2
  test:
    jobs:
      - test-14
      - test-12
jobs:
  test-14: &test-template
    docker:
      - &node-template
        image: cimg/node:14.12.0
        environment:
          NODE_OPTIONS: --max-http-header-size=32768
          NODE_CONFIG: '{"db":"postgresql://postgres@localhost/qlobber-pg"}'
      - &pg-template
        image: circleci/postgres:12
        environment:
          POSTGRES_USER: postgres
          POSTGRES_DB: qlobber-pg
          POSTGRES_HOST_AUTH_METHOD: trust
    steps:
      - checkout
      - run:
          name: install
          command: |
            sudo apt update
            sudo apt -y install libboost-context-dev lcov
            npm install
      - run:
          name: test
          command: ./test/ci-test.sh
          environment:
            CHECK_VER: 14
  test-12:
    <<: *test-template
    docker:
      - <<: *node-template
        image: cimg/node:12.18.4
      - *pg-template
