-
-
Notifications
You must be signed in to change notification settings - Fork 72
130 lines (110 loc) · 3.5 KB
/
accessibility.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
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
128
129
130
name: Accessibility tests
on:
pull_request:
branches: [ develop ]
jobs:
test_a11y:
name: Accessibility testing with ${{ matrix.package }}
runs-on: ubuntu-latest
continue-on-error: true # currently we expect these tests to fail
strategy:
matrix:
python-version: ["3.11"]
# two options for package: "pa11y" and "lighthouse"
# both options use axe-core ruleset for a11y tests
# pa11y runs faster and produces smaller artifacts
# lighthouse includes performance tests and other checks for non-a11y best practices
# for now, just use pa11y as we focus on improving a11y specifically
package: ["pa11y"]
fail-fast: false # don't cancel lighthouse job if pa11y fails, and vice versa
env:
AMY_DATABASE_HOST: localhost
AMY_DATABASE_PORT: 5432
AMY_DATABASE_NAME: test_amy
AMY_DATABASE_USER: postgres
AMY_DATABASE_PASSWORD: postgres
AMY_INSTRUCTOR_RECRUITMENT_ENABLED: True
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_amy
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
# Database setup
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install pipenv
pipenv sync --dev
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install NodeJS dependencies
run: npm install
- name: Check migrations
run: |
pipenv run python manage.py makemigrations --dry-run --check;
if [[ $? != "0" ]]; then
exit 1;
fi;
- name: Collect static files
run: |
pipenv run python manage.py collectstatic --no-input;
if [[ $? != "0" ]]; then
exit 1;
fi;
- name: Set up dev database
run: |
echo "yes" | pipenv run make dev_database
- name: Set up Chromium
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: latest
# Lighthouse
- name: run Lighthouse CI
run: |
npm install -g @lhci/[email protected]
npm install -g puppeteer
lhci autorun
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
if: matrix.package == 'lighthouse'
- name: Upload Lighthouse test results
uses: actions/upload-artifact@v3
with:
name: lighthouse-ci-report
path: lighthouse-ci-report/
if: matrix.package == 'lighthouse'
# Pa11y
- name: Start server in background
run: |
pipenv run make serve &
if: matrix.package == 'pa11y'
- name: Run pa11y
run: |
npm install -g pa11y-ci pa11y-ci-reporter-html
pa11y-ci
if: matrix.package == 'pa11y'
continue-on-error: true
- name: Upload pa11y test results
uses: actions/upload-artifact@v3
with:
name: pa11y-ci-report
path: pa11y-ci-report/
if: matrix.package == 'pa11y'