mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 14:06:14 +02:00
Add initial a11y config for docs site (#1067)
This commit is contained in:
parent
b0b98d85fe
commit
57de3b7d81
5 changed files with 311 additions and 236 deletions
|
@ -13,7 +13,12 @@ executors:
|
|||
|
||||
python39:
|
||||
docker:
|
||||
- image: circleci/python:3.9.0
|
||||
- image: cimg/python:3.9.0
|
||||
resource_class: small
|
||||
|
||||
with_browser:
|
||||
docker:
|
||||
- image: cimg/python:3.9.0-browsers
|
||||
resource_class: small
|
||||
|
||||
commands:
|
||||
|
@ -34,6 +39,18 @@ commands:
|
|||
paths:
|
||||
- ~/project/.venv
|
||||
|
||||
install_pa11y:
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: deps-00-pa11y
|
||||
- run:
|
||||
name: Install accessibility software (pa11y)
|
||||
command: npm install pa11y pa11y-reporter-junit
|
||||
- save_cache:
|
||||
key: deps-00-pa11y
|
||||
paths:
|
||||
- ~/project/node_modules
|
||||
|
||||
pytest:
|
||||
steps:
|
||||
- run:
|
||||
|
@ -107,10 +124,26 @@ jobs:
|
|||
- get_poetry_deps
|
||||
- lint
|
||||
|
||||
docs_a11y:
|
||||
executor: with_browser
|
||||
steps:
|
||||
- checkout
|
||||
- get_poetry_deps
|
||||
- install_pa11y
|
||||
- run:
|
||||
name: Starting mkdocs server
|
||||
command: poetry run mkdocs serve
|
||||
background: true
|
||||
- run: poetry run .circleci/pa11y.sh
|
||||
- store_test_results:
|
||||
path: reports
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- docs_a11y:
|
||||
name: Documentation site (jrnl.sh) accessibility
|
||||
- linting:
|
||||
name: Linting and Formatting
|
||||
- test_37_linux:
|
||||
|
|
19
.circleci/pa11y.sh
Executable file
19
.circleci/pa11y.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#! /bin/bash
|
||||
set +e
|
||||
|
||||
reports_dir="reports/pa11y"
|
||||
site_url="http://127.0.0.1:8000"
|
||||
exit_code=0
|
||||
|
||||
mkdocs build
|
||||
mkdir -p "$reports_dir"
|
||||
|
||||
printf -- 'scanning: /\n'
|
||||
./node_modules/.bin/pa11y "$site_url" --reporter junit > "$reports_dir/root.xml" || exit_code=2
|
||||
|
||||
for file in $(xq '.urlset.url[].loc' site/sitemap.xml -r | sed -r 's!https://jrnl.sh/(.*?)/$!\1!'); do
|
||||
printf -- 'scanning: /%s\n' "$file"
|
||||
./node_modules/.bin/pa11y "$site_url/$file" --reporter junit > "$reports_dir/$file.xml" || exit_code=2
|
||||
done
|
||||
|
||||
exit $exit_code
|
Loading…
Add table
Add a link
Reference in a new issue