Skip to content

a11y doc github action check #19

a11y doc github action check

a11y doc github action check #19

name: check a11y docs
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
a11y:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Set up Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
install-chromedriver: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
# install ChromeDriver
npx browser-driver-manager install chrome
# copy chromedriver path to ENV variable
echo "CHROMEDRIVER-PATH=$CHROMEDRIVER_TEST_PATH" >> $GITHUB_ENV
- name: Build public documentation
run: |
export DB_URI="sqlite:///:memory:"
export INITIAL_ALGORITHMS=""
export VERSION=${{ env.NEXT_TAG }}
./scripts/build_docs.sh _site
- name: Serve documentation
run: |
# run npx serve in the background to serve the _site directory
npx serve _site & npx wait-on http://localhost:3000
- name: Run accessibility checks
run: |
npm install -g @axe-core/cli
# for every recursively nested *.html file in _site, run a11y checks
for file in $(find _site -name '*.html'); do
path=${file#_site/}
echo "path to check: ${path}"
echo "driver path: ${{ env.CHROMEDRIVER-PATH }}"
axe --exit --tags wcag2aa --load-delay 1500 http://127.0.0.1:3000/$path
done