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 : ' 12 '
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,80 +31,85 @@ 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
41
run : npm ci
46
-
42
+
47
43
lint :
48
44
runs-on : ubuntu-latest
49
- needs : setup
50
45
steps :
51
46
- name : checkout
52
- uses : actions/checkout@master
47
+ uses : actions/checkout@v4
53
48
54
49
- name : restore cache from package-lock.json
55
- uses : actions/cache@v2
50
+ uses : actions/cache@v4
56
51
with :
57
52
path : package-temp-dir
58
53
key : lock-${{ github.sha }}
59
54
60
55
- name : restore cache from node_modules
61
- uses : actions/cache@v2
56
+ uses : actions/cache@v4
62
57
with :
63
58
path : node_modules
64
59
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
65
60
66
61
- name : lint
67
62
run : npm run lint
68
-
63
+
64
+ needs : setup
65
+
69
66
compile :
70
67
runs-on : ubuntu-latest
71
- needs : setup
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') }}
87
83
88
84
- name : compile
89
85
run : npm run compile
90
-
86
+
87
+ needs : setup
88
+
91
89
coverage :
92
90
runs-on : ubuntu-latest
93
- needs : setup
94
91
steps :
95
92
- name : checkout
96
- uses : actions/checkout@master
97
- with :
98
- # https://github.com/codecov/codecov-action/issues/190
99
- fetch-depth : 2
93
+ uses : actions/checkout@v4
100
94
101
95
- name : restore cache from package-lock.json
102
- uses : actions/cache@v2
96
+ uses : actions/cache@v4
103
97
with :
104
98
path : package-temp-dir
105
99
key : lock-${{ github.sha }}
106
100
107
101
- name : restore cache from node_modules
108
- uses : actions/cache@v2
102
+ uses : actions/cache@v4
109
103
with :
110
104
path : node_modules
111
105
key : node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
112
106
113
107
- name : coverage
114
- run : npm run coverage && bash <(curl -s https://codecov.io/bash)
108
+ run : npm test -- --coverage
109
+
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