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

Adopt Ubuntu 24.04 image in GitHub Actions test workflow #161

Open
Stormheg opened this issue Jan 28, 2025 · 3 comments
Open

Adopt Ubuntu 24.04 image in GitHub Actions test workflow #161

Stormheg opened this issue Jan 28, 2025 · 3 comments

Comments

@Stormheg
Copy link
Member

GitHub Actions is transitioning to a new runner image based on Ubuntu 24.04. When this image is used, the testsuite fails because there are issues with the Wand / ImageMagick integration. Expand the details below to see a full copy of the test log from GitHub Actions.

All our previous runs were using the Ubuntu 22.04 runner which had no issues.

 Image: ubuntu-24.04
 Version: 20250105.1.0
 Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250105.1/images/ubuntu/Ubuntu2404-Readme.md
 Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250105.1
Run coverage run --parallel-mode -m runtests

/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/coverage/core.py:70: CoverageWarning: sys.monitoring isn't available, using default core (no-sysmon)
  warn("sys.monitoring isn't available, using default core", slug="no-sysmon")
...............................................................................................................x............x..................................xx........x........................................E...x....x...EE..F.......
======================================================================
ERROR: test_save_as_avif (tests.test_wand.TestWandOperations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/Willow/Willow/tests/test_wand.py", line 310, in test_save_as_avif
    return_value = self.image.save_as_avif(output)
  File "/home/runner/work/Willow/Willow/willow/plugins/wand.py", line 274, in save_as_avif
    converted.save(file=f)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wand/image.py", line 10202, in save
    file.write(self.make_blob())
TypeError: a bytes-like object is required, not 'NoneType'

======================================================================
ERROR: test_save_avif_lossless (tests.test_wand.TestWandOperations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/Willow/Willow/tests/test_wand.py", line 327, in test_save_avif_lossless
    lossless_file = self.image.save_as_avif(io.BytesIO(), lossless=True)
  File "/home/runner/work/Willow/Willow/willow/plugins/wand.py", line 274, in save_as_avif
    converted.save(file=f)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wand/image.py", line 10202, in save
    file.write(self.make_blob())
TypeError: a bytes-like object is required, not 'NoneType'

======================================================================
ERROR: test_save_avif_quality (tests.test_wand.TestWandOperations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/Willow/Willow/tests/test_wand.py", line 319, in test_save_avif_quality
    high_quality = self.image.save_as_avif(io.BytesIO(), quality=90)
  File "/home/runner/work/Willow/Willow/willow/plugins/wand.py", line 274, in save_as_avif
    converted.save(file=f)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/wand/image.py", line 10202, in save
    file.write(self.make_blob())
TypeError: a bytes-like object is required, not 'NoneType'

======================================================================
FAIL: test_save_webp_quality (tests.test_wand.TestWandOperations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/Willow/Willow/tests/test_wand.py", line 380, in test_save_webp_quality
    self.assertTrue(low_quality.f.tell() < high_quality.f.tell())
AssertionError: False is not true

We must figure out what difference is causing the issue so we can adopt the Ubuntu 24.04 image. I already know the 24.04 image does not have ImageMagick installed by default, but apt install imagemagick results in the testsuite failure above.

Fortunately, the folks at GitHub have quite good documentation about what's installed in their images. Might be helpful.

See also #160

@joelwilliam2005
Copy link

joelwilliam2005 commented Jan 29, 2025

I tried to install imagemagick on ubuntu 24.04 using docker.
Commands:

apt update
apt install libpng-dev libjpeg-dev libtiff-dev
apt install imagemagick

Here,

which magick , magick --version

return none.
There is no executable for it.

However convert can be accessed, which is also a cli tool for imagemagick which was replaced by magick command.

convert --version returns:

Version: ImageMagick 6.9.12-98 Q16 x86_64 18038 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib

A fix I had thought would've been to create a symlink.

sudo ln -s /usr/bin/convert /usr/bin/magick

This makes magick command usable but still gave no signs of solving the issue. I think the issue lies in Willow accessing imagemagick using magick command.

Adding some references that I used:

@zerolab
Copy link
Collaborator

zerolab commented Jan 29, 2025

We're accessing imagemagick via Wand which provides the ctype bindings for Python.

@joelwilliam2005
Copy link

joelwilliam2005 commented Feb 1, 2025

I was able to reproduce the issue on ubuntu 24.04 docker container, can't seem to find the root cause.

Image

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

No branches or pull requests

3 participants