-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69a2e3d
commit 6697348
Showing
7 changed files
with
2,848 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CI | ||
on: [push] | ||
jobs: | ||
lhci: | ||
name: Lighthouse | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
- name: npm install, build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: run Lighthouse CI | ||
run: | | ||
npm install -g @lhci/cli@0.13.x | ||
npm install -g puppeteer | ||
lhci autorun |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
ci: { | ||
collect: { | ||
numberOfRuns: 3, //lighthouse run times to return html | ||
startServerCommand: "npm run dev", //start a server | ||
url: ["http://localhost:5173/"], | ||
settings: { | ||
onlyCategories: [ | ||
"performance", | ||
"accessibility", | ||
"best-practices", | ||
"seo", | ||
], | ||
}, | ||
skipAudits: ["redirects-http", "uses-http2"], | ||
puppeteerScript: "./puppeteer-script.cjs", | ||
}, | ||
assert: { | ||
//fail the build based on the audit results | ||
// preset: "lighthouse:recommended", // 包含的东西太多 | ||
assertions: { | ||
"categories:performance": [ | ||
"error", | ||
{ minScore: 0.9, aggregationMethod: "median" }, | ||
], //定义不同的数据等级 | ||
"categories:accessibility": [ | ||
"error", | ||
{ minScore: 0.9, aggregationMethod: "pessimistic" }, | ||
], | ||
"categories:best-practices": [ | ||
"error", | ||
{ minScore: 0.9, aggregationMethod: "pessimistic" }, | ||
], | ||
"categories:seo": [ | ||
"error", | ||
{ minScore: 0.9, aggregationMethod: "pessimistic" }, | ||
], | ||
}, | ||
}, | ||
upload: { | ||
target: "temporary-public-storage", //什么意思? | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.