Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[Issue #40]: Setup pa11y-ci #20

[Issue #40]: Setup pa11y-ci

[Issue #40]: Setup pa11y-ci #20

name: pa11y tests
on:
pull_request:
paths:
- frontend/**
- .github/workflows/ci-frontend-a11y.yml
defaults:
run:
working-directory: ./frontend
env:
NODE_VERSION: 20
LOCKFILE_PATH: ./frontend/package-lock.json
PACKAGE_MANAGER: npm
DEBUG: 'pa11y*' # Enable pa11y debug logs
jobs:
build:
name: Pa11y-ci tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache-dependency-path: ${{ env.LOCKFILE_PATH }}
cache: ${{ env.PACKAGE_MANAGER }}
- name: Install dependencies
run: npm ci
- name: Create screenshots directory
run: mkdir -p screenshots-output
- name: Start server
run: npm run dev &
- name: Wait for server to be ready
run: |
# Ensure the server wait script is executable
chmod +x ./bin/wait-for-frontend.sh
./bin/wait-for-frontend.sh
shell: bash
- name: Check server health
run: curl -I http://localhost:3000
- name: Run pa11y-ci
run: npm run test:pa11y
- name: Capture pa11y-ci failure logs
if: failure()
run: echo "::error::The site is failing accessibility tests. Please review the Pa11y results above."