Skip to content

Commit

Permalink
feat: add Lighthouse CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thekavikumar committed Jul 31, 2024
1 parent c9de1e7 commit 7160aa6
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,31 @@ jobs:
with:
node-version: '18'

- name: Install Lighthouse
run: npm install -g lighthouse
- name: Install dependencies
run: yarn install

- name: Build Next.js application
run: yarn build

- name: Start local server
- name: Start production server
run: |
# Adjust this command to start your local server
npm install
npm start &
sleep 15
yarn start &
sleep 15 # Give the server time to start
- name: Install Lighthouse
run: yarn global add lighthouse

- name: Run Lighthouse on local site
id: lighthouse-local
run: lighthouse http://localhost:3000 --output html --output-path ./lighthouse-local.html --output json --output-path ./lighthouse-local.json
- name: Run Lighthouse on production build
id: lighthouse-production
run: lighthouse http://localhost:3000 --output html --output-path ./lighthouse-production.html --output json --output-path ./lighthouse-production.json

- name: Display local Lighthouse report
run: cat ./lighthouse-local.json | jq
- name: Display Lighthouse report
run: cat ./lighthouse-production.json | jq

- name: Upload Lighthouse results
uses: actions/upload-artifact@v2
with:
name: lighthouse-results
path: |
lighthouse-local.html
lighthouse-local.json
lighthouse-production.html
lighthouse-production.json

0 comments on commit 7160aa6

Please sign in to comment.