Skip to content

Add lighthouse performance Github Action #1

Add lighthouse performance Github Action

Add lighthouse performance Github Action #1

name: Lighthouse Performance
on:
pull_request:
branches: [develop, main]
jobs:
# vercel will deploy a preview branch and domain for this PR
# wait for new deployment to complete before running lighthouse
wait-for-vercel-deployment:
name: Wait for vercel deployment
runs-on: ubuntu-latest
outputs:
preview_url: ${{ steps.waitForVercelDeployment.outputs.url }}
steps:
- name: Wait for Vercel preview deployment to be ready
uses: patrickedqvist/[email protected]
id: waitForVercelDeployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 1000
check_interval: 5
lighthouse-mobile:
runs-on: ubuntu-latest
needs: wait-for-vercel-deployment
steps:
- uses: actions/checkout@v3
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v10
with:
urls: |
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/activities
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/chat
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/grounding
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/notes
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/therapy
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/image-based-abuse-and-rebuilding-ourselves
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/dating-boundaries-and-relationships
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/recovering-from-toxic-and-abusive-relationships
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/image-based-abuse-and-rebuilding-ourselves/the-social-context-of-image-based-abuse-and-victim-blaming
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/dating-boundaries-and-relationships/emotional-boundaries
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/recovering-from-toxic-and-abusive-relationships/introduction-and-what-you-should-know
budgetPath: ./lighthouse_budget.json # test performance budgets
uploadArtifacts: true # save results as an action artifacts
lighthouse-desktop:
runs-on: ubuntu-latest
needs: wait-for-vercel-deployment
steps:
- uses: actions/checkout@v3
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v10
with:
urls: |
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/activities
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/chat
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/grounding
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/notes
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/therapy
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/image-based-abuse-and-rebuilding-ourselves
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/dating-boundaries-and-relationships
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/recovering-from-toxic-and-abusive-relationships
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/image-based-abuse-and-rebuilding-ourselves/the-social-context-of-image-based-abuse-and-victim-blaming
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/dating-boundaries-and-relationships/emotional-boundaries
${{ needs.wait-for-vercel-deployment.outputs.preview_url }}/courses/recovering-from-toxic-and-abusive-relationships/introduction-and-what-you-should-know
budgetPath: ./lighthouse_desktop_budget.json # test performance budgets
uploadArtifacts: true # save results as an action artifacts
configPath: '.github/configs/lighthouse-desktop-rc.yml' # set lighthouse config