Ephigenia/circleboard2

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
# - https://circleci.com/docs/2.0/configuration-reference/
#
version: 2

# References with an "&" can be reused
references:
  container_config_browser: &container_config
    docker:
      # https://circleci.com/docs/2.0/circleci-images/#nodejs
      - image: circleci/node:8.11.1-browsers
    working_directory: ~/repo
  attach_workspace: &attach_workspace
    attach_workspace:
      at: ~/repo

jobs:

  # setup the repository, install node packages or use the ones from previous
  # builds that are in the cache
  setup:
    <<: *container_config
    steps:
      - checkout
      - restore_cache:
          name: restore cached npm packages
          key: npm-packages-{{ checksum "package-lock.json" }}
      - run: npm install
      - save_cache:
          key: npm-packages-{{ checksum "package-lock.json" }}
          paths:
            - ./node_modules/
            - ~/.npm/
      - persist_to_workspace:
          root: ~/repo
          paths: ./*

  e2e:
    <<: *container_config
    steps:
      - *attach_workspace
      - run: npm run e2e

  lint:
    <<: *container_config
    steps:
      - *attach_workspace
      - run: npm run lint

  test:
    <<: *container_config
    steps:
      - *attach_workspace
      - run: npm test
      - store_artifacts:
          path: ./tests/coverage
          destination: coverage-unit-tests
      - store_test_results:
          path: ./tests/

  dist:
    <<: *container_config
    steps:
      - *attach_workspace
      - run: npm run dist
      - run: tar cfz "circleboard.tar.gz" dist
      - store_artifacts:
          path: ./circleboard.tar.gz
          destination: dist

workflows:
  version: 2
  default:
    jobs:
      - setup
      - lint:
          requires:
            - setup
      - e2e:
          requires:
            - setup
      - test:
          requires:
            - setup
      - dist:
          requires:
            - setup