MatteoGabriele/vue-gtag

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2

jobs:
  dependencies:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run:
          command: yarn
      - save_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
  test:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run:
          command: yarn test

  lint:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run:
          command: yarn lint

  code_climate:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run:
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
            ./cc-test-reporter before-build
            yarn coverage:lcov
            ./cc-test-reporter after-build

  build:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run:
          command: yarn build

  semantic_release:
    docker:
      - image: circleci/node:12.18.1
    steps:
      - checkout
      - restore_cache:
          key: v1-yarn-{{ checksum "yarn.lock" }}
      - run: yarn semantic-release


workflows:
  version: 2
  workflow:
    jobs:
      - dependencies

      - lint:
          requires:
            - dependencies

      - test:
          requires:
            - dependencies

      - code_climate:
          filters:
            branches:
              only:
                - master
          requires:
            - test
            - lint

      - build:
          requires:
            - test
            - lint
            - code_climate

      - semantic_release:
          filters:
            branches:
              only:
                - master
          requires:
            - build