|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +defaults: &defaults |
| 4 | + working_directory: ~/design-systems-cli |
| 5 | + docker: |
| 6 | + - image: circleci/node:10-browsers |
| 7 | + environment: |
| 8 | + TZ: '/usr/share/zoneinfo/America/Los_Angeles' |
| 9 | + |
| 10 | +aliases: |
| 11 | + # Circle related commands |
| 12 | + - &restore-cache |
| 13 | + keys: |
| 14 | + # Find a cache corresponding to this specific package.json checksum |
| 15 | + # when this file is changed, this key will fail |
| 16 | + - design-systems-cli-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }} |
| 17 | + - design-systems-cli-{{ checksum "yarn.lock" }} |
| 18 | + # Find the most recent cache used from any branch |
| 19 | + - design-systems-cli- |
| 20 | + - &save-cache |
| 21 | + key: design-systems-cli-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }} |
| 22 | + paths: |
| 23 | + - ~/.cache/yarn |
| 24 | + - node_modules |
| 25 | + # Yarn commands |
| 26 | + - &yarn |
| 27 | + name: Install Dependencies |
| 28 | + command: yarn install --frozen-lockfile --non-interactive --cache-folder=~/.cache/yarn |
| 29 | + - &lint |
| 30 | + name: Lint |
| 31 | + command: yarn lint |
| 32 | + - &test |
| 33 | + name: Test |
| 34 | + command: yarn test |
| 35 | + - &build |
| 36 | + name: Build |
| 37 | + command: yarn build |
| 38 | + |
| 39 | +jobs: |
| 40 | + install: |
| 41 | + <<: *defaults |
| 42 | + steps: |
| 43 | + - checkout |
| 44 | + - restore_cache: *restore-cache |
| 45 | + - run: *yarn |
| 46 | + - save_cache: *save-cache |
| 47 | + - persist_to_workspace: |
| 48 | + root: . |
| 49 | + paths: |
| 50 | + - . |
| 51 | + |
| 52 | + build: |
| 53 | + <<: *defaults |
| 54 | + steps: |
| 55 | + - attach_workspace: |
| 56 | + at: ~/design-systems-cli |
| 57 | + - run: *build |
| 58 | + - persist_to_workspace: |
| 59 | + root: . |
| 60 | + paths: |
| 61 | + - . |
| 62 | + |
| 63 | + lint: |
| 64 | + <<: *defaults |
| 65 | + steps: |
| 66 | + - attach_workspace: |
| 67 | + at: ~/design-systems-cli |
| 68 | + - run: *lint |
| 69 | + |
| 70 | + test: |
| 71 | + <<: *defaults |
| 72 | + steps: |
| 73 | + - attach_workspace: |
| 74 | + at: ~/design-systems-cli |
| 75 | + - run: *test |
| 76 | + |
| 77 | + pr-check: |
| 78 | + <<: *defaults |
| 79 | + steps: |
| 80 | + - attach_workspace: |
| 81 | + at: ~/design-systems-cli |
| 82 | + - run: |
| 83 | + name: Check PR for semantic version label |
| 84 | + command: auto pr-check --pr $CHANGE_ID --url $CIRCLE_BUILD_URL |
| 85 | + |
| 86 | + release: |
| 87 | + <<: *defaults |
| 88 | + steps: |
| 89 | + - attach_workspace: |
| 90 | + at: ~/design-systems-cli |
| 91 | + - run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config |
| 92 | + - run: |
| 93 | + name: Release |
| 94 | + command: yarn auto shipit |
| 95 | + |
| 96 | + publishDocs: |
| 97 | + <<: *defaults |
| 98 | + steps: |
| 99 | + - attach_workspace: |
| 100 | + at: ~/design-systems-cli |
| 101 | + - run: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config |
| 102 | + - run: |
| 103 | + name: Publish Docs |
| 104 | + command: yarn lerna run --scope @design-systems/docs deploy |
| 105 | + |
| 106 | +workflows: |
| 107 | + version: 2 |
| 108 | + build_and_test: |
| 109 | + jobs: |
| 110 | + - install |
| 111 | + |
| 112 | + - build: |
| 113 | + requires: |
| 114 | + - install |
| 115 | + |
| 116 | + - lint: |
| 117 | + requires: |
| 118 | + - build |
| 119 | + |
| 120 | + - test: |
| 121 | + requires: |
| 122 | + - build |
| 123 | + |
| 124 | + - pr-check: |
| 125 | + requires: |
| 126 | + - build |
| 127 | + filters: |
| 128 | + branches: |
| 129 | + ignore: |
| 130 | + - master |
| 131 | + |
| 132 | + - release: |
| 133 | + requires: |
| 134 | + - test |
| 135 | + - lint |
| 136 | + |
| 137 | + - publishDocs: |
| 138 | + requires: |
| 139 | + - release |
| 140 | + filters: |
| 141 | + branches: |
| 142 | + only: |
| 143 | + - master |
0 commit comments