forked from BrainTease/Brain-Storm
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.6 KB
/
Copy pathaccessibility-testing.yml
File metadata and controls
55 lines (44 loc) · 1.6 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
name: Accessibility Testing
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
accessibility:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build --workspace=apps/frontend
- name: Run accessibility tests
run: npm run test:a11y --workspace=apps/frontend
- name: Run WCAG compliance tests
run: npm run test:wcag --workspace=apps/frontend
- name: Upload accessibility report
if: always()
uses: actions/upload-artifact@v4
with:
name: accessibility-report
path: apps/frontend/coverage/a11y/
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('apps/frontend/coverage/a11y/report.json', 'utf8');
const violations = JSON.parse(report).violations.length;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Accessibility Test Results\n\n**Violations Found:** ${violations}\n\n[View Full Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})`
});