This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (60 loc) · 2 KB
/
pa11y.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
name: pa11y tests
# yamllint disable-line rule:truthy
on:
pull_request:
workflow_dispatch:
permissions: read-all
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: Building site and running pa11y-ci tests
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
- name: Checkout source
uses: actions/checkout@v3
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Install dependencies
run: npm ci
- name: Test accessibility with pa11y
run: |
npm run dev & \
timeout 120s \
sh -c 'until nc -z localhost 3000; do sleep 1; done' \
&& sleep 120 \
&& npm run test:pa11y 2>&1 | tee pa11y_output.txt
- name: Read pa11y_output file.
id: pa11y_output
uses: juliangruber/read-file-action@v1
with:
path: ./pa11y_output.txt
- name: verify that pa11y successfully scanned the site
if: contains(steps.pa11y_output.outputs.content, 'ailed to run')
run: |
echo "::error::Pa11y failed to run."
exit 1
- name: Comment on pull request.
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: "<details><summary>Pa11y testing results</summary>
```${{ steps.pa11y_output.outputs.content }}```
</details>"
- name: Check for pa11y failures.
if: contains(steps.pa11y_output.outputs.content, 'errno 2')
run: |
echo "::error::The site is failing accessibility tests."
echo "Please review the comment in the pull request for details."
exit 1