Skip to content

Commit b5fc508

Browse files
author
Gerald Yeo
committed
chore: upgrade circleci to 2.0
1 parent 322d8f4 commit b5fc508

4 files changed

Lines changed: 182 additions & 36 deletions

File tree

.circleci/config.yml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
aliases:
2+
- &restore_test_cache
3+
keys:
4+
- test-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}
5+
6+
- &save_test_cache
7+
paths:
8+
- ./node_modules
9+
key: test-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package-lock.json" }}
10+
11+
- &restore_release_cache
12+
keys:
13+
- release-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ checksum "package-lock.json" }}
14+
15+
- &save_release_cache
16+
paths:
17+
- ./node_modules
18+
key: release-{{ .Environment.PROJECT_CACHE_VERSION }}-{{ checksum "package-lock.json" }}
19+
20+
- &install_npm
21+
name: install dependencies
22+
command: |
23+
npm install
24+
25+
- &build_package
26+
name: build package
27+
command: |
28+
npm run clean
29+
npm run build
30+
31+
- &filter_common
32+
branches:
33+
ignore: gh-pages
34+
tags:
35+
ignore: /.*/
36+
37+
- &filter_tag_all
38+
tags:
39+
only: /^v.*/
40+
branches:
41+
ignore: /.*/
42+
43+
- &filter_tag_stable
44+
tags:
45+
only: /^v[0-9]+(\.[0-9]+)*$/
46+
branches:
47+
ignore: /.*/
48+
49+
- &filter_tag_beta
50+
tags:
51+
only: /^v[0-9]+(\.[0-9]+)*\-[0-9]+$/
52+
branches:
53+
ignore: /.*/
54+
55+
- &node_tests
56+
working_directory: ~/yeojz/filter-chunk-webpack-plugin
57+
steps:
58+
- checkout
59+
- restore-cache: *restore_test_cache
60+
- run: *install_npm
61+
- save_cache: *save_test_cache
62+
- run: *build_package
63+
- run:
64+
name: test
65+
command: npm run test
66+
67+
- &defaults
68+
working_directory: ~/yeojz/filter-chunk-webpack-plugin
69+
docker:
70+
- image: circleci/node:8
71+
72+
- &npm_publish
73+
steps:
74+
- checkout
75+
- restore-cache: *restore_release_cache
76+
- run: *install_npm
77+
- run:
78+
name: install conventional-github-releaser
79+
command: npm install --no-save conventional-github-releaser
80+
- save_cache: *save_release_cache
81+
- run:
82+
name: update github release description
83+
command: npx conventional-github-releaser -p angular
84+
- run:
85+
name: build for npm
86+
command: |
87+
npm run clean
88+
npm run build
89+
- run:
90+
working_directory: ~/yeojz/filter-chunk-webpack-plugin
91+
name: publish to npm
92+
command: |
93+
echo "npm tag = $RUNTIME_NPM_TAG"
94+
95+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
96+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
97+
npm publish --tag $RUNTIME_NPM_TAG
98+
else
99+
echo "skipping publication."
100+
fi
101+
102+
version: 2
103+
jobs:
104+
node_v8:
105+
<<: *defaults
106+
steps:
107+
- checkout
108+
- restore-cache: *restore_test_cache
109+
- run: *install_npm
110+
- save_cache: *save_test_cache
111+
- run: *build_package
112+
- run:
113+
name: test
114+
command: npm run test
115+
- run:
116+
name: lint
117+
command: |
118+
npm run lint
119+
- run:
120+
name: send coverage report
121+
command: npm run codecov
122+
when: on_success
123+
124+
node_v6:
125+
docker:
126+
- image: circleci/node:6
127+
<<: *node_tests
128+
129+
node_v10:
130+
docker:
131+
- image: circleci/node:10
132+
<<: *node_tests
133+
134+
publish_npm_stable:
135+
environment:
136+
RUNTIME_NPM_TAG: latest
137+
<<: *defaults
138+
<<: *npm_publish
139+
140+
publish_npm_beta:
141+
environment:
142+
RUNTIME_NPM_TAG: next
143+
<<: *defaults
144+
<<: *npm_publish
145+
146+
workflows:
147+
version: 2
148+
dev-builds:
149+
jobs:
150+
- node_v6:
151+
filters: *filter_common
152+
- node_v8:
153+
filters: *filter_common
154+
- node_v10:
155+
filters: *filter_common
156+
release-builds:
157+
jobs:
158+
- node_v6:
159+
filters: *filter_tag_all
160+
- node_v8:
161+
filters: *filter_tag_all
162+
- node_v10:
163+
filters: *filter_tag_all
164+
- publish_npm_beta:
165+
requires:
166+
- node_v6
167+
- node_v8
168+
- node_v10
169+
filters: *filter_tag_beta
170+
- hold:
171+
type: approval
172+
requires:
173+
- node_v6
174+
- node_v8
175+
- node_v10
176+
filters: *filter_tag_stable
177+
- publish_npm_stable:
178+
requires:
179+
- hold
180+
filters: *filter_tag_stable
181+

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

circle.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "babel src/index.js --out-file index.js",
88
"clean": "rimraf index.js coverage .spec_output/it-* .nyc_output",
9-
"coverage:upload": "codecov",
9+
"codecov": "codecov",
1010
"lint": "eslint --ext js src",
1111
"test": "jest --coverage",
1212
"test:watch": "jest --coverage --watch"

0 commit comments

Comments
 (0)