|
1 | | -version: 2 |
2 | | - |
3 | | -defaults: &defaults |
4 | | - docker: |
5 | | - - image: circleci/node:14.4.0 |
| 1 | +version: 2.1 |
6 | 2 |
|
7 | 3 | jobs: |
8 | | - dependencies: |
9 | | - <<: *defaults |
| 4 | + test: |
| 5 | + docker: |
| 6 | + - image: cimg/node:14.19 |
| 7 | + working_directory: ~/lib |
10 | 8 | steps: |
11 | 9 | - checkout |
12 | | - - restore_cache: |
13 | | - key: dependency-cache-{{ checksum "package-lock.json" }} |
14 | 10 | - run: |
15 | | - name: Npm Install |
| 11 | + name: Install |
16 | 12 | command: npm install |
17 | | - - save_cache: |
18 | | - key: dependency-cache-{{ checksum "package-lock.json" }} |
19 | | - paths: |
20 | | - - node_modules |
21 | | - - persist_to_workspace: |
22 | | - root: . |
23 | | - paths: |
24 | | - - node_modules/ |
25 | | - |
26 | | - lint: |
27 | | - <<: *defaults |
28 | | - steps: |
29 | | - - checkout |
30 | | - - attach_workspace: |
31 | | - at: . |
32 | 13 | - run: |
33 | 14 | name: Lint |
34 | 15 | command: npm run lint |
35 | | - |
36 | | - build: |
37 | | - <<: *defaults |
38 | | - steps: |
39 | | - - checkout |
40 | | - - attach_workspace: |
41 | | - at: . |
42 | | - - run: npm run build |
43 | | - - persist_to_workspace: |
44 | | - root: . |
45 | | - paths: |
46 | | - - dist/ |
47 | | - |
48 | | - test_pre: |
49 | | - <<: *defaults |
50 | | - steps: |
51 | | - - attach_workspace: |
52 | | - at: . |
53 | | - - run: |
54 | | - name: Download cc-test-reporter |
55 | | - command: | |
56 | | - mkdir -p tmp/ |
57 | | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter |
58 | | - chmod +x ./tmp/cc-test-reporter |
59 | | - - persist_to_workspace: |
60 | | - root: . |
61 | | - paths: |
62 | | - - tmp/cc-test-reporter |
63 | | - |
64 | | - test_post: |
65 | | - <<: *defaults |
66 | | - steps: |
67 | | - - attach_workspace: |
68 | | - at: . |
69 | | - - run: |
70 | | - name: Upload coverage results to Code Climate |
71 | | - command: | |
72 | | - tmp/cc-test-reporter sum-coverage tmp/coverage/codeclimate.*.json -p 1 -o tmp/coverage/codeclimate.total.json |
73 | | - CC_TEST_REPORTER_ID=$CODE_CLIMATE_REPORTER_ID tmp/cc-test-reporter upload-coverage -i tmp/coverage/codeclimate.total.json |
74 | | -
|
75 | | - test_unit: |
76 | | - <<: *defaults |
77 | | - steps: |
78 | | - - checkout |
79 | | - - attach_workspace: |
80 | | - at: . |
81 | | - - run: |
82 | | - name: Unit Tests |
83 | | - command: | |
84 | | - npm run test:unit:coverage |
85 | | - - run: |
86 | | - name: Code Climate Coverage |
87 | | - command: | |
88 | | - ls |
89 | | - ls tmp/ |
90 | | - tmp/cc-test-reporter format-coverage -t lcov -o tmp/coverage/codeclimate.unit.json tests/reports/unit/coverage/lcov.info |
91 | | - - store_artifacts: |
92 | | - path: tests/reports/unit/junit.xml |
93 | | - prefix: tests |
94 | | - - store_artifacts: |
95 | | - path: tests/reports/unit/coverage |
96 | | - prefix: coverage |
97 | | - - store_test_results: |
98 | | - path: tests/reports/unit |
99 | | - - persist_to_workspace: |
100 | | - root: . |
101 | | - paths: |
102 | | - - tmp/coverage |
103 | | -# - run: |
104 | | -# name: Coveralls |
105 | | -# command: export COVERALLS_GIT_COMMIT=$CIRCLE_SHA1 && npm run coveralls < tests/reports/unit/coverage/lcov.info |
106 | | - |
107 | | - test_int: #TODO - multiple node envs |
108 | | - <<: *defaults |
109 | | - steps: |
110 | | - - checkout |
111 | | - - attach_workspace: |
112 | | - at: . |
113 | 16 | - run: |
114 | | - name: Integrations Tests |
115 | | - command: npm run test:int |
116 | | - - store_artifacts: |
117 | | - path: tests/reports/int/junit.xml |
118 | | - prefix: tests |
119 | | - - store_test_results: |
120 | | - path: tests/reports/int |
121 | | - |
| 17 | + name: Test |
| 18 | + command: npm run test |
122 | 19 | release: |
123 | | - <<: *defaults |
| 20 | + docker: |
| 21 | + - image: cimg/node:14.19 |
| 22 | + working_directory: ~/lib |
124 | 23 | steps: |
125 | 24 | - checkout |
126 | | - - attach_workspace: |
127 | | - at: . |
128 | 25 | - run: |
129 | | - name: Authenticate with registry |
130 | | - command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc |
| 26 | + name: Install |
| 27 | + command: npm install |
131 | 28 | - run: |
132 | | - name: Publish package |
133 | | - command: npm publish |
| 29 | + name: Release |
| 30 | + command: npx semantic-release@17 |
134 | 31 |
|
135 | 32 | workflows: |
136 | 33 | version: 2 |
137 | | - build_and_test: |
138 | | - jobs: |
139 | | - - dependencies |
140 | | - - lint: |
141 | | - requires: |
142 | | - - dependencies |
143 | | - - build: |
144 | | - requires: |
145 | | - - lint |
146 | | - - test_pre |
147 | | - - test_unit: |
148 | | - requires: |
149 | | - - lint |
150 | | - - test_pre |
151 | | - |
152 | | - - test_int: |
153 | | - requires: |
154 | | - - build |
155 | | - - test_pre |
156 | | - - test_post: |
157 | | - requires: |
158 | | - - test_unit |
159 | | - - test_int |
160 | | - |
161 | | - release: |
| 34 | + test: |
162 | 35 | jobs: |
163 | | - - dependencies: |
| 36 | + - test: |
| 37 | + name: Test |
| 38 | + context: nodejs-install |
164 | 39 | filters: |
165 | | - tags: |
166 | | - only: /^v.*/ |
167 | 40 | branches: |
168 | | - ignore: /.*/ |
169 | | - - lint: |
170 | | - requires: |
171 | | - - dependencies |
172 | | - filters: |
173 | | - tags: |
174 | | - only: /^v.*/ |
175 | | - branches: |
176 | | - ignore: /.*/ |
177 | | - - test_pre: |
178 | | - filters: |
179 | | - tags: |
180 | | - only: /^v.*/ |
181 | | - branches: |
182 | | - ignore: /.*/ |
183 | | - - test_unit: |
184 | | - requires: |
185 | | - - lint |
186 | | - - test_pre |
187 | | - filters: |
188 | | - tags: |
189 | | - only: /^v.*/ |
190 | | - branches: |
191 | | - ignore: /.*/ |
192 | | - - build: |
193 | | - requires: |
194 | | - - lint |
195 | | - filters: |
196 | | - tags: |
197 | | - only: /^v.*/ |
198 | | - branches: |
199 | | - ignore: /.*/ |
200 | | - - test_int: |
201 | | - requires: |
202 | | - - build |
203 | | - - test_pre |
204 | | - filters: |
205 | | - tags: |
206 | | - only: /^v.*/ |
207 | | - branches: |
208 | | - ignore: /.*/ |
209 | | - - test_post: |
210 | | - requires: |
211 | | - - test_unit |
212 | | - - test_int |
213 | | - filters: |
214 | | - tags: |
215 | | - only: /^v.*/ |
216 | | - branches: |
217 | | - ignore: /.*/ |
| 41 | + ignore: |
| 42 | + - main |
| 43 | + release: |
| 44 | + jobs: |
218 | 45 | - release: |
219 | | - requires: |
220 | | - - test_unit |
221 | | - - test_int |
222 | | - - build |
| 46 | + name: Release |
| 47 | + context: nodejs-lib-release |
223 | 48 | filters: |
224 | | - tags: |
225 | | - only: /^v.*/ |
226 | 49 | branches: |
227 | | - ignore: /.*/ |
228 | | - |
| 50 | + only: |
| 51 | + - main |
0 commit comments