version: 2
jobs:
  build:
    docker:
      - image: 'circleci/node:10'
    steps:
      - checkout
      - run: 
          name: Install Modules
          command: npm install
      - run: 
          name: Build JS
          command: npm run build
  test:
    docker:
      - image: "circleci/node:10"
    steps:
      - checkout
      - run: 
          name: Install Modules
          command: npm install
      - run: 
          name: Build
          command: npm run build
      - run:
          name: Test JS
          command: npm run test
  publish:
    docker:
      - image: "circleci/node:10"
    steps:
     - checkout
     - run: 
        name: Install Modules
        command: npm install
     - run: 
        name: Build JS
        command: npm run build
     - run: 
        name: Publish to NPM
        command: npm run semantic-release
workflows: 
  version: 2
  build_and_test:
    jobs:
      - build
      - test:
          requires:
            - build
      - publish:
          requires:
            - build
            - test