Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
config.yml 3.52 KiB
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.1
jobs:
  build:
    docker:
      - image: circleci/node:8.16-browsers
    
    environment:
      NODE_ENV: production
      JEST_JUNIT_OUTPUT_NAME: results.xml
    working_directory: ~/repo

    steps:
      - restore_cache:
          keys:
            - v1-git-{{ .Revision }}
            - v1-git-
      - checkout
      - save_cache:
          paths:
            - .git
          key: v1-git-{{ .Revision }}

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

      - run: sudo npm install -g greenkeeper-lockfile
      - run: npm --production=false install
      - run: greenkeeper-lockfile-update

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package-lock.json" }}

      - run:
          name: Lint
          command: npm run test:lint -- --quiet --output-file test-results/eslint/results.xml --format junit
      
      - run:
          name: Unit
          environment:
              JEST_JUNIT_OUTPUT_DIR: test-results/unit
          command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov
      - store_artifacts:
          path: coverage
      
      - run:
          name: Build
          command: npm run build
      - store_artifacts:
          path: build
      - store_artifacts:
          path: dist
      - save_cache:
          paths:
            - build
          key: v1-build-{{ .Revision }}
      - save_cache:
          paths:
            - dist
          key: v1-dist-{{ .Revision }}