feat: add Lighthouse CI workflow #4
Workflow file for this run
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
name: Lighthouse Performance Test | |
on: | |
push: | |
branches: | |
- feat/lighthouse | |
pull_request: | |
branches: | |
- feat/lighthouse | |
jobs: | |
lighthouse: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build Next.js application | |
run: yarn build | |
- name: Start production server | |
run: | | |
yarn start & | |
sleep 15 # Give the server time to start | |
- name: Install Lighthouse | |
run: yarn global add lighthouse | |
- name: Run Lighthouse on production build | |
id: lighthouse-production | |
run: lighthouse http://localhost:3000 --output html --output-path ./lighthouse-production.html --view | |
- 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-production.html | |
lighthouse-production.json |