Skip to content

Commit 4b0b32b

Browse files
authored
test: use codecov/codecov-action (#576)
1 parent dabfbb0 commit 4b0b32b

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
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: |
@@ -35,80 +31,85 @@ jobs:
3531
3632
- name: cache node_modules
3733
id: node_modules_cache_id
38-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3935
with:
4036
path: node_modules
4137
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
4238

4339
- name: install
4440
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
4541
run: npm ci
46-
42+
4743
lint:
4844
runs-on: ubuntu-latest
49-
needs: setup
5045
steps:
5146
- name: checkout
52-
uses: actions/checkout@master
47+
uses: actions/checkout@v4
5348

5449
- name: restore cache from package-lock.json
55-
uses: actions/cache@v2
50+
uses: actions/cache@v4
5651
with:
5752
path: package-temp-dir
5853
key: lock-${{ github.sha }}
5954

6055
- name: restore cache from node_modules
61-
uses: actions/cache@v2
56+
uses: actions/cache@v4
6257
with:
6358
path: node_modules
6459
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
6560

6661
- name: lint
6762
run: npm run lint
68-
63+
64+
needs: setup
65+
6966
compile:
7067
runs-on: ubuntu-latest
71-
needs: setup
7268
steps:
7369
- name: checkout
74-
uses: actions/checkout@master
70+
uses: actions/checkout@v4
7571

7672
- name: restore cache from package-lock.json
77-
uses: actions/cache@v2
73+
uses: actions/cache@v4
7874
with:
7975
path: package-temp-dir
8076
key: lock-${{ github.sha }}
8177

8278
- name: restore cache from node_modules
83-
uses: actions/cache@v2
79+
uses: actions/cache@v4
8480
with:
8581
path: node_modules
8682
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
8783

8884
- name: compile
8985
run: npm run compile
90-
86+
87+
needs: setup
88+
9189
coverage:
9290
runs-on: ubuntu-latest
93-
needs: setup
9491
steps:
9592
- 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
10094

10195
- name: restore cache from package-lock.json
102-
uses: actions/cache@v2
96+
uses: actions/cache@v4
10397
with:
10498
path: package-temp-dir
10599
key: lock-${{ github.sha }}
106100

107101
- name: restore cache from node_modules
108-
uses: actions/cache@v2
102+
uses: actions/cache@v4
109103
with:
110104
path: node_modules
111105
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
112106

113107
- 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

Comments
 (0)