pages/.github/workflows/axe.yml
Jiaqi Li ec7d7c34e8
explicitly install imagemagick to support ubuntu-latest (>=24.04) in Github actions (#2906)
Install `imagemagick` within `Install and Build 🔧` step of Github
actions

Relevant issue: 
[#2902](https://github.com/alshedivat/al-folio/issues/2902) `convert`
Command Not Found on Ubuntu 24.04

Reason: 
`ubuntu-latest` in Github actions is pointed to `ubuntu-24.04` now, in
which `imagemagick` is no longer pre-installed. See
[this](https://github.com/actions/runner-images/issues/10772).

Modified files (actions) recommended by @george-gca 
```
- .github/workflows/deploy.yml
- .github/workflows/broken-links-site.yml
- .github/workflows/axe.yml
```
2024-12-19 17:55:36 -03:00

75 lines
2.4 KiB
YAML

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
env:
URL: ""
jobs:
check:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- 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@main
with:
commitChange: false
valueFile: "_config.yml"
changes: |
{
"giscus.repo": "${{ github.repository }}",
"baseurl": ""
}
- name: Install and Build 🔧
run: |
sudo apt-get update && sudo apt-get install -y imagemagick
pip3 install --upgrade jupyter
export JEKYLL_ENV=production
bundle exec jekyll build
- name: Purge unused CSS 🧹
run: |
npm install -g purgecss
purgecss -c purgecss.config.js
- name: Get Chromium version 🌐
# https://github.com/GoogleChromeLabs/chrome-for-testing?tab=readme-ov-file#other-api-endpoints
run: |
CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1)
echo "Chromium version: $CHROMIUM_VERSION"
echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV
- name: Setup Chrome 🌐
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: ${{ env.CHROMIUM_VERSION }}
- name: Install chromedriver 🚗
run: |
npm install -g chromedriver@$CHROMIUM_VERSION
- 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 --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:8080/${{ github.event.inputs.url || env.URL }} --load-delay=1500 --exit