-
Notifications
You must be signed in to change notification settings - Fork 67
127 lines (108 loc) · 3.57 KB
/
Copy pathaccessibility.yml
File metadata and controls
127 lines (108 loc) · 3.57 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Accessibility Tests
on:
push:
branches: [main, develop]
paths: ['components/**', 'frontend/**', 'testing/accessibility/**']
pull_request:
branches: [main, develop]
schedule:
- cron: '0 3 * * 1' # Weekly Monday 03:00 UTC
concurrency:
group: a11y-${{ github.ref }}
cancel-in-progress: true
jobs:
automated-a11y:
name: Automated A11y (axe-core)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install root dependencies
run: npm ci
- name: Install a11y test dependencies
run: npm ci
working-directory: testing/accessibility
- name: Run automated accessibility tests
run: npm run test:ci
working-directory: testing/accessibility
env:
GITHUB_SHA: ${{ github.sha }}
- name: Generate accessibility report
run: node scripts/generate-a11y-report.js
working-directory: testing/accessibility
if: always()
- name: Upload accessibility reports
uses: actions/upload-artifact@v4
if: always()
with:
name: a11y-reports-${{ github.run_number }}
path: testing/accessibility/reports/
retention-days: 60
frontend-a11y:
name: Frontend A11y Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Run existing frontend a11y tests
run: node tests/a11y.test.js
working-directory: frontend
continue-on-error: true
- name: Upload frontend a11y report
uses: actions/upload-artifact@v4
if: always()
with:
name: frontend-a11y-report-${{ github.run_number }}
path: frontend/ACCESSIBILITY_REPORT.txt
retention-days: 60
comment-a11y:
name: Comment A11y Results
runs-on: ubuntu-latest
needs: [automated-a11y, frontend-a11y]
if: github.event_name == 'pull_request' && always()
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: a11y-reports-*
merge-multiple: true
path: reports/
- name: Post a11y summary
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const p = 'reports/a11y-results.json';
if (!fs.existsSync(p)) return;
const { summary, meta } = JSON.parse(fs.readFileSync(p, 'utf-8'));
const icon = summary.failed === 0 ? '✅' : '❌';
const body = [
`### ${icon} Accessibility Tests (WCAG 2.1 AA)`,
'',
`| Metric | Value |`,
`|--------|-------|`,
`| Total | ${summary.total} |`,
`| Passed | ${summary.passed} |`,
`| Failed | ${summary.failed} |`,
`| Pass Rate | ${summary.pass_rate}% |`,
'',
summary.failed > 0
? '⚠ Accessibility violations detected. Review the uploaded report artifact.'
: '_All automated accessibility checks passed._',
].join('\n');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});