From 49c7cd089037a6eb2ca78f919ef0e51f40477118 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sat, 18 Jan 2025 16:35:21 +0100 Subject: [PATCH] Fix/GitHub workflow (#1423) Switch back to Ubuntu 22 and pull in imagick via action instead of installing manually. --- .github/workflows/run-tests.yml | 30 +++++++----------------------- tests/BaseTestCase.php | 5 ++++- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7fdf0fbd4..0b1498738 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -4,13 +4,12 @@ on: [ push, pull_request ] jobs: run: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: php: [ '8.1', '8.2', '8.3', '8.4' ] imagemagick: [ '6.9.12-55', '7.1.1-32' ] - imagick: [ '3.7.0' ] stability: [ prefer-stable ] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ImageMagick ${{ matrix.imagemagick }} @@ -19,13 +18,6 @@ jobs: - name: Checkout project uses: actions/checkout@v4 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: mbstring, gd - coverage: none - - name: Prepare environment for Imagemagick run: | sudo apt-get -y remove imagemagick imagemagick-6-common libmagic-dev @@ -60,20 +52,12 @@ jobs: 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: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mbstring, gd, imagick + coverage: none - name: Get composer cache directory id: composer-cache diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 7a083c400..2010d474d 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -112,7 +112,10 @@ protected function assertMediaType(string|array $allowed, string|EncodedImage $i fclose($pointer); $allowed = is_string($allowed) ? [$allowed] : $allowed; - $this->assertTrue(in_array($detected, $allowed)); + $this->assertTrue( + in_array($detected, $allowed), + 'Detected media type "' . $detected . '" is not: ' . join(', ', $allowed), + ); } protected function assertMediaTypeBitmap(string|EncodedImage $input): void