Skip to content

Commit aa53445

Browse files
Layouwenafc163
andauthored
test: use codecov/codecov-action (#347)
Co-authored-by: afc163 <[email protected]>
1 parent 53acac6 commit aa53445

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

.dumirc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default defineConfig({
1616
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
1717
},
1818
outputPath: '.doc',
19-
exportStatic: {},
2019
base: basePath,
2120
publicPath,
2221
});
Lines changed: 31 additions & 28 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 --legacy-peer-deps
2824

2925
- name: hack for singe file
3026
run: |
@@ -35,78 +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'
45-
run: npm ci
46-
41+
run: npm ci --legacy-peer-deps
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
6863

69-
64+
needs: setup
65+
7066
compile:
7167
runs-on: ubuntu-latest
72-
needs: setup
7368
steps:
7469
- name: checkout
75-
uses: actions/checkout@master
70+
uses: actions/checkout@v4
7671

7772
- name: restore cache from package-lock.json
78-
uses: actions/cache@v2
73+
uses: actions/cache@v4
7974
with:
8075
path: package-temp-dir
8176
key: lock-${{ github.sha }}
8277

8378
- name: restore cache from node_modules
84-
uses: actions/cache@v2
79+
uses: actions/cache@v4
8580
with:
8681
path: node_modules
8782
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
8883

8984
- name: compile
9085
run: npm run compile
91-
86+
87+
needs: setup
88+
9289
coverage:
9390
runs-on: ubuntu-latest
94-
needs: setup
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
109+
110+
- name: Upload coverage to Codecov
111+
uses: codecov/codecov-action@v4
112+
with:
113+
token: ${{ secrets.CODECOV_TOKEN }}
114+
115+
needs: setup

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@
5555
"@types/jest": "^29.4.0",
5656
"@types/react": "^18.0.0",
5757
"@types/react-dom": "^18.0.0",
58-
"@umijs/fabric": "^3.0.0",
58+
"@umijs/fabric": "^4.0.0",
5959
"dumi": "^2.1.1",
6060
"eslint": "^8.55.0",
6161
"eslint-plugin-jest": "^27.6.0",
6262
"eslint-plugin-unicorn": "^49.0.0",
6363
"father": "^4.1.3",
64-
"husky": "^8.0.3",
64+
"husky": "^9.0.0",
6565
"jest": "^29.1.2",
6666
"less": "^4.2.0",
6767
"lint-staged": "^15.0.2",

0 commit comments

Comments
 (0)