| 1 |
# Accessibility tests for PST, using playwright and axe-core |
| 2 |
|
| 3 |
name: a11y-tests |
| 4 |
|
| 5 |
# Dynamic concurrency group that uses the workflow name and PR number if available |
| 6 |
# or commit SHA as a fallback. If a new build is triggered under that |
| 7 |
# concurrency group while a previous build is running it will be canceled. |
| 8 |
# Repeated pushes to a PR will cancel all previous builds, while multiple |
| 9 |
# merges to main will not cancel. |
| 10 |
# Note we add the prefix `a11y-` to avoid race conditions when called from other workflows |
| 11 |
# for example when called from the CI workflow |
| 12 |
concurrency: |
| 13 |
group: a11y-${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 14 |
cancel-in-progress: true |
| 15 |
|
| 16 |
env: |
| 17 |
FORCE_COLOR: "1" # Make tools pretty |
| 18 |
DEFAULT_PYTHON_VERSION: "3.14" # keep in sync with tox.ini |
| 19 |
PIP_DISABLE_PIP_VERSION_CHECK: "1" # Don't check for pip updates |
| 20 |
|
| 21 |
permissions: {} |
| 22 |
|
| 23 |
on: |
| 24 |
pull_request: |
| 25 |
branches: |
| 26 |
- "*" |
| 27 |
# workflow_run: |
| 28 |
# workflows: [continuous-integration] |
| 29 |
# types: [completed] |
| 30 |
# allows this to be used as a composite action in other workflows |
| 31 |
workflow_call: |
| 32 |
# allow manual triggering of the workflow, while debugging |
| 33 |
workflow_dispatch: |
| 34 |
|
| 35 |
jobs: |
| 36 |
a11y-tests: |
| 37 |
strategy: |
| 38 |
fail-fast: true |
| 39 |
matrix: |
| 40 |
# ubuntu-latest = 24.04 |
| 41 |
os: ["ubuntu-latest", "ubuntu-22.04", "macos-14"] |
| 42 |
browser: ["firefox", "chromium"] |
| 43 |
runs-on: ${{ matrix.os }} |
| 44 |
steps: |
| 45 |
- name: "Checkout repository 🛎" |
| 46 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 47 |
with: |
| 48 |
persist-credentials: false |
| 49 |
|
| 50 |
- name: "Setup CI environment 🛠" |
| 51 |
uses: pydata/pydata-sphinx-theme/.github/actions/set-dev-env@e8db643b990df73812cf9397bc0f8cfa1164e4d3 |
| 52 |
with: |
| 53 |
python-version: ${{ env.DEFAULT_PYTHON_VERSION }} |
| 54 |
pandoc: true |
| 55 |
graphviz: true |
| 56 |
|
| 57 |
- name: "Run accessibility tests with playwright 🎭" |
| 58 |
# build PST, build docs, then run a11y-tests |
| 59 |
run: python -Im tox run -e compile-assets,i18n-compile,py314-docs,a11y-tests-${{ matrix.browser }} |
| 60 |
|
| 61 |
- name: "Upload Playwright traces, if any 🐾" |
| 62 |
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4.7.0.0 |
| 63 |
if: ${{ failure() }} |
| 64 |
with: |
| 65 |
name: playwright-traces-${{ matrix.os }}-${{ matrix.browser }} |
| 66 |
path: test-results/ |