Skip to content

Commit c6c7a37

Browse files
committed
ci: add circleci
config are copied from binaryen-loader 😎 and modified to use rollup
1 parent 353ebe2 commit c6c7a37

File tree

2 files changed

+210
-1
lines changed

2 files changed

+210
-1
lines changed

.circleci/config.yml

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
unit_tests: &unit_tests
2+
steps:
3+
- checkout
4+
- restore_cache:
5+
key: dependency-cache-{{ checksum "package-lock.json" }}
6+
- run:
7+
name: NPM Rebuild
8+
command: npm install --quiet
9+
- run:
10+
name: Run unit tests.
11+
command: npm run ci:test
12+
13+
canary_tests: &canary_tests
14+
steps:
15+
- checkout
16+
- restore_cache:
17+
key: dependency-cache-{{ checksum "package-lock.json" }}
18+
- run:
19+
name: NPM Rebuild
20+
command: npm install --quiet
21+
- run:
22+
name: Install Rollup Canary
23+
command: npm i --no-save rollup@next --verbose
24+
- run:
25+
name: Run unit tests.
26+
command: if [[ $(compver --name rollup --gte next --lt latest) < 1 ]] ; then printf "Next is older than Latest - Skipping Canary Suite"; else npm run ci:test ; fi
27+
28+
version: 2
29+
jobs:
30+
#region PREPARATION
31+
dependency_cache:
32+
docker:
33+
- image: circleci/node:latest
34+
steps:
35+
- checkout
36+
- restore_cache:
37+
key: dependency-cache-{{ checksum "package-lock.json" }}
38+
- run:
39+
name: Install Dependencies
40+
command: npm install --quiet
41+
- save_cache:
42+
key: dependency-cache-{{ checksum "package-lock.json" }}
43+
paths:
44+
- ./node_modules
45+
analysis:
46+
docker:
47+
- image: circleci/node:latest
48+
steps:
49+
- checkout
50+
- restore_cache:
51+
key: dependency-cache-{{ checksum "package-lock.json" }}
52+
- run:
53+
name: NPM Rebuild
54+
command: npm install --quiet
55+
- run:
56+
name: Run linting.
57+
command: npm run lint
58+
- run:
59+
name: Run NSP Security Check.
60+
command: npm audit --quiet
61+
- run:
62+
name: Validate Commit Messages
63+
command: npm run ci:lint:commits
64+
#endregion
65+
66+
#region CROSS-BUILD
67+
node8-latest:
68+
docker:
69+
- image: circleci/node:8
70+
steps:
71+
- checkout
72+
- restore_cache:
73+
key: dependency-cache-{{ checksum "package-lock.json" }}
74+
- run:
75+
name: NPM Rebuild
76+
command: npm install --quiet
77+
- run:
78+
name: Run unit tests.
79+
command: npm run ci:coverage
80+
- run:
81+
name: Submit coverage data to codecov.
82+
command: bash <(curl -s https://codecov.io/bash)
83+
when: on_success
84+
node6-latest:
85+
docker:
86+
- image: circleci/node:6
87+
<<: *unit_tests
88+
node10-latest:
89+
docker:
90+
- image: circleci/node:10
91+
<<: *unit_tests
92+
node8-canary:
93+
docker:
94+
- image: circleci/node:8
95+
<<: *canary_tests
96+
#endregion
97+
98+
#region RELEASE VERSION
99+
draft:
100+
docker:
101+
- image: circleci/node:latest
102+
steps:
103+
- checkout
104+
- restore_cache:
105+
key: dependency-cache-{{ checksum "package-lock.json" }}
106+
- run:
107+
name: NPM Rebuild
108+
command: npm install --quiet
109+
- run:
110+
name: Validate Commit Messages
111+
command: npm run release:validate
112+
- run:
113+
name: Draft Releases to Github
114+
command: npm run ci:release
115+
publish:
116+
docker:
117+
- image: circleci/node:latest
118+
steps:
119+
- checkout
120+
- run:
121+
name: set npm TOKEN
122+
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
123+
- restore_cache:
124+
key: dependency-cache-{{ checksum "package-lock.json" }}
125+
- run:
126+
name: NPM Rebuild
127+
command: npm install --quiet
128+
- run:
129+
name: Publish to NPM
130+
command: npm publish --verbose
131+
#endregion
132+
133+
version: 2.0
134+
workflows:
135+
version: 2
136+
build and publish on tagging:
137+
jobs:
138+
#region PREPARATION
139+
- dependency_cache:
140+
filters:
141+
tags:
142+
only: /.*/
143+
- analysis:
144+
requires:
145+
- dependency_cache
146+
filters:
147+
tags:
148+
only: /.*/
149+
#endregion
150+
151+
#region CROSS-BUILD
152+
- node6-latest:
153+
requires:
154+
- dependency_cache
155+
filters:
156+
tags:
157+
only: /.*/
158+
- node8-latest:
159+
requires:
160+
- analysis
161+
- node6-latest
162+
filters:
163+
tags:
164+
only: /.*/
165+
- node10-latest:
166+
requires:
167+
- analysis
168+
- node6-latest
169+
filters:
170+
tags:
171+
only: /.*/
172+
# rollup@next NOT YET PLANNED
173+
# - node8-canary:
174+
# requires:
175+
# - analysis
176+
# - node6-latest
177+
# filters:
178+
# tags:
179+
# only: /.*/
180+
# branches:
181+
# only:
182+
# - master
183+
# - /rc.*/
184+
#endregion
185+
186+
#region RELEASE VERSION
187+
- draft:
188+
requires:
189+
- node8-latest
190+
# - node8-canary
191+
- node10-latest
192+
filters:
193+
tags:
194+
only: /^v\d+[.]\d+[.]\d+$/
195+
branches:
196+
ignore: /.*/
197+
- check github Releases!:
198+
type: approval
199+
requires:
200+
- draft
201+
filters:
202+
tags:
203+
only: /^v\d+[.]\d+[.]\d+$/
204+
- publish:
205+
requires:
206+
- check github Releases!
207+
filters:
208+
tags:
209+
only: /^v\d+[.]\d+[.]\d+$/
210+
#endregion

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
if-present=true
21
loglevel=silent

0 commit comments

Comments
 (0)