Skip to content

Commit 3e7d803

Browse files
authored
👷 CI 优化 (#1007)
* test:ci * coverage:ci * lint:ci
1 parent 13be280 commit 3e7d803

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/test.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,27 @@ jobs:
2323
node-version: 22
2424
cache: 'pnpm'
2525

26+
- name: Setup pnpm
27+
run: corepack enable
28+
2629
- name: Install dependencies
2730
run: pnpm i --frozen-lockfile
2831

32+
- name: Cache ESLint cache
33+
uses: actions/cache@v4
34+
with:
35+
path: .eslintcache
36+
key: eslint-${{ hashFiles('pnpm-lock.yaml', '.eslintrc*') }}
37+
restore-keys: |
38+
eslint-
39+
2940
- name: Lint
30-
run: pnpm run lint
41+
run: pnpm lint:ci
3142

3243
- name: Unit Test
3344
run: |
34-
pnpm test
35-
pnpm run coverage
45+
pnpm test:ci
46+
pnpm coverage:ci
3647
3748
- name: Upload coverage reports to Codecov with GitHub Action
3849
uses: codecov/codecov-action@v5

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
"scripts": {
99
"preinstall": "pnpm dlx only-allow pnpm",
1010
"test": "vitest --test-timeout=500 --no-coverage --isolate=false --reporter=verbose",
11+
"test:ci": "vitest run --test-timeout=500 --no-coverage --isolate=false --reporter=default --reporter.summary=false",
1112
"coverage": "vitest run --coverage",
13+
"coverage:ci": "vitest run --coverage --silent --reporter=default --reporter.default.summary=false",
1214
"build": "cross-env NODE_ENV=production rspack build",
1315
"dev": "cross-env NODE_ENV=development rspack",
1416
"dev:noMap": "cross-env NODE_ENV=development NO_MAP=true rspack",
1517
"pack": "node ./scripts/pack.js",
1618
"format": "prettier --write .",
1719
"lint": "eslint .",
20+
"lint:ci": "eslint . --cache --cache-location .eslintcache",
1821
"lint-fix": "eslint --fix .",
1922
"changlog": "node ./scripts/changlog.js",
2023
"crowdin": "crowdin",

0 commit comments

Comments
 (0)