Skip to content

Commit 5fc26f5

Browse files
🔥 perf(github/workflows): initial pa11y setup
1 parent eb419fe commit 5fc26f5

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Accessibility Tests (pa11y)
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
name: Building site and running accessibility tests
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Source
15+
uses: actions/checkout@v2
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 18
21+
run: npm install -g yarn
22+
run: yarn install --frozen-lockfile
23+
run: yarn build
24+
25+
- name: Boot Next
26+
run: yarn build
27+
run: yarn start
28+
29+
- name: Run pa11y-ci
30+
run: yarn pa11y-ci:sitemap 2>&1 | tee pa11y_output.txt
31+
32+
- name: Read pa11y_output
33+
id: pa11y_output
34+
uses: juliangruber/read-file-action@v1
35+
with:
36+
path: ./pa11y_output.txt
37+
38+
```${{ steps.pa11y_output.outputs.content }}```
39+
40+
</details>'
41+
42+
- name: Check for Failures
43+
if: contains(steps.pa11y_output.outputs.content, 'errno 2')
44+
run: |
45+
echo "::error::The site is failing accessibility tests."
46+
exit 1

‎.pa11yci‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"defaults": {
3+
"concurrency": 1,
4+
"standard": "WCAG2AA",
5+
"runners": [
6+
"axe",
7+
"htmlcs"
8+
],
9+
"ignore": [
10+
"color-contrast",
11+
"frame-tested"
12+
],
13+
"chromeLaunchConfig": {
14+
"args": [
15+
"--disable-dev-shm-usage",
16+
"--no-sandbox",
17+
"--disable-gpu"
18+
]
19+
},
20+
"reporters": [
21+
"cli",
22+
[
23+
"./pa11y-reporter-junit.js",
24+
{
25+
"fileName": "./pa11y-report-junit.xml"
26+
}
27+
]
28+
]
29+
}
30+
}

0 commit comments

Comments
 (0)