mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
add initial a11y config for docs site
This commit is contained in:
parent
d0407dd596
commit
7419937f81
2 changed files with 61 additions and 0 deletions
42
.github/workflows/docs.yaml
vendored
Normal file
42
.github/workflows/docs.yaml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, release ]
|
||||
pull_request:
|
||||
branches: [ develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Python 3.9
|
||||
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: Install dependencies
|
||||
run: |
|
||||
pip install poetry
|
||||
poetry config --local virtualenvs.in-project true
|
||||
poetry install --no-root --remove-untracked
|
||||
npm install pa11y
|
||||
|
||||
- name: Start docs server
|
||||
run: poetry run mkdocs serve &
|
||||
|
||||
- name: Accessibility testing (Pa11y)
|
||||
run: poetry run .github/workflows/pa11y.sh
|
||||
|
19
.github/workflows/pa11y.sh
vendored
Executable file
19
.github/workflows/pa11y.sh
vendored
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
Reference in a new issue