|
1 | | -version: 2 |
| 1 | +version: 2.1 |
| 2 | + |
2 | 3 | general: |
3 | 4 | branches: |
4 | 5 | ignore: |
5 | 6 | - gh-pages |
| 7 | + |
| 8 | +docker_defaults: &docker_defaults |
| 9 | + docker: |
| 10 | + - image: circleci/node:12-browsers |
| 11 | + working_directory: ~/project/semantic-ui-react |
| 12 | + |
| 13 | +restore_node_modules: &restore_node_modules |
| 14 | + restore_cache: |
| 15 | + name: Restore node_modules cache |
| 16 | + keys: |
| 17 | + - v3-node-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 18 | + - v3-node-{{ .Branch }}- |
| 19 | + - v3-node- |
| 20 | + |
6 | 21 | jobs: |
7 | | - build: |
8 | | - docker: |
9 | | - - image: circleci/node:8-browsers |
10 | | - environment: |
11 | | - TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 22 | + bootstrap: |
| 23 | + <<: *docker_defaults |
12 | 24 | steps: |
13 | | - - run: |
14 | | - name: Update yarn |
15 | | - command: | |
16 | | - # remove default yarn |
17 | | - sudo rm -rf $(dirname $(which yarn))/yarn* |
18 | | - # download latest |
19 | | - rm -rf ~/.yarn |
20 | | - curl -o- -L https://yarnpkg.com/install.sh | bash |
21 | | - echo 'export PATH="${PATH}:${HOME}/.yarn/bin"' >> $BASH_ENV |
22 | 25 | - checkout |
23 | | - # because we don't invoke npm (we use yarn) we need to add npm bin to PATH manually |
24 | | - - run: |
25 | | - name: Add npm bin to PATH |
26 | | - command: echo 'export PATH="${PATH}:$(npm bin)"' >> $BASH_ENV |
27 | | - - restore_cache: |
28 | | - keys: |
29 | | - - v2-dependencies-{{ checksum "yarn.lock" }} |
| 26 | + - *restore_node_modules |
30 | 27 | - run: |
31 | 28 | name: Install Dependencies |
32 | | - command: yarn |
| 29 | + command: yarn install --frozen-lockfile |
33 | 30 | - save_cache: |
34 | | - key: v2-dependencies-{{ checksum "yarn.lock" }} |
| 31 | + name: Save yarn cache |
| 32 | + key: v3-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }} |
35 | 33 | paths: |
36 | | - - ~/.cache/yarn |
37 | | - - run: |
38 | | - name: Lint TypeScript |
39 | | - command: yarn tsd:lint |
40 | | - - run: |
41 | | - name: Test TypeScript |
42 | | - command: yarn tsd:test |
| 34 | + - .cache/yarn |
| 35 | + - save_cache: |
| 36 | + name: Save node_modules cache |
| 37 | + key: v3-node-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 38 | + paths: |
| 39 | + - node_modules/ |
43 | 40 | - run: |
44 | | - name: Lint JavaScript |
45 | | - command: yarn lint |
| 41 | + name: Remove node_modules to cleanup workspace |
| 42 | + command: rm -r node_modules/ |
| 43 | + - persist_to_workspace: |
| 44 | + root: ~/project |
| 45 | + paths: |
| 46 | + - semantic-ui-react |
| 47 | + |
| 48 | + test: |
| 49 | + <<: *docker_defaults |
| 50 | + steps: |
| 51 | + - attach_workspace: |
| 52 | + at: ~/project |
| 53 | + - *restore_node_modules |
46 | 54 | - run: |
47 | 55 | name: Test JavaScript |
48 | 56 | command: yarn test |
| 57 | + - run: |
| 58 | + name: Report coverage |
| 59 | + command: bash <(curl -s https://codecov.io/bash) |
| 60 | + - run: |
| 61 | + name: Test TypeScript |
| 62 | + command: yarn tsd:test |
49 | 63 | - run: |
50 | 64 | name: Test UMD bundle |
51 | 65 | command: yarn test:umd |
| 66 | + |
| 67 | + lint: |
| 68 | + <<: *docker_defaults |
| 69 | + steps: |
| 70 | + - attach_workspace: |
| 71 | + at: ~/project |
| 72 | + - *restore_node_modules |
52 | 73 | - run: |
53 | | - name: Report coverage |
54 | | - command: bash <(curl -s https://codecov.io/bash) |
| 74 | + name: Lint TypeScript |
| 75 | + command: yarn tsd:lint |
| 76 | + - run: |
| 77 | + name: Lint JavaScript |
| 78 | + command: yarn lint |
| 79 | + |
| 80 | +workflows: |
| 81 | + version: 2 |
| 82 | + main: |
| 83 | + jobs: |
| 84 | + - bootstrap |
| 85 | + - test: |
| 86 | + requires: |
| 87 | + - bootstrap |
| 88 | + - lint: |
| 89 | + requires: |
| 90 | + - bootstrap |
0 commit comments