Skip to content

Commit 4d829bf

Browse files
authored
test: use codecov/codecov-action (#16)
1 parent 5b6542e commit 4d829bf

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

.github/workflows/main.yml

+27-26
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: '16'
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,29 +31,29 @@ 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'
45-
run: npm i
46-
41+
run: npm ci
42+
4743
lint:
4844
runs-on: ubuntu-latest
4945
steps:
5046
- name: checkout
51-
uses: actions/checkout@master
47+
uses: actions/checkout@v4
5248

5349
- name: restore cache from package-lock.json
54-
uses: actions/cache@v2
50+
uses: actions/cache@v4
5551
with:
5652
path: package-temp-dir
5753
key: lock-${{ github.sha }}
5854

5955
- name: restore cache from node_modules
60-
uses: actions/cache@v2
56+
uses: actions/cache@v4
6157
with:
6258
path: node_modules
6359
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -66,21 +62,21 @@ jobs:
6662
run: npm run lint
6763

6864
needs: setup
69-
65+
7066
compile:
7167
runs-on: ubuntu-latest
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') }}
@@ -89,26 +85,31 @@ jobs:
8985
run: npm run compile
9086

9187
needs: setup
92-
88+
9389
coverage:
9490
runs-on: ubuntu-latest
9591
steps:
9692
- name: checkout
97-
uses: actions/checkout@master
93+
uses: actions/checkout@v4
9894

9995
- name: restore cache from package-lock.json
100-
uses: actions/cache@v2
96+
uses: actions/cache@v4
10197
with:
10298
path: package-temp-dir
10399
key: lock-${{ github.sha }}
104100

105101
- name: restore cache from node_modules
106-
uses: actions/cache@v2
102+
uses: actions/cache@v4
107103
with:
108104
path: node_modules
109105
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
110106

111107
- name: coverage
112-
run: npm run coverage && bash <(curl -s https://codecov.io/bash)
108+
run: npm test -- --coverage
113109

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

Comments
 (0)