Skip to content

Commit

Permalink
Make Lighthouse CI run on local build
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 25, 2023
1 parent c6762a2 commit 51655ca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,25 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@f1e137043864b9ab9034ae3a5adc1c108e3f1a48 # v1
id: netlify

- name: Use Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
site_name: docusaurus-2
max_timeout: 600
node-version: 18

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build website fast
run: yarn build:website:fast

- name: Audit URLs using Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@03becbfc543944dd6e7534f7ff768abb8a296826 # 10.1.0
with:
urls: |
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/docs/installation/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/docs/category/getting-started/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/blog/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/blog/preparing-your-site-for-docusaurus-v3/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/blog/tags/release/
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/blog/tags/
configPath: ./.github/workflows/lighthouserc.json
uploadArtifacts: true
temporaryPublicStorage: true
env:
PR_NUMBER: ${{ github.event.pull_request.number}}

- name: Format lighthouse score
id: format_lighthouse_score
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{
"ci": {
"collect": {
"startServerCommand": "yarn serve:website",
"startServerReadyPattern": "Serving",
"startServerReadyTimeout": 10000,

"url": [
"http://localhost:3000/",
"http://localhost:3000/docs/installation/",
"http://localhost:3000/docs/category/getting-started/",
"http://localhost:3000/blog/",
"http://localhost:3000/blog/preparing-your-site-for-docusaurus-v3/",
"http://localhost:3000/blog/tags/release/",
"http://localhost:3000/blog/tags/"
],

"settings": {
"skipAudits": [
"robots-txt",
Expand Down

0 comments on commit 51655ca

Please sign in to comment.