#
# NOTE: this is the circleci config which is used to publish @adobe/create-helix-service
# to NPM. The circleci config for the actual service to be created is in templates/.circleci
# and will be patched.
#
version: 2.1
executors:
  node14:
    docker:
      - image: cimg/node:14.19
    environment:
      NPM_CONFIG_PREFIX: "~/.npm-global"
    working_directory: ~/repo

commands:
  setup:
    steps:
    - checkout
    - run:
        name: install latest npm
        command: sudo npm -g install npm
    - run:
        name: Installing Dependencies
        command: npm ci
    - run:
        name: prepare test git user
        command: git config --global user.email "circleci@example.com" && git config --global user.name "CircleCi Build"

jobs:
  build:
    executor: node14

    steps:
    - setup
    - run: mkdir junit
    - run:
        name: Lint
        command: npm run lint

    - run:
        name: Getting Code Coverage
        command: npm run test-ci

    - store_test_results:
        path: junit

    - store_artifacts:
        path: junit

workflows:
  version: 2
  build:
    jobs:
    - build
