Skip to content

Commit d156bbc

Browse files
author
Glen Mailer
committedJan 31, 2021
Simplify CI setup
1 parent 0635d00 commit d156bbc

File tree

2 files changed

+38
-151
lines changed

2 files changed

+38
-151
lines changed
 

‎.circleci/config.yml

+37-147
Original file line numberDiff line numberDiff line change
@@ -1,159 +1,49 @@
1-
version: 2
1+
version: 2.1
22

3-
unit_tests: &unit_tests
4-
steps:
5-
- checkout
6-
- restore_cache:
7-
key: dependency-cache-{{ checksum "package-lock.json" }}
8-
- run:
9-
name: NPM Rebuild
10-
command: npm install
11-
- run:
12-
name: Run unit tests.
13-
command: npm run ci:test
14-
canary_tests: &canary_tests
15-
steps:
16-
- checkout
17-
- restore_cache:
18-
key: dependency-cache-{{ checksum "package-lock.json" }}
19-
- run:
20-
name: NPM Rebuild
21-
command: npm install
22-
- run:
23-
name: Install Webpack Canary
24-
command: npm i --no-save webpack@next
25-
- run:
26-
name: Run unit tests.
27-
command: if [[ $(compver --name webpack --gte next --lt latest) < 1 ]] ; then printf "Next is older than Latest - Skipping Canary Suite"; else npm run ci:test ; fi
3+
workflows:
4+
workflow:
5+
jobs:
6+
- lint:
7+
filters:
8+
tags:
9+
only: /.*/
10+
- test:
11+
matrix:
12+
parameters:
13+
node_version: [lts, current]
14+
filters:
15+
tags:
16+
only: /.*/
2817

29-
jobs:
30-
dependency_cache:
31-
docker:
32-
- image: webpackcontrib/circleci-node-base:latest
33-
steps:
34-
- checkout
35-
- restore_cache:
36-
key: dependency-cache-{{ checksum "package-lock.json" }}
37-
- run:
38-
name: Install Dependencies
39-
command: npm install
40-
- save_cache:
41-
key: dependency-cache-{{ checksum "package-lock.json" }}
42-
paths:
43-
- ./node_modules
4418

45-
node8-latest:
46-
docker:
47-
- image: webpackcontrib/circleci-node8:latest
19+
commands:
20+
setup:
4821
steps:
4922
- checkout
5023
- restore_cache:
51-
key: dependency-cache-{{ checksum "package-lock.json" }}
52-
- run:
53-
name: NPM Rebuild
54-
command: npm install
55-
- run:
56-
name: Run unit tests.
57-
command: npm run ci:coverage
58-
- run:
59-
name: Submit coverage data to codecov.
60-
command: bash <(curl -s https://codecov.io/bash)
61-
when: on_success
62-
node6-latest:
63-
docker:
64-
- image: webpackcontrib/circleci-node6:latest
65-
<<: *unit_tests
66-
node9-latest:
67-
docker:
68-
- image: webpackcontrib/circleci-node9:latest
69-
<<: *unit_tests
70-
node8-canary:
71-
docker:
72-
- image: webpackcontrib/circleci-node8:latest
73-
<<: *canary_tests
74-
analysis:
24+
keys:
25+
- npm-cache-{{ checksum "package-lock.json" }}
26+
- npm-cache-
27+
- run: npm ci
28+
29+
jobs:
30+
lint:
31+
working_directory: /mnt/ramdisk
7532
docker:
76-
- image: webpackcontrib/circleci-node-base:latest
33+
- image: cimg/node:lts
7734
steps:
78-
- checkout
79-
- restore_cache:
80-
key: dependency-cache-{{ checksum "package-lock.json" }}
81-
- run:
82-
name: Install Latest NPM.
83-
command: npm i -g npm@latest
35+
- setup
8436
- run:
85-
name: NPM Rebuild
86-
command: npm install
87-
- run:
88-
name: Run linting.
8937
command: npm run lint
90-
- run:
91-
name: Run NSP Security Check.
92-
command: npm run security
93-
# - run:
94-
# name: Validate Commit Messages
95-
# command: npm run ci:lint:commits
96-
publish:
38+
when: always
39+
40+
test:
41+
parameters:
42+
node_version:
43+
type: string
9744
docker:
98-
- image: webpackcontrib/circleci-node-base:latest
45+
- image: cimg/node:<< parameters.node_version >>
46+
working_directory: /mnt/ramdisk
9947
steps:
100-
- checkout
101-
- restore_cache:
102-
key: dependency-cache-{{ checksum "package-lock.json" }}
103-
- run:
104-
name: NPM Rebuild
105-
command: npm install
106-
# - run:
107-
# name: Validate Commit Messages
108-
# command: npm run release:validate
109-
- run:
110-
name: Publish to NPM
111-
command: printf "noop running conventional-github-releaser"
112-
113-
workflows:
114-
version: 2
115-
validate-publish:
116-
jobs:
117-
- dependency_cache
118-
- node6-latest:
119-
requires:
120-
- dependency_cache
121-
filters:
122-
tags:
123-
only: /.*/
124-
- analysis:
125-
requires:
126-
- dependency_cache
127-
filters:
128-
tags:
129-
only: /.*/
130-
- node8-latest:
131-
requires:
132-
- analysis
133-
- node6-latest
134-
filters:
135-
tags:
136-
only: /.*/
137-
- node9-latest:
138-
requires:
139-
- analysis
140-
- node6-latest
141-
filters:
142-
tags:
143-
only: /.*/
144-
- node8-canary:
145-
requires:
146-
- analysis
147-
- node6-latest
148-
filters:
149-
tags:
150-
only: /.*/
151-
- publish:
152-
requires:
153-
- node8-latest
154-
- node8-canary
155-
- node9-latest
156-
filters:
157-
branches:
158-
only:
159-
- master
48+
- setup
49+
- run: npm test

‎package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
"main": "middleware.js",
1616
"scripts": {
1717
"test": "mocha",
18-
"security": "npm audit",
19-
"ci:lint": "npm run lint && npm run security",
20-
"ci:test": "npm run test",
21-
"ci:coverage": "nyc npm run test",
18+
"coverage": "nyc npm run test",
2219
"lint": "eslint . --max-warnings 0",
2320
"prettier": "prettier --write ."
2421
},

0 commit comments

Comments
 (0)
Please sign in to comment.