streaver/libertadores-cli

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
---
version: 2
jobs:
  node-latest: &test
    docker:
      - image: node:latest
    working_directory: ~/cli
    steps:
      - checkout
      - restore_cache: &restore_cache
          keys:
            - v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
            - v1-npm-{{checksum ".circleci/config.yml"}}
      - run:
          name: Install dependencies
          command: yarn
      - run: ./bin/run --version
      - run: ./bin/run --help
      - 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: Testing
          command: |
            mkdir /tmp/test-results
            ./cc-test-reporter before-build
            yarn test
            yarn report
      - run:
          name: Code Climate Test Coverage
          command: |
            ./cc-test-reporter format-coverage -t lcov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results
      - deploy:
          command: |
            ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
  node-10:
    <<: *test
    docker:
      - image: node:10
  cache:
    <<: *test
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: yarn
      - save_cache:
          key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
          paths:
            - ~/cli/node_modules
            - /usr/local/share/.cache/yarn
            - /usr/local/share/.config/yarn

workflows:
  version: 2
  'libertadores-cli':
    jobs:
      - node-latest
      - node-10
      - cache:
          filters:
            tags:
              only: /^v.*/
            branches:
              ignore: /.*/