File tree Expand file tree Collapse file tree 1 file changed +96
-0
lines changed Expand file tree Collapse file tree 1 file changed +96
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Node.js CI/CD
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+
8
+ jobs :
9
+ test :
10
+ name : Test
11
+ runs-on : ubuntu-latest
12
+ strategy :
13
+ matrix :
14
+ node-version : [12, 10]
15
+
16
+ steps :
17
+ - name : Checkout code
18
+ uses : actions/checkout@v2
19
+
20
+ - name : Set up Node.js
21
+ uses : actions/setup-node@v2
22
+ with :
23
+ node-version : ${{ matrix.node-version }}
24
+
25
+ - name : Cache npm
26
+ uses : actions/cache@v2
27
+ with :
28
+ path : ~/.npm
29
+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
30
+ restore-keys : |
31
+ ${{ runner.os }}-node-
32
+
33
+ - name : Install dependencies
34
+ run : npm ci
35
+
36
+ - name : ESLint
37
+ run : npx eslint .
38
+
39
+ - name : Commitlint
40
+ run : |
41
+ npm i -g @commitlint/travis-cli
42
+ commitlint-travis
43
+
44
+ coverage :
45
+ name : Code Coverage
46
+ runs-on : ubuntu-latest
47
+
48
+ steps :
49
+ - name : Checkout code
50
+ uses : actions/checkout@v2
51
+
52
+ - name : Set up Node.js
53
+ uses : actions/setup-node@v2
54
+ with :
55
+ node-version : 12
56
+
57
+ - name : Cache npm
58
+ uses : actions/cache@v2
59
+ with :
60
+ path : ~/.npm
61
+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
62
+ restore-keys : |
63
+ ${{ runner.os }}-node-
64
+
65
+ - name : Install dependencies
66
+ run : npm ci
67
+
68
+ - name : Check Code Coverage
69
+ run : |
70
+ npm install -g coveralls
71
+ npx nyc check-coverage --lines 85 --per-file
72
+
73
+ - name : Generate Coverage Report
74
+ run : |
75
+ npx nyc report > lcov.info
76
+ coveralls < lcov.info
77
+
78
+ deploy :
79
+ name : Deploy to Master
80
+ runs-on : ubuntu-latest
81
+ if : github.ref == 'refs/heads/master'
82
+
83
+ steps :
84
+ - name : Checkout code
85
+ uses : actions/checkout@v2
86
+
87
+ - name : Set up Node.js
88
+ uses : actions/setup-node@v2
89
+ with :
90
+ node-version : 12
91
+
92
+ - name : Install dependencies
93
+ run : npm ci
94
+
95
+ - name : Semantic Release
96
+ run : npx semantic-release
You can’t perform that action at this time.
0 commit comments