programma-group/starter-mongo

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
version: 2
jobs:
  build:
    docker:
      - image: circleci/node:11.1.0
    working_directory: ~/repo
    steps:
      - checkout
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          - v1-dependencies-
      - run:
          name: Install dependencies
          command: yarn install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - run:
          name: Setup Code Climate test-reporter
          command: |
            curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
            chmod +x ./cc-test-reporter
      - run:
          name: Run eslint
          command: yarn eslint
      - run:
          name: Run the tests
          command: |
            ./cc-test-reporter before-build
            yarn test
            ./cc-test-reporter after-build --coverage-input-type lcov
  deploy-to-dev:
    docker:
      - image: buildpack-deps:trusty
    steps:
      - checkout
      - run:
          name: Deploy develop to Heroku
          command: |
            git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
  deploy-to-staging:
    docker:
      - image: buildpack-deps:trusty
    steps:
      - checkout
      - run:
          # This is a CircleCI job that deploys the code on master to the wherever the client wants
          # This can be AWS, DigitalOcean, Linode, etc.
          name: Deploy staging
          command: echo This will be added later, depending on the project
workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy-to-dev:
          requires:
            - build
          filters:
            branches:
              only: develop
      - deploy-to-staging:
          requires:
            - build
          filters:
            branches:
              only: master