version: 2.1 references: x-workdir: &work-dir working_directory: ~/source x-save-workspace: &persist-step persist_to_workspace: root: ~/source paths: - . x-attach: &attach-step attach_workspace: at: . jobs: install-dependencies: <<: *work-dir docker: - image: circleci/node:10 environment: HUSKY_SKIP_INSTALL: 1 steps: - checkout - restore_cache: keys: - v1-npm-{{ checksum "package-lock.json" }} - run: name: Install dependencies command: | if [ ! -d node_modules ]; then npm ci fi - save_cache: key: v1-npm-{{ checksum "package-lock.json" }} paths: - node_modules - *persist-step lint: <<: *work-dir docker: - image: node steps: - *attach-step - run: name: lint command: npm run lint node-8: docker: - image: circleci/node:8 steps: - *attach-step - run: name: Test command: npm test node-10: docker: - image: circleci/node:10 steps: - *attach-step - run: name: Test command: npm test node-12: docker: - image: circleci/node:12 steps: - *attach-step - run: name: Test with coverage command: npm run test-check-coverage - run: name: Upload coverage report command: bash <(curl -s https://codecov.io/bash) -F unit -s coverage/lcov.info workflows: version: 2 commons-circle-ci: jobs: - install-dependencies - lint: requires: - install-dependencies - node-8: requires: - install-dependencies - node-10: requires: - install-dependencies - node-12: requires: - install-dependencies