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

Reproduce exception #1402

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from
76 changes: 2 additions & 74 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request ]

jobs:
run:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
Expand All @@ -23,86 +23,14 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, gd
extensions: mbstring, gd, imagick
coverage: none

- name: Prepare environment for Imagemagick
run: |
sudo apt-get -y remove imagemagick imagemagick-6-common libmagic-dev
sudo apt-get update
sudo apt-get install -y libjpeg-dev libgif-dev libtiff-dev libpng-dev libwebp-dev libavif-dev libheif-dev
sudo apt-get install -y libmagickwand-dev

- name: Cache ImageMagick
uses: actions/cache@v4
id: cache-imagemagick
with:
path: /home/runner/im/imagemagick-${{ matrix.imagemagick }}
key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }}-

- name: Check ImageMagick cache exists
uses: andstor/file-existence-action@v3
id: cache-imagemagick-exists
with:
files: /home/runner/im/imagemagick-${{ matrix.imagemagick }}

- name: Install ImageMagick
if: ( steps.cache-imagemagick.outputs.cache-hit != 'true' || steps.cache-imagemagick-exists.outputs.files_exists != 'true' )
run: |
curl -o /tmp/ImageMagick.tar.xz -sL https://imagemagick.org/archive/releases/ImageMagick-${{ matrix.imagemagick }}.tar.xz
(
cd /tmp || exit 1
tar xf ImageMagick.tar.xz
cd ImageMagick-${{ matrix.imagemagick }}
sudo ./configure --prefix=/home/runner/im/imagemagick-${{ matrix.imagemagick }}
sudo make -j$(nproc)
sudo make install
)

- name: Install PHP ImageMagick extension
run: |
curl -o /tmp/imagick.tgz -sL http://pecl.php.net/get/imagick-${{ matrix.imagick }}.tgz
(
cd /tmp || exit 1
tar -xzf imagick.tgz
cd imagick-${{ matrix.imagick }}
phpize
sudo ./configure --with-imagick=/home/runner/im/imagemagick-${{ matrix.imagemagick }}
sudo make -j$(nproc)
sudo make install
)
sudo bash -c 'echo "extension=imagick.so" >> /etc/php/${{ matrix.php }}/cli/php.ini'
php --ri imagick;

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.stability }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.stability }}-

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: GD Version
run: php -r 'var_dump(gd_info());'

- name: Imagick Version
run: php -r 'var_dump(Imagick::getVersion());'

- name: Supported Imagick Formats
run: php -r 'var_dump(Imagick::queryFormats());'

- name: Execute tests
run: vendor/bin/phpunit --no-coverage

- name: Run analyzer
run: vendor/bin/phpstan

- name: Validate coding standards
run: vendor/bin/phpcs
3 changes: 0 additions & 3 deletions phpunit.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
<testsuite name="Unit Tests">
<directory suffix=".php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature Tests">
<directory suffix=".php">./tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Imagick/Decoders/FilePointerImageDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FilePointerImageDecoder extends BinaryImageDecoder
public function decode(mixed $input): ImageInterface|ColorInterface
{
if (!is_resource($input) || !in_array(get_resource_type($input), ['file', 'stream'])) {
throw new DecoderException('Unable to decode input');
throw new DecoderException('Input is no file pointer resource.');
}

$contents = '';
Expand Down
22 changes: 0 additions & 22 deletions tests/Feature/Gd/ConvertPngGif.php

This file was deleted.

22 changes: 0 additions & 22 deletions tests/Feature/Imagick/ConvertPngGif.php

This file was deleted.

180 changes: 0 additions & 180 deletions tests/Unit/CollectionTest.php

This file was deleted.

Loading
Loading