-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from mazipan/mazipan-lh-cli
feat: try lh ci to replace Netlify Plugin
- Loading branch information
Showing
3 changed files
with
92 additions
and
9 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,45 @@ | ||
name: Lighthouse CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
lhci: | ||
name: Run Lighthouse CI | ||
runs-on: ubuntu-latest | ||
|
||
if: ${{ !contains(github.event.pull_request.labels.*.names, 'need-perf-check') }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Wait for the Netlify Preview | ||
uses: jakepartusch/wait-for-netlify-action@v1 | ||
id: netlify | ||
with: | ||
site_name: 'wargabantuwarga' | ||
|
||
- name: "Lighthouse CI assertion" | ||
id: lhci | ||
shell: bash | ||
run: | | ||
yarn global add @lhci/[email protected] | ||
echo -e "\n" | ||
echo "Start collecting LH report..." | ||
lhci collect --url=${{ steps.netlify.outputs.url }} -n=1 | ||
echo -e "\n" | ||
echo "Start asserting LH score..." | ||
lhci assert --config=./lighthouserc.js | ||
echo -e "\n" | ||
echo "Start uploading the report..." | ||
lhci upload --target "temporary-public-storage" --githubAppToken "$LHCI_GITHUB_APP_TOKEN" --githubToken "$GITHUB_TOKEN" | ||
env: | ||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,38 @@ | ||
module.exports = { | ||
ci: { | ||
assert: { | ||
// preset: "lighthouse:no-pwa", | ||
/* Note | ||
// Read more assertions on: | ||
// https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#assert | ||
*/ | ||
assertions: { | ||
"categories:performance": ["error", { minScore: 0.5 }], | ||
"categories:accessibility": ["error", { minScore: 0.9 }], | ||
"categories:seo": ["warn", { minScore: 0.7 }], | ||
|
||
// Core Web Vitals | ||
"cumulative-layout-shift": ["warn", { minScore: 0.5 }], | ||
"largest-contentful-paint": ["warn", { minScore: 0.25 }], | ||
"total-blocking-time": ["warn", { minScore: 0.1 }], | ||
|
||
// disable assertion | ||
canonical: "off", | ||
"crawlable-anchors": "off", | ||
"csp-xss": "off", | ||
interactive: "off", | ||
"is-crawlable": "off", | ||
"legacy-javascript": "off", | ||
"mainthread-work-breakdown": "off", | ||
"max-potential-fid": "off", | ||
"no-vulnerable-libraries": "off", | ||
"uses-rel-preload": "off", | ||
"uses-rel-preconnect": "off", | ||
"unused-css-rules": "off", | ||
"unused-javascript": "off", | ||
"tap-targets": ["warn", { minScore: 0.3 }], | ||
"dom-size": ["warn", { minScore: 0.5 }], | ||
}, | ||
}, | ||
}, | ||
}; |
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