eternity1984/node-red-contrib-friendly-id

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.1

workflows:
  version: 2
  build:
    jobs:
      - build

jobs:
  build:
    working_directory: ~/project
    docker:
      # specify the version you desire here
      - image: circleci/node:10.16.3
      
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: mongo:4.2.0

    steps:
      - checkout
      - run:
          name: update-npm
          command: 'sudo npm install -g npm@5'

      # Download and cache dependencies
      - restore_cache:
          keys:
          - dependency-cache-{{ checksum "package-lock.json" }}
          # fallback to using the latest cache if no exact match is found
          - dependency-cache-

      - run:
          name: install-npm-wee
          command: npm install

      - save_cache:
          key: dependency-cache-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules

      # run tests!
      - run:
          name: test
          command: npm test

      - run:
          name: code-coverage
          command: npm run cover

      - store_artifacts:
          path: test-results.xml

      - store_artifacts:
          path: coverage

      - store_test_results:
          path: test-results.xml

      - 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 tests
          command: |
            ./cc-test-reporter before-build
            npm test
            ./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?