💚 Update worklow to test accessibility #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "README.md" | |
- "SECURITY.md" | |
- "LICENCE" | |
- "GUIDE.md" | |
- "CONTRIBUTING.md" | |
- "CODE_OF_CONDUCT.md" | |
permissions: | |
pull-requests: write | |
contents: read | |
jobs: | |
compile-themes: | |
runs-on: ubuntu-latest | |
name: Compile themes | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install npm dependencies | |
run: | | |
npm ci | |
npm install -g sass | |
shell: bash | |
working-directory: ./chimera-css | |
- name: Compile sass | |
run: | | |
sass src/themes/chimera.scss build/chimera.css | |
sass src/themes/chimera-dark.scss build/chimera-dark.css | |
sass src/themes/chimera-golden.scss build/chimera-golden.css | |
sass src/themes/chimera-autumn.scss build/chimera-autumn.css | |
sass src/themes/chimera-plain.scss build/chimera-plain.css | |
sass src/themes/chimera-blues.scss build/chimera-blues.css | |
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 |