Skip to content

Commit 4a820db

Browse files
author
deleonn
committed
Add CircleCI
1 parent 4a8eb64 commit 4a820db

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.circleci/config.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
version: 2.1
2+
3+
jobs:
4+
run-tests:
5+
parameters:
6+
node-version:
7+
type: string
8+
docker:
9+
- image: cimg/node:<< parameters.node-version >> # Primary execution image
10+
auth:
11+
username: $DOCKERHUB_USERNAME
12+
password: $DOCKERHUB_PASSWORD
13+
- image: mongo:4.2
14+
auth:
15+
username: $DOCKERHUB_USERNAME
16+
password: $DOCKERHUB_PASSWORD
17+
steps:
18+
- checkout
19+
- run:
20+
name: NPM install
21+
command: npm ci
22+
- run:
23+
name: Run linting
24+
command: npm run lint
25+
- run:
26+
name: Run tests with coverage
27+
command: npm run coverage
28+
- store_artifacts:
29+
path: coverage
30+
publish-npm:
31+
docker:
32+
- image: cimg/node:16.15.0 # Primary execution image
33+
auth:
34+
username: $DOCKERHUB_USERNAME
35+
password: $DOCKERHUB_PASSWORD
36+
steps:
37+
- checkout
38+
- run:
39+
name: NPM install
40+
command: npm ci
41+
- run:
42+
name: Authenticate with NPM
43+
command: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
44+
- run:
45+
name: Publish package
46+
command: |
47+
# Publish as beta for pre-release tags like v1.2.3-pre.1
48+
[[ $CIRCLE_TAG =~ ^v.*- ]] && NPM_TAG=--tag=beta
49+
npm publish $NPM_TAG
50+
51+
workflows:
52+
version: 2
53+
test-and-publish:
54+
jobs:
55+
- run-tests:
56+
context:
57+
- particle-ci-private
58+
matrix:
59+
parameters:
60+
node-version: ["12.22.12", "14.19.2", "16.15.0"]
61+
# run tests for all branches and tags
62+
filters:
63+
tags:
64+
only: /^v.*/
65+
branches:
66+
only: /.*/
67+
- publish-npm:
68+
requires:
69+
- run-tests
70+
context:
71+
- particle-ci-private
72+
# publish for tags only
73+
filters:
74+
tags:
75+
only: /^v.*/
76+
branches:
77+
ignore: /.*/

0 commit comments

Comments
 (0)