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

💚 Update worklow to test accessibility #182

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
41 changes: 41 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
- "CONTRIBUTING.md"
- "CODE_OF_CONDUCT.md"

permissions:
pull-requests: write
contents: read

jobs:
compile-themes:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -38,3 +42,40 @@ jobs:
sass src/themes/chimera-nightsky.scss build/chimera-nightsky.css
shell: bash
working-directory: ./chimera-css

accessibility-testing:
runs-on: ubuntu-latest
name: Running pa11y-ci tests on HTML file

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Install pa11y-ci dependencies
run: npm install -g pa11y-ci

- name: Run pa11y-ci on static HTML file
run: pa11y-ci file://$GITHUB_WORKSPACE/apps/demo/index.html 2>&1 | tee pa11y_output.txt

- name: Read pa11y_output file
id: pa11y_output
uses: juliangruber/read-file-action@v1
with:
path: ./pa11y_output.txt

- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: '<details><summary>Pa11y testing results</summary>


```${{ steps.pa11y_output.outputs.content }}```

</details>'

- name: Check for pa11y failures
if: contains(steps.pa11y_output.outputs.content, 'errno 2')
run: |
echo "::error::The site is failing accessibility tests. Please review the comment in the pull request or the pa11y-ci step in the workflow for details."
exit 1
9 changes: 9 additions & 0 deletions pa11yci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"defaults": {
"standard": "WCAG2AA",
"timeout": 30000
},
"urls": [
"http://localhost:8080/index.html"
]
}
Loading