jrnl/.github/workflows/docs.yaml
Jonathan Wren 12e39ffd61
Change approach for docs workflow to use pa11y-ci (#1116)
The previous plugin looked nice with the comments and annotations, but
apparently doesn't work for PRs. It can only run on the pr target (our
branch), which means that the tests are never actually run against the
new code.

As you can guess, this is pretty useless for PRs. So, this PR fixes
that, and uses the very nice pa11y-ci (instead of the normal pa11y).
While it doesn't upload annotations, the output is very readable and
seems like the best we're going to get.
2020-12-19 12:00:59 -08:00

68 lines
1.6 KiB
YAML

name: Docs
on:
push:
branches: [ develop, release ]
paths:
- 'docs/**'
- 'docs_theme/**'
- 'mkdocs.yml'
- 'readthedocs.yml'
- '.github/workflows/docs.yaml'
pull_request:
branches: [ develop ]
paths:
- 'docs/**'
- 'docs_theme/**'
- 'mkdocs.yml'
- 'readthedocs.yml'
- '.github/workflows/docs.yaml'
jobs:
accessibility:
if: contains(toJson(github.event.commits), '[ci skip]') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Setup Node.js environment
uses: actions/setup-node@main
- name: poetry cache
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }}
- name: npm cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-pa11y-v3
- name: Install dependencies
run: |
pip install poetry
poetry config --local virtualenvs.in-project true
poetry install --no-root --remove-untracked
npm install pa11y-ci
echo "node_modules/.bin" >> $GITHUB_PATH
- name: Start docs server
run: poetry run mkdocs serve &
- name: Generate sitemap
env:
site_url: http://127.0.0.1:8000
run: |
select="{urls: [\"${site_url}/\", .urlset.url[].loc]}"
curl -s "$site_url/sitemap.xml" | poetry run xq "$select" > list.json
- name: Accessibility testing (Pa11y)
run: pa11y-ci -c list.json