feat: Keploy lighthouse integration #4
This file contains hidden or 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 score | |
| on: | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| lighthouse: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - run: npm install -g serve | |
| - name: Serve PR branch (port 3001) | |
| run: | | |
| serve . -l 3001 & | |
| sleep 5 | |
| - name: Checkout main branch into separate folder | |
| run: | | |
| git fetch origin main | |
| git worktree add main-branch origin/main | |
| - name: Serve Main branch (port 3000) | |
| run: | | |
| cd main-branch | |
| serve . -l 3000 & | |
| cd .. | |
| sleep 5 | |
| - name: Run Lighthouse audits | |
| uses: treosh/lighthouse-ci-action@v12 | |
| with: | |
| urls: | | |
| http://localhost:3000/ | |
| http://localhost:3001/ | |
| uploadArtifacts: true | |
| temporaryPublicStorage: true | |
| - name: Parse reports and generate comment | |
| run: node .github/scripts/lighthouse-report.js | |
| - name: Comment on PR with Lighthouse scores | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body-path: lighthouse-comment.md |