Fix CI/CD fail by installing ImageMagick on runner
This commit addresses an issue where CI/CD jobs fail due to the removal of `imagemagick` from GitHub's preinstalled software list for Ubuntu runners. As a result, commands relying on `imagemagick` were not found. To resolve this, the commit installs `imagemagick` across all platforms (Linux, macOS, and Windows). This safeguards against future changes to the preinstalled software list on GitHub runners. This commit also centralizes installing of ImageMagick as its own action for reusability.
This commit is contained in:
12
.github/actions/install-imagemagick/action.yml
vendored
Normal file
12
.github/actions/install-imagemagick/action.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
inputs:
|
||||||
|
project-root:
|
||||||
|
required: false
|
||||||
|
default: '.'
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Install ImageMagick
|
||||||
|
shell: bash
|
||||||
|
run: ./.github/actions/install-imagemagick/install-imagemagick.sh
|
||||||
|
working-directory: ${{ inputs.project-root }}
|
||||||
56
.github/actions/install-imagemagick/install-imagemagick.sh
vendored
Executable file
56
.github/actions/install-imagemagick/install-imagemagick.sh
vendored
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local install_command
|
||||||
|
if ! install_command=$(get_install_command); then
|
||||||
|
fatal_error 'Could not find available command to install'
|
||||||
|
fi
|
||||||
|
if ! eval "$install_command"; then
|
||||||
|
echo "Failed to install ImageMagick. Command: ${install_command}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo 'ImageMagick installation completed successfully'
|
||||||
|
}
|
||||||
|
|
||||||
|
get_install_command() {
|
||||||
|
case "$OSTYPE" in
|
||||||
|
darwin*)
|
||||||
|
ensure_command_exists 'brew'
|
||||||
|
echo 'brew install imagemagick'
|
||||||
|
;;
|
||||||
|
linux-gnu*)
|
||||||
|
if is_ubuntu; then
|
||||||
|
ensure_command_exists 'apt'
|
||||||
|
echo 'sudo apt install -y imagemagick'
|
||||||
|
else
|
||||||
|
fatal_error 'Unsupported Linux distribution'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
msys*|cygwin*)
|
||||||
|
ensure_command_exists 'choco'
|
||||||
|
echo 'choco install -y imagemagick'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fatal_error "Unsupported operating system: $OSTYPE"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_command_exists() {
|
||||||
|
local -r command="$1"
|
||||||
|
if ! command -v "$command" >/dev/null 2>&1; then
|
||||||
|
fatal_error "Command missing: $command"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal_error() {
|
||||||
|
local -r error_message="$1"
|
||||||
|
>&2 echo "❌ $error_message"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
is_ubuntu() {
|
||||||
|
[ -f /etc/os-release ] && grep -qi 'ubuntu' /etc/os-release
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
@@ -26,6 +26,9 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Install dependencies
|
name: Install dependencies
|
||||||
uses: ./.github/actions/npm-install-dependencies
|
uses: ./.github/actions/npm-install-dependencies
|
||||||
|
-
|
||||||
|
name: Install ImageMagick # For screenshots
|
||||||
|
uses: ./.github/actions/install-imagemagick
|
||||||
-
|
-
|
||||||
name: Configure Ubuntu
|
name: Configure Ubuntu
|
||||||
if: contains(matrix.os, 'ubuntu') # macOS runner is missing Docker
|
if: contains(matrix.os, 'ubuntu') # macOS runner is missing Docker
|
||||||
@@ -56,9 +59,6 @@ jobs:
|
|||||||
sudo Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
sudo Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
||||||
echo "DISPLAY=:99" >> $GITHUB_ENV
|
echo "DISPLAY=:99" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Install ImageMagick for screenshots
|
|
||||||
sudo apt install -y imagemagick
|
|
||||||
|
|
||||||
# Install xdotool and xprop (from x11-utils) for window title capturing
|
# Install xdotool and xprop (from x11-utils) for window title capturing
|
||||||
sudo apt install -y xdotool x11-utils
|
sudo apt install -y xdotool x11-utils
|
||||||
-
|
-
|
||||||
|
|||||||
5
.github/workflows/checks.scripts.yaml
vendored
5
.github/workflows/checks.scripts.yaml
vendored
@@ -16,9 +16,8 @@ jobs:
|
|||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Install ImageMagick on macOS
|
name: Install ImageMagick
|
||||||
if: matrix.os == 'macos'
|
uses: ./.github/actions/install-imagemagick
|
||||||
run: brew install imagemagick
|
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
Reference in New Issue
Block a user