From 60e32c41440bad7a697224ce2814650eda3eebf3 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:38:31 -0300 Subject: [PATCH] Axe accessibility test support (#2080) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added GitHub action to do axe accessibility tests with [axe cli](https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli). I believe it is best by default to let this be run only manually, since fixing some of the issues are not straightforward (I haven't fixed them all for this template yet). --------- Signed-off-by: George Araújo --- .github/workflows/axe.yml | 61 +++++++++++++++++++++++++++++++++++++++ _includes/footer.liquid | 4 +-- _includes/header.liquid | 2 +- _layouts/default.liquid | 2 +- 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/axe.yml diff --git a/.github/workflows/axe.yml b/.github/workflows/axe.yml new file mode 100644 index 000000000000..b3c1638751af --- /dev/null +++ b/.github/workflows/axe.yml @@ -0,0 +1,61 @@ +name: Axe accessibility testing + +on: + # if you want to run this on every push uncomment the following lines + # push: + # branches: + # - master + # - main + # pull_request: + # branches: + # - master + # - main + workflow_dispatch: + inputs: + url: + description: "URL to be checked (e.g.: blog/)" + required: false + +permissions: + contents: write + +env: + URL: "" + +jobs: + check: + # available images: https://github.com/actions/runner-images#available-images + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2.2" + bundler-cache: true + - name: Update _config.yml ⚙️ + uses: fjogeleit/yaml-update-action@v0.13.1 + with: + commitChange: false + valueFile: "_config.yml" + changes: | + { + "giscus.repo": "${{ github.repository }}", + "baseurl": "" + } + - name: Install and Build 🔧 + run: | + pip3 install --upgrade jupyter + npm install -g mermaid.cli + npm install -g purgecss + export JEKYLL_ENV=production + bundle exec jekyll build --lsi + purgecss -c purgecss.config.js + - name: Run axe 🪓 + # https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli + run: | + npm install -g @axe-core/cli + npm install -g http-server + http-server _site/ & + axe http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit diff --git a/_includes/footer.liquid b/_includes/footer.liquid index c6e0234c7f5b..7541c96ca834 100644 --- a/_includes/footer.liquid +++ b/_includes/footer.liquid @@ -1,5 +1,5 @@ {% if site.footer_fixed %} -