1
1
name : CI
2
2
3
- on :
4
- push :
5
- branches : [ master ]
6
- pull_request :
7
- branches : [ master ]
3
+ on : ['push', 'pull_request']
8
4
9
5
jobs :
10
6
setup :
11
7
runs-on : ubuntu-latest
12
8
steps :
13
9
- name : checkout
14
- uses : actions/checkout@master
10
+ uses : actions/checkout@v4
15
11
16
- - uses : actions/setup-node@v1
12
+ - uses : actions/setup-node@v4
17
13
with :
18
- node-version : ' 16 '
14
+ node-version : ' 20 '
19
15
20
16
- name : cache package-lock.json
21
- uses : actions/cache@v2
17
+ uses : actions/cache@v4
22
18
with :
23
19
path : package-temp-dir
24
20
key : lock-${{ github.sha }}
25
21
26
22
- name : create package-lock.json
27
- run : npm i --package-lock-only
23
+ run : npm i --package-lock-only --ignore-scripts
28
24
29
25
- name : hack for singe file
30
26
run : |
@@ -35,29 +31,29 @@ jobs:
35
31
36
32
- name : cache node_modules
37
33
id : node_modules_cache_id
38
- uses : actions/cache@v2
34
+ uses : actions/cache@v4
39
35
with :
40
36
path : node_modules
41
37
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
42
38
43
39
- name : install
44
40
if : steps.node_modules_cache_id.outputs.cache-hit != 'true'
45
- run : npm i
46
-
41
+ run : npm ci
42
+
47
43
lint :
48
44
runs-on : ubuntu-latest
49
45
steps :
50
46
- name : checkout
51
- uses : actions/checkout@master
47
+ uses : actions/checkout@v4
52
48
53
49
- name : restore cache from package-lock.json
54
- uses : actions/cache@v2
50
+ uses : actions/cache@v4
55
51
with :
56
52
path : package-temp-dir
57
53
key : lock-${{ github.sha }}
58
54
59
55
- name : restore cache from node_modules
60
- uses : actions/cache@v2
56
+ uses : actions/cache@v4
61
57
with :
62
58
path : node_modules
63
59
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -66,21 +62,21 @@ jobs:
66
62
run : npm run lint
67
63
68
64
needs : setup
69
-
65
+
70
66
compile :
71
67
runs-on : ubuntu-latest
72
68
steps :
73
69
- name : checkout
74
- uses : actions/checkout@master
70
+ uses : actions/checkout@v4
75
71
76
72
- name : restore cache from package-lock.json
77
- uses : actions/cache@v2
73
+ uses : actions/cache@v4
78
74
with :
79
75
path : package-temp-dir
80
76
key : lock-${{ github.sha }}
81
77
82
78
- name : restore cache from node_modules
83
- uses : actions/cache@v2
79
+ uses : actions/cache@v4
84
80
with :
85
81
path : node_modules
86
82
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -89,26 +85,31 @@ jobs:
89
85
run : npm run compile
90
86
91
87
needs : setup
92
-
88
+
93
89
coverage :
94
90
runs-on : ubuntu-latest
95
91
steps :
96
92
- name : checkout
97
- uses : actions/checkout@master
93
+ uses : actions/checkout@v4
98
94
99
95
- name : restore cache from package-lock.json
100
- uses : actions/cache@v2
96
+ uses : actions/cache@v4
101
97
with :
102
98
path : package-temp-dir
103
99
key : lock-${{ github.sha }}
104
100
105
101
- name : restore cache from node_modules
106
- uses : actions/cache@v2
102
+ uses : actions/cache@v4
107
103
with :
108
104
path : node_modules
109
105
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
110
106
111
107
- name : coverage
112
- run : npm run coverage && bash <(curl -s https://codecov.io/bash)
108
+ run : npm test -- --coverage
113
109
114
- needs : setup
110
+ - name : Upload coverage to Codecov
111
+ uses : codecov/codecov-action@v4
112
+ with :
113
+ token : ${{ secrets.CODECOV_TOKEN }}
114
+
115
+ needs : setup
0 commit comments