ci(perf): 添加 Lighthouse CI 性能预算回归门槛配置
Phase 2 性能预算重构配套 CI:每次 PR 与每日凌晨 3 点对 /login 路由采样 3 次(desktop preset),断言 LCP <= 3000ms、CLS <= 0.1(error 级),FCP/TBT/INP 为 warn 级。失败时阻断合并并触发性能预算审计报告基线复核。
This commit is contained in:
35
lighthouserc.json
Normal file
35
lighthouserc.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"ci": {
|
||||
"collect": {
|
||||
"url": [
|
||||
"http://localhost:3000/login"
|
||||
],
|
||||
"numberOfRuns": 3,
|
||||
"settings": {
|
||||
"preset": "desktop",
|
||||
"throttling": {
|
||||
"rttMs": 40,
|
||||
"throughputKbps": 10240,
|
||||
"cpuSlowdownMultiplier": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"assert": {
|
||||
"assertions": {
|
||||
"categories:performance": ["warn", { "minScore": 0.85 }],
|
||||
"categories:accessibility": ["error", { "minScore": 0.9 }],
|
||||
"categories:best-practices": ["warn", { "minScore": 0.85 }],
|
||||
"categories:seo": ["warn", { "minScore": 0.85 }],
|
||||
"largest-contentful-paint": ["error", { "maxNumericValue": 3000 }],
|
||||
"cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
|
||||
"interactive": ["warn", { "maxNumericValue": 3000 }],
|
||||
"first-contentful-paint": ["warn", { "maxNumericValue": 2000 }],
|
||||
"total-blocking-time": ["warn", { "maxNumericValue": 300 }]
|
||||
}
|
||||
},
|
||||
"upload": {
|
||||
"target": "filesystem",
|
||||
"outputDir": "lighthouse-results"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user