Skip to content

Commit 75e11f3

Browse files
authored
Merge pull request #420 from twilio/kamolins/FLEXY-3226
Added Circle CI PR validator job
2 parents 635c2db + b4cf679 commit 75e11f3

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.circleci/config.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: 2.1
2+
3+
executors:
4+
node:
5+
parameters:
6+
tag:
7+
type: string
8+
docker:
9+
- image: cimg/node:<< parameters.tag >>
10+
11+
commands:
12+
install-dependencies:
13+
steps:
14+
- run:
15+
name: "Install project dependencies"
16+
command: npm i
17+
install-prerequisites:
18+
steps:
19+
- run:
20+
name: "APT update"
21+
command: sudo apt-get update
22+
- run:
23+
name: "Fetch and install libsecret"
24+
command: sudo apt-get install -y libsecret-1-dev
25+
run-unit-tests:
26+
steps:
27+
- run:
28+
name: "Run unit tests"
29+
command: npm run test:ci
30+
run-linter:
31+
steps:
32+
- run:
33+
name: "Run linter"
34+
command: npm run lint
35+
36+
jobs:
37+
pr-validator:
38+
resource_class: xlarge
39+
environment:
40+
NODE_OPTIONS: --max-old-space-size=14336
41+
CI: ""
42+
parameters:
43+
node-version:
44+
type: string
45+
executor:
46+
name: node
47+
tag: << parameters.node-version >>
48+
steps:
49+
- checkout
50+
- apt-update
51+
- install-prerequisites
52+
- install-dependencies
53+
- run-linter
54+
- run-unit-tests
55+
- when:
56+
condition:
57+
equal: [<< parameters.node-version >>, lts]
58+
steps:
59+
- run:
60+
name: "CODECOV"
61+
command: npm run coverage -- --token=$CODECOV_TOKEN
62+
63+
workflows:
64+
validate:
65+
jobs:
66+
- pr-validator:
67+
matrix:
68+
parameters:
69+
node-version: ["10.24", "12.21", "14.16", lts]
70+
filters:
71+
branches:
72+
only: /^(main|v[1-9]?[0-9]-beta)$/
73+
post-steps:
74+
- run:
75+
name: Send Slack notification
76+
command: |
77+
curl -X POST -H "Content-type:application/json" --data "{'text':':error: $CIRCLE_PROJECT_REPONAME/$CIRCLE_BRANCH - $CIRCLE_PULL_REQUEST validation failed on *Node:${CIRCLE_JOB/pr-validator-/''}*. View <$CIRCLE_BUILD_URL|build>. cc: <@$CIRCLE_USERNAME>', 'mrkdwn':true}" $SLACK_WEBHOOK
78+
when: on_fail

0 commit comments

Comments
 (0)