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

Fix: integrated imagemagick into github workflow and resolved the cou… #6116

Conversation

Formasitchijoh
Copy link
Contributor

@Formasitchijoh Formasitchijoh commented Jan 14, 2025

What this PR does

This pull request resolves a compatibility issue with ImageMagick in the CI workflow, which caused the error: Paperclip::Errors::CommandNotFoundError: Could not run the 'identify' command. Please install ImageMagick.

Issue:

kt-paperclip expected separate binaries for identify and convert, but recent versions of ImageMagick consolidate these tools into the magick command. Additionally, the location of the magick binary was not where Paperclip expected.

Changes Made

To address the issue and ensure that kt-paperclip works with the latest version of ImageMagick, I implemented the following changes:

  • Installed ImageMagick: I installed the required version of ImageMagick on the system to ensure that Paperclip has access to the necessary tools.

  • Created Symlinks for identify and convert:
    Since Paperclip calls identify and convert, I created symlinks for these commands that point to the magick binary. This allows Paperclip to use magick in place of the older separate identify and convert binaries
    for cmd in identify convert; do if ! [ -x "$(command -v $cmd)" ]; then sudo ln -s $(which magick) /usr/bin/$cmd fi done

  • Cached ImageMagick Binary:
    To speed up subsequent builds and avoid re-downloading ImageMagick each time, I added caching for the ImageMagick binary:
    - name: Cache Latest ImageMagick uses: actions/cache@v3 with: path: /home/runner/bin/magick key: ${{ runner.os }}-imagemagick-latest restore-keys: | ${{ runner.os }}-imagemagick-latest

  • Updated Path for ImageMagick:
    To ensure that the system recognizes the location of ImageMagick binaries, I updated the system path to include the directory where magick is located (/home/runner/bin).

- name: Update PATH for ImageMagick run: echo "/home/runner/bin" >> $GITHUB_PATH

  • Updated Paperclip’s Command Path:
    I explicitly configured Paperclip to look for ImageMagick commands in /usr/bin, where the symlinks for identify and convert are located.

Paperclip.options[:command_path] = "/usr/bin"

These changes ensure Paperclip functions correctly with the latest ImageMagick version, using the consolidated magick binary, and improve build efficiency by caching the binary

@Formasitchijoh Formasitchijoh force-pushed the @fix/imagemagick-failure branch from e0c1a5d to 98d7ca2 Compare January 14, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant