Skip to content

Commit 989b3b9

Browse files
authored
test: use codecov/codecov-action (#524)
1 parent a995777 commit 989b3b9

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
name: CI
22

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

85
jobs:
96
setup:
107
runs-on: ubuntu-latest
118
steps:
129
- name: checkout
13-
uses: actions/checkout@master
10+
uses: actions/checkout@v4
1411

15-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v4
1613
with:
17-
node-version: '16'
14+
node-version: '20'
1815

1916
- name: cache package-lock.json
20-
uses: actions/cache@v2
17+
uses: actions/cache@v4
2118
with:
2219
path: package-temp-dir
2320
key: lock-${{ github.sha }}
2421

2522
- name: create package-lock.json
26-
run: npm i --package-lock-only
23+
run: npm i --package-lock-only --ignore-scripts
2724

2825
- name: hack for singe file
2926
run: |
3027
if [ ! -d "package-temp-dir" ]; then
3128
mkdir package-temp-dir
3229
fi
3330
cp package-lock.json package-temp-dir
31+
3432
- name: cache node_modules
3533
id: node_modules_cache_id
36-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3735
with:
3836
path: node_modules
3937
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -46,16 +44,16 @@ jobs:
4644
runs-on: ubuntu-latest
4745
steps:
4846
- name: checkout
49-
uses: actions/checkout@master
47+
uses: actions/checkout@v4
5048

5149
- name: restore cache from package-lock.json
52-
uses: actions/cache@v2
50+
uses: actions/cache@v4
5351
with:
5452
path: package-temp-dir
5553
key: lock-${{ github.sha }}
5654

5755
- name: restore cache from node_modules
58-
uses: actions/cache@v2
56+
uses: actions/cache@v4
5957
with:
6058
path: node_modules
6159
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -69,16 +67,16 @@ jobs:
6967
runs-on: ubuntu-latest
7068
steps:
7169
- name: checkout
72-
uses: actions/checkout@master
70+
uses: actions/checkout@v4
7371

7472
- name: restore cache from package-lock.json
75-
uses: actions/cache@v2
73+
uses: actions/cache@v4
7674
with:
7775
path: package-temp-dir
7876
key: lock-${{ github.sha }}
7977

8078
- name: restore cache from node_modules
81-
uses: actions/cache@v2
79+
uses: actions/cache@v4
8280
with:
8381
path: node_modules
8482
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@@ -92,22 +90,26 @@ jobs:
9290
runs-on: ubuntu-latest
9391
steps:
9492
- name: checkout
95-
uses: actions/checkout@master
93+
uses: actions/checkout@v4
9694

9795
- name: restore cache from package-lock.json
98-
uses: actions/cache@v2
96+
uses: actions/cache@v4
9997
with:
10098
path: package-temp-dir
10199
key: lock-${{ github.sha }}
102100

103101
- name: restore cache from node_modules
104-
uses: actions/cache@v2
102+
uses: actions/cache@v4
105103
with:
106104
path: node_modules
107105
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
108-
- name: tsc
109-
run: npm run lint:tsc
106+
110107
- name: coverage
111-
run: npm test -- --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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@types/react-dom": "^18.0.11",
6161
"@types/warning": "^3.0.0",
6262
"@umijs/fabric": "^4.0.0",
63+
"cheerio": "1.0.0-rc.12",
6364
"cross-env": "^7.0.0",
6465
"dumi": "^2.1.10",
6566
"enzyme": "^3.3.0",

0 commit comments

Comments
 (0)