Skip to content

Commit

Permalink
Add lighthouse output reports to slack message
Browse files Browse the repository at this point in the history
  • Loading branch information
scruti committed Aug 7, 2024
1 parent f6de387 commit 365e283
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/accessibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
skip-ruby: true

- name: Install axe-core and sitemap-urls
run: npm install -g @axe-core/cli sitemap-urls
run: npm install -g @axe-core/cli sitemap-urls node-jq

- name: Get list of URLs to test against from QA sitemap
run: |
Expand Down Expand Up @@ -167,14 +167,36 @@ jobs:
run: |
encoded_auth=$(echo -n $HTTP_BASIC_USER:$HTTP_BASIC_PASSWORD | base64)
sed -i "s/auth_token/${encoded_auth}/g" .lighthouserc.json
- name: Set environment variables for testing URLs
run: |
echo "INDEX_URL=https://qa.teaching-vacancies.service.gov.uk" >> $INDEX_URL
echo "JOBS_URL=$INDEX_URL/jobs" >> $JOBS_URL
echo "SCHOOLS_URL=$INDEX_URL/schools" >> $SCHOOLS_URL
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
https://qa.teaching-vacancies.service.gov.uk
https://qa.teaching-vacancies.service.gov.uk/jobs
https://qa.teaching-vacancies.service.gov.uk/schools
$INDEX_URL
$JOBS_URL
$SCHOOLS_URL
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighthouse report to the temporary storage
runs: 3

- name: Set environment variables for test results
run: |
echo "INDEX_RESULTS=$(${{steps.LHCIAction.outputs.links}} | jq '.["$INDEX_URL"]')" >> $INDEX_RESULTS
- name: Notify twd_tv_dev channel on Lighthouse results
uses: rtCamp/[email protected]
env:
SLACK_CHANNEL: twd_tv_dev
SLACK_USERNAME: CI Accessiblity Tests
SLACK_TITLE: LightHouse tests results
SLACK_MESSAGE: |
LightHouse accessibility and performance tests ran against the QA environment <!channel>
<Results for $INDEX_URL|$INDEX_RESULTS>
SLACK_WEBHOOK: ${{env.SLACK_WEBHOOK}}
SLACK_COLOR: good

0 comments on commit 365e283

Please sign in to comment.