Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a11y tests in CI #19002

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ci": {
"assert": {
"assertions": {
"categories:performance": ["warn", {"minScore": 0.9}],
"categories:accessibility": ["error", {"minScore": 1}],
"categories:best-practices": ["error", {"minScore": 1}],
"categories:pwa": ["warn", {"minScore": 1}],
"categories:seo": ["warn", {"minScore": 1}]
}
}
}
}
53 changes: 53 additions & 0 deletions .github/workflows/axe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: axe-core Tests

on:
push:
branches: "*"
pull_request:
branches: "*"

permissions:
pull-requests: write

jobs:
axe:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install axe
shell: bash
run: |
npm install -g @axe-core/cli
- name: Run axe
id: axe
shell: bash
run: |
{
echo 'AXE_OUTPUT<<EOF'
axe https://beta.gouv.fr
echo EOF
} >> "$GITHUB_ENV"

- name: Read result
run: |
echo "$AXE_OUTPUT"

- name: Post result
if: ${{ contains(env.AXE_OUTPUT, 'Accessibility issues detected') }}
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
### Rapport d'accessibilité [axe-core](https://github.com/dequelabs/axe-core) pour ${{ github.sha }} to <https://beta.gouv.fr>

```
${{ env.AXE_OUTPUT }}
```

- name: Exit code
if: ${{ contains(env.AXE_OUTPUT, 'Accessibility issues detected') }}
run: |
exit 1
20 changes: 20 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lighthouse CI
on: push
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit URLs using Lighthouse
id: lighthouse
uses: treosh/lighthouse-ci-action@v11
with:
configPath: .github/lighthouserc.json
uploadArtifacts: true
temporaryPublicStorage: true
urls: |
https://beta.gouv.fr
- name: debug
run: |
echo ${{ steps.lighthouse.outputs.manifest }}

19 changes: 19 additions & 0 deletions .github/workflows/pa11y.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pa11y
on:
push:
branches: "*"
pull_request:
branches: "*"
jobs:
pa11y:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Run pa11y
run: |
npm install -g pa11y
pa11y https://beta.gouv.fr
Loading