From b4108874b843476fabb91a2ef551122fb906b59f Mon Sep 17 00:00:00 2001 From: Formasitchijoh Date: Tue, 14 Jan 2025 14:39:43 +0100 Subject: [PATCH 1/2] Fix ImageMagick compatibility for Paperclip by installing imagemagick in CI, creating symlinks, updating paths, and caching binaries --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95f823c302..70a332604a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,32 @@ jobs: with: pandoc-version: '2.9.2.1' + - name: install ImageMagick + uses: mfinelli/setup-imagemagick@v6 + with: + cache: true + + # Cache ImageMagick binaries + - 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 + + # Update PATH for ImageMagick + - name: Update PATH for ImageMagick + run: echo "/home/runner/bin" >> $GITHUB_PATH + + - name: Create symlink for identify and convert + run: | + for cmd in identify convert; do + if ! [ -x "$(command -v $cmd)" ]; then + sudo ln -s $(which magick) /usr/bin/$cmd + fi + done + - name: setup Redis uses: supercharge/redis-github-action@1.4.0 @@ -91,4 +117,4 @@ jobs: if-no-files-found: ignore - name: Ruby linting - run: bundle exec rubocop + run: bundle exec rubocop \ No newline at end of file From fc684e220b616df57086b23963df2b8ef0424b91 Mon Sep 17 00:00:00 2001 From: Formasitchijoh Date: Tue, 14 Jan 2025 14:42:55 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Set=20Paperclip=E2=80=99s=20command=20path?= =?UTF-8?q?=20to=20/usr/bin=20in=20test=20environment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/environments/test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/environments/test.rb b/config/environments/test.rb index 086d2a3ccc..3900247e72 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -54,6 +54,8 @@ def dump_js_coverage # Settings specified here will take # precedence over those in config/application.rb. + Paperclip.options[:command_path] = "/usr/bin" + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped