Skip to content

Commit 5feff24

Browse files
authored
test: use codecov/codecov-action (#358)
1 parent 24db023 commit 5feff24

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

.github/workflows/main.yml

+23-21
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
11
name: CI
22

3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
3+
on: ['push', 'pull_request']
84

95
jobs:
106
setup:
117
runs-on: ubuntu-latest
128
steps:
139
- name: checkout
14-
uses: actions/checkout@master
10+
uses: actions/checkout@v4
1511

16-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v4
1713
with:
18-
node-version: '12'
14+
node-version: '20'
1915

2016
- name: cache package-lock.json
21-
uses: actions/cache@v2
17+
uses: actions/cache@v4
2218
with:
2319
path: package-temp-dir
2420
key: lock-${{ github.sha }}
2521

2622
- name: create package-lock.json
27-
run: npm i --package-lock-only
23+
run: npm i --package-lock-only --ignore-scripts
2824

2925
- name: hack for singe file
3026
run: |
3127
if [ ! -d "package-temp-dir" ]; then
3228
mkdir package-temp-dir
3329
fi
3430
cp package-lock.json package-temp-dir
31+
3532
- name: cache node_modules
3633
id: node_modules_cache_id
37-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3835
with:
3936
path: node_modules
4037
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -47,16 +44,16 @@ jobs:
4744
runs-on: ubuntu-latest
4845
steps:
4946
- name: checkout
50-
uses: actions/checkout@master
47+
uses: actions/checkout@v4
5148

5249
- name: restore cache from package-lock.json
53-
uses: actions/cache@v2
50+
uses: actions/cache@v4
5451
with:
5552
path: package-temp-dir
5653
key: lock-${{ github.sha }}
5754

5855
- name: restore cache from node_modules
59-
uses: actions/cache@v2
56+
uses: actions/cache@v4
6057
with:
6158
path: node_modules
6259
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -70,16 +67,16 @@ jobs:
7067
runs-on: ubuntu-latest
7168
steps:
7269
- name: checkout
73-
uses: actions/checkout@master
70+
uses: actions/checkout@v4
7471

7572
- name: restore cache from package-lock.json
76-
uses: actions/cache@v2
73+
uses: actions/cache@v4
7774
with:
7875
path: package-temp-dir
7976
key: lock-${{ github.sha }}
8077

8178
- name: restore cache from node_modules
82-
uses: actions/cache@v2
79+
uses: actions/cache@v4
8380
with:
8481
path: node_modules
8582
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -93,21 +90,26 @@ jobs:
9390
runs-on: ubuntu-latest
9491
steps:
9592
- name: checkout
96-
uses: actions/checkout@master
93+
uses: actions/checkout@v4
9794

9895
- name: restore cache from package-lock.json
99-
uses: actions/cache@v2
96+
uses: actions/cache@v4
10097
with:
10198
path: package-temp-dir
10299
key: lock-${{ github.sha }}
103100

104101
- name: restore cache from node_modules
105-
uses: actions/cache@v2
102+
uses: actions/cache@v4
106103
with:
107104
path: node_modules
108105
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
109106

110107
- name: coverage
111-
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 }}
112114

113115
needs: setup

0 commit comments

Comments
 (0)