Skip to content

Commit

Permalink
Merge pull request #6427 from guardian/ahe/lighthouse-alarm
Browse files Browse the repository at this point in the history
Lighthouse - alarm on failure
  • Loading branch information
andrewHEguardian authored Oct 22, 2024
2 parents a2f3ab3 + 101d37e commit 5b18870
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
Lighthouse:
if: ${{ github.event.label.name == 'Seen-on-PROD' }}
runs-on: ubuntu-latest
env:
GOOGLE_CHAT_WEB_HOOK: ${{ secrets.GOOGLE_CHAT_WEB_HOOK }}
steps:
- uses: actions/checkout@v4
- name: Audit URLs using Lighthouse
Expand All @@ -16,3 +18,9 @@ jobs:
https://support.theguardian.com/uk/contribute
configPath: ./lighthouserc.json
uploadArtifacts: true # save results as an action artifacts
- name: Notify on failure
if: ${{ failure() }}
run: |
failedWorkflowRun="https://github.com/guardian/support-frontend/actions/runs/$GITHUB_RUN_ID"
prTrigger="https://github.com/guardian/support-frontend/pull/${{ github.event.number }}"
curl -X POST -H "Content-Type: application/json" "$GOOGLE_CHAT_WEB_HOOK" -d '{"text": "🚨 The Lighthouse performance tests for support-frontend have failed 🚨\n\n- <'"$failedWorkflowRun"'|You can see the reason for this failure on GitHub>. \n- <'"$prTrigger"'|PR that triggered this>.\n\n Has this introduced a performance regression or do the metrics need tweaking? "}'
6 changes: 3 additions & 3 deletions lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"ci": {
"assert": {
"assertions": {
"first-contentful-paint": ["error", { "maxNumericValue": 2500 }],
"largest-contentful-paint": ["error", { "maxNumericValue": 6000 }],
"interactive": ["error", { "maxNumericValue": 8000 }],
"first-contentful-paint": ["error", { "maxNumericValue": 3000 }],
"largest-contentful-paint": ["error", { "maxNumericValue": 7000 }],
"interactive": ["error", { "maxNumericValue": 9500 }],
"resource-summary:document:size": [
"error",
{ "maxNumericValue": 20000 }
Expand Down

0 comments on commit 5b18870

Please sign in to comment.