|
1 | | -node10Environment: &node10Environment |
2 | | - docker: |
3 | | - - image: circleci/node:10 |
4 | | - working_directory: ~/nodejs |
5 | | -node12Environment: &node12Environment |
6 | | - docker: |
7 | | - - image: circleci/node:12 |
8 | | - working_directory: ~/nodejs |
| 1 | +version: 2.1 |
9 | 2 |
|
10 | 3 | aliases: |
11 | | - - &restore_yarn_cache |
| 4 | + - &working_directory ~/nodejs |
| 5 | + |
| 6 | + - &restore_yarn_cache_node_10 |
| 7 | + keys: |
| 8 | + - v1-yarn-cache-node_10-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 9 | + - v1-yarn-cache-node_10-{{ .Branch }} |
| 10 | + - v1-yarn-cache-node_10 |
| 11 | + |
| 12 | + - &save_yarn_cache_node_10 |
| 13 | + key: v1-yarn-cache-node_10-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 14 | + paths: |
| 15 | + - ~/.cache/yarn |
| 16 | + |
| 17 | + - &restore_yarn_cache_node_12 |
12 | 18 | keys: |
13 | | - - v3-yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} |
14 | | - - v3-yarn-cache-{{ .Branch }} |
15 | | - - v3-yarn-cache |
| 19 | + - v1-yarn-cache-node_12-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 20 | + - v1-yarn-cache-node_12-{{ .Branch }} |
| 21 | + - v1-yarn-cache-node_12 |
16 | 22 |
|
17 | | - - &save_yarn_cache |
18 | | - key: v3-yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} |
| 23 | + - &save_yarn_cache_node_12 |
| 24 | + key: v1-yarn-cache-node_12-{{ .Branch }}-{{ checksum "yarn.lock" }} |
19 | 25 | paths: |
20 | | - - node_modules |
21 | 26 | - ~/.cache/yarn |
22 | 27 |
|
23 | 28 | - &yarn_install |
24 | 29 | name: Installing |
25 | 30 | command: yarn --frozen-lockfile |
26 | 31 |
|
27 | | - - &unit_test |
28 | | - name: Unit testing |
29 | | - # Limiting the workers of Jest to 10 |
30 | | - # as the build otherwise dies due to resouce restrictions. |
31 | | - command: yarn test:ci --maxWorkers=10 |
| 32 | +executors: |
| 33 | + node_10: |
| 34 | + docker: |
| 35 | + - image: circleci/node:10.22.0 |
| 36 | + working_directory: *working_directory |
| 37 | + node_12: |
| 38 | + docker: |
| 39 | + # Keep it at `12.18.2` as otherwise there may be bugs with `graceful-fs` dependency |
| 40 | + # https://github.com/nodejs/node/issues/34529 |
| 41 | + - image: circleci/node:12.18.2 |
| 42 | + working_directory: *working_directory |
32 | 43 |
|
33 | | - - &unit_test_with_coverage |
34 | | - name: Unit testing (with coverage report) |
35 | | - command: yarn test:coverage:ci |
36 | | - |
37 | | -version: 2 |
38 | 44 | jobs: |
39 | | - lint: |
40 | | - <<: *node12Environment |
| 45 | + install_test_node_10: |
| 46 | + executor: node_10 |
41 | 47 | steps: |
42 | 48 | - checkout |
43 | | - - restore-cache: *restore_yarn_cache |
| 49 | + - restore_cache: *restore_yarn_cache_node_10 |
44 | 50 | - run: *yarn_install |
45 | | - - save_cache: *save_yarn_cache |
| 51 | + - save_cache: *save_yarn_cache_node_10 |
46 | 52 | - run: |
47 | | - name: Linting |
| 53 | + name: Running linters |
48 | 54 | # Limiting the workers of Jest to 10 |
49 | | - # as the build otherwise dies due to resouce restrictions. |
| 55 | + # as the build otherwise dies due to resource restrictions. |
50 | 56 | command: yarn lint --maxWorkers=10 |
51 | | - test_unit_node_10: |
52 | | - <<: *node10Environment |
53 | | - steps: |
54 | | - - checkout |
55 | | - - restore-cache: *restore_yarn_cache |
56 | | - - run: *yarn_install |
57 | | - - save_cache: *save_yarn_cache |
58 | | - - run: *unit_test |
59 | | - test_unit_node_12: |
60 | | - <<: *node12Environment |
61 | | - steps: |
62 | | - - checkout |
63 | | - - restore-cache: *restore_yarn_cache |
64 | | - - run: *yarn_install |
65 | | - - save_cache: *save_yarn_cache |
66 | | - - run: *unit_test_with_coverage |
67 | | - test_integration: |
68 | | - <<: *node12Environment |
| 57 | + - run: |
| 58 | + name: Running tests |
| 59 | + # Limiting the workers of Jest to 10 |
| 60 | + # as the build otherwise dies due to resource restrictions. |
| 61 | + command: yarn test:ci |
| 62 | + |
| 63 | + install_test_node_12: |
| 64 | + executor: node_12 |
69 | 65 | steps: |
70 | 66 | - checkout |
71 | | - - restore-cache: *restore_yarn_cache |
| 67 | + - restore_cache: *restore_yarn_cache_node_12 |
72 | 68 | - run: *yarn_install |
73 | | - - save_cache: *save_yarn_cache |
| 69 | + - save_cache: *save_yarn_cache_node_12 |
| 70 | + - run: |
| 71 | + name: Running linters |
| 72 | + # Limiting the workers of Jest to 10 |
| 73 | + # as the build otherwise dies due to resource restrictions. |
| 74 | + command: yarn lint --maxWorkers=10 |
| 75 | + - run: |
| 76 | + name: Running tests (with coverage report) |
| 77 | + # Limiting the workers of Jest to 10 |
| 78 | + # as the build otherwise dies due to resource restrictions. |
| 79 | + command: yarn test:coverage:ci |
74 | 80 | - run: |
75 | | - name: Integration testing |
| 81 | + name: Running integration tests |
76 | 82 | command: yarn test:integration |
77 | 83 |
|
78 | 84 | workflows: |
79 | 85 | version: 2 |
80 | 86 | build_and_test: |
81 | 87 | jobs: |
82 | | - - lint |
83 | | - - test_unit_node_10: |
84 | | - requires: |
85 | | - - lint |
86 | | - - test_unit_node_12: |
87 | | - requires: |
88 | | - - lint |
89 | | - - test_integration: |
| 88 | + - install_test_node_10 |
| 89 | + - install_test_node_12: |
90 | 90 | context: org-global |
91 | | - requires: |
92 | | - # Only depending on one unit testing |
93 | | - # job will speed up the build by starting |
94 | | - # the integration testing early (in confidence). |
95 | | - - test_unit_node_12 |
0 commit comments