@@ -115,51 +115,4 @@ jobs:
115115 }
116116 env :
117117 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL_FRIENDS_OF_DOCS }}
118- PREVIEW_URL : ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}
119-
120-
121- lighthouseci :
122- if : github.event.pull_request
123- needs : call-docs-build-push
124- runs-on : ubuntu-22.04
125- steps :
126- - uses : actions/checkout@v5
127- with :
128- ref : ${{ github.event.workflow_run.head_branch }}
129- - uses : actions/setup-node@v5
130- with :
131- node-version : 18
132- - name : Installing packages
133- run : npm install
134- - name : Generating lighthouse reports for PR and main...
135- run : |
136- node lighthouse-script.js
137- - name : Compare the artifacts for negative differences in performance
138- continue-on-error : true
139- run : |
140- FIELDS=("performance" "accessibility")
141- for FIELD in "${FIELDS[@]}"; do
142- PR_VALUE=$(cat lighthouse-reports/pr-report.json | jq -r ".categories.$FIELD.score")
143- MAIN_VALUE=$(cat lighthouse-reports/main-report.json | jq -r ".categories.$FIELD.score")
144- echo "$FIELD: PR - $PR_VALUE | Main - $MAIN_VALUE"
145-
146- if [ $FIELD = "performance" ]; then
147- LOWER_BOUND=$(echo "$MAIN_VALUE - 0.05" | bc)
148- UPPER_BOUND=$(echo "$MAIN_VALUE + 0.05" | bc)
149- if (( $(echo "$PR_VALUE < $LOWER_BOUND" | bc -l) || $(echo "$PR_VALUE > $UPPER_BOUND" | bc -l) )); then
150- echo "Error: $FIELD score in PR ($PR_VALUE) is less than in MAIN ($MAIN_VALUE)"
151- exit 1
152- fi
153- else
154- if (( $(echo "$PR_VALUE < $MAIN_VALUE" | bc -l) )); then
155- echo "Error: $FIELD score in PR ($PR_VALUE) is less than in MAIN ($MAIN_VALUE)"
156- exit 1
157- fi
158- fi
159- done
160- - uses : actions/upload-artifact@v4
161- if : ${{ !cancelled() }}
162- with :
163- name : lighthouse-reports
164- path : lighthouse-reports/
165- retention-days : 30
118+ PREVIEW_URL : ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}
0 commit comments