From 70a9a556a51b936fb7a305956fa93758d2e01e86 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:00:58 +0300 Subject: [PATCH 01/36] Update run-tests.yml update the name. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5d7ae107..81bd9705 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,4 @@ -name: run-tests +name: Tests on: [push] From d52630338b694808ce7e9ad1cbb50db799acdcd5 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:01:51 +0300 Subject: [PATCH 02/36] Update run-tests.yml add run on pull requests. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 81bd9705..3ccb0557 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,6 +1,6 @@ name: Tests -on: [push] +on: [push, pull_request] jobs: run: From 47d0ada7d49612dd25e767b5e57cbf664949d0f9 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:02:49 +0300 Subject: [PATCH 03/36] Update run-tests.yml add the fail fast key. --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3ccb0557..d86d55e6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,6 +6,7 @@ jobs: run: runs-on: ubuntu-latest strategy: + fail-fast: true matrix: php-versions: ['8.0'] name: Testing on PHP ${{ matrix.php-versions }} From 488f82398745a723148668038b225b4d20b807c2 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:03:13 +0300 Subject: [PATCH 04/36] Update run-tests.yml update matrix with php and stability keys. --- .github/workflows/run-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d86d55e6..42f001eb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,9 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['8.0'] + php: [ 8.0, 8.1 ] + stability: [ prefer-lowest, prefer-stable ] + name: Testing on PHP ${{ matrix.php-versions }} steps: - name: 'Checkout Project' From 2395773bb64482e3e94a16c912c38d7d4b5b9d08 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:03:40 +0300 Subject: [PATCH 05/36] Update run-tests.yml update the name key. --- .github/workflows/run-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 42f001eb..7227ecfe 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,7 +11,8 @@ jobs: php: [ 8.0, 8.1 ] stability: [ prefer-lowest, prefer-stable ] - name: Testing on PHP ${{ matrix.php-versions }} + name: P${{ matrix.php }} - ${{ matrix.stability }} + steps: - name: 'Checkout Project' uses: actions/checkout@v2 From d1caaadfa5b1a474051b00881be4d62d8ee0a2d4 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:06:02 +0300 Subject: [PATCH 06/36] Update run-tests.yml update the checkout block. --- .github/workflows/run-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7227ecfe..ca59e66f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,8 +14,9 @@ jobs: name: P${{ matrix.php }} - ${{ matrix.stability }} steps: - - name: 'Checkout Project' + - name: Checkout project uses: actions/checkout@v2 + - name: 'Setup Environment' uses: shivammathur/setup-php@v2 with: From 896a57a891b816c1d70cc7ba6bb5be6b89a65a0c Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:06:50 +0300 Subject: [PATCH 07/36] Update run-tests.yml update the setup block. --- .github/workflows/run-tests.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ca59e66f..35bded2d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,12 +17,13 @@ jobs: - name: Checkout project uses: actions/checkout@v2 - - name: 'Setup Environment' + - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} - extensions: imagick,gd - tools: phpunit,composer + php-version: ${{ matrix.php }} + extensions: mbstring, gd, imagick + coverage: none + - name: 'Install Dependencies' run: composer install -o -q - name: 'Run PHPUnit' From dce69bad28063f410c0d0966852ac358bf6c0777 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:07:20 +0300 Subject: [PATCH 08/36] Update run-tests.yml update the install dependencies block. --- .github/workflows/run-tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 35bded2d..cc6ce83b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,7 +24,8 @@ jobs: extensions: mbstring, gd, imagick coverage: none - - name: 'Install Dependencies' - run: composer install -o -q + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: 'Run PHPUnit' - run: vendor/bin/phpunit \ No newline at end of file + run: vendor/bin/phpunit From b19697b67cd7b8d4c3b63fa7edaba1a4892de472 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:10:57 +0300 Subject: [PATCH 09/36] Update run-tests.yml update the execute block. --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cc6ce83b..9f8012c4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,5 +27,5 @@ jobs: - name: Install dependencies run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - - name: 'Run PHPUnit' - run: vendor/bin/phpunit + - name: Execute tests + run: vendor/bin/phpunit --no-coverage From 0846dd592d103bb23a738084b0afb1132eaab982 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:22:53 +0300 Subject: [PATCH 10/36] Update CanCreateImagickTestImage.php fix the create with decoder method name. --- tests/Traits/CanCreateImagickTestImage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Traits/CanCreateImagickTestImage.php b/tests/Traits/CanCreateImagickTestImage.php index 0ff42675..c097c50e 100644 --- a/tests/Traits/CanCreateImagickTestImage.php +++ b/tests/Traits/CanCreateImagickTestImage.php @@ -11,12 +11,12 @@ trait CanCreateImagickTestImage { public function createTestImage($filename = 'test.jpg'): Image { - return $this->testImageDecoder()->handle( + return $this->createWithImageDecoder()->handle( sprintf('%s/../images/%s', __DIR__, $filename) ); } - protected function testImageDecoder(): FilePathImageDecoder + protected function createWithImageDecoder(): FilePathImageDecoder { return new FilePathImageDecoder(); } From 8a4f8e40c508708f841ea4fd59a0b9301c7f13a2 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:23:44 +0300 Subject: [PATCH 11/36] Update CanCreateGdTestImage.php fix the create with decoder method name. --- tests/Traits/CanCreateGdTestImage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Traits/CanCreateGdTestImage.php b/tests/Traits/CanCreateGdTestImage.php index e2e5d81a..9d12ed2b 100644 --- a/tests/Traits/CanCreateGdTestImage.php +++ b/tests/Traits/CanCreateGdTestImage.php @@ -21,7 +21,7 @@ trait CanCreateGdTestImage public function createTestImage($filename = 'test.jpg'): Image { - return $this->testImageDecoder()->handle( + return $this->createWithImageDecoder()->handle( $this->getTestImagePath($filename) ); } @@ -41,7 +41,7 @@ trait CanCreateGdTestImage ])); } - protected function testImageDecoder(): FilePathImageDecoder + protected function createWithImageDecoder(): FilePathImageDecoder { return new FilePathImageDecoder(); } From 66af2ff050d850317fc1869bd11ca64a74983c4f Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 02:25:05 +0300 Subject: [PATCH 12/36] Update run-tests.yml add cache composer dependencies. --- .github/workflows/run-tests.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9f8012c4..f3bd3eb8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -24,6 +24,17 @@ jobs: extensions: mbstring, gd, imagick coverage: none + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + 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 From 2dc7f019c228ba56ab444278c4600287a40e32a2 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 09:52:05 +0300 Subject: [PATCH 13/36] Update Update run-tests.yml update the fail fast key. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f3bd3eb8..d68dce9e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,7 +6,7 @@ jobs: run: runs-on: ubuntu-latest strategy: - fail-fast: true + fail-fast: false matrix: php: [ 8.0, 8.1 ] stability: [ prefer-lowest, prefer-stable ] From 9bf8840318a5ba46096beb75105ab2e7398fd021 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 10:43:15 +0300 Subject: [PATCH 14/36] Add phpunit.xml.dist file. --- phpunit.xml.dist | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 phpunit.xml.dist diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..63454441 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + ./tests/ + + + + + + src + + + From 30980a24c8b4275ac0d2c475f4fadf4405609461 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 10:44:02 +0300 Subject: [PATCH 15/36] Update .gitignore add build folder pattern. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 95483750..8367435f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.idea/ +build/ +vendor/ .DS_Store composer.lock vendor/ From 428d98241dcea45a0d43622748ad354a0f93aa01 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 10:44:25 +0300 Subject: [PATCH 16/36] Update .gitignore add phpunit.xml pattern. --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8367435f..3e4ac796 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,4 @@ build/ vendor/ .DS_Store composer.lock -vendor/ -.idea/ -.phpunit.result.cache \ No newline at end of file +phpunit.xml From e69b01dfe8fcffffcf56ee3fb5017cc25b9e6e3f Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 10:45:41 +0300 Subject: [PATCH 17/36] Update .gitignore add .phpunit.result pattern. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3e4ac796..c7fe04e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ build/ vendor/ .DS_Store +.phpunit.result.cache composer.lock phpunit.xml From ca2a3c7d9fb6946eb9429efa405dae3431a6c6a5 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 15:52:39 +0300 Subject: [PATCH 18/36] Style FitModifier.php fix a typo in the comment. --- src/Drivers/Gd/Modifiers/FitModifier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Drivers/Gd/Modifiers/FitModifier.php b/src/Drivers/Gd/Modifiers/FitModifier.php index 194376a5..0278416e 100644 --- a/src/Drivers/Gd/Modifiers/FitModifier.php +++ b/src/Drivers/Gd/Modifiers/FitModifier.php @@ -65,7 +65,7 @@ class FitModifier extends AbstractFitModifier implements ModifierInterface imagedestroy($current); - // set new content as recource + // set new content as resource $frame->setCore($modified); } } From b626022fa77016fc64d50ce2a156dd3b9241a61c Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Wed, 23 Mar 2022 16:11:38 +0300 Subject: [PATCH 19/36] Update GD\Color.php update transparency extraction. --- src/Drivers/Gd/Color.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Drivers/Gd/Color.php b/src/Drivers/Gd/Color.php index 46904b37..d4cde720 100644 --- a/src/Drivers/Gd/Color.php +++ b/src/Drivers/Gd/Color.php @@ -34,7 +34,7 @@ class Color extends AbstractColor implements ColorInterface public function toArray(): array { - $a = ($this->value >> 24) & 0xFF; + $a = ($this->value >> 24) & 0x7F; $r = ($this->value >> 16) & 0xFF; $g = ($this->value >> 8) & 0xFF; $b = $this->value & 0xFF; From adffed38814b80a7c6393c21851a8d73ee44f197 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Thu, 24 Mar 2022 01:53:37 +0300 Subject: [PATCH 20/36] Update GD\ResizeModifier.php add transparency restore to pass the tests. --- src/Drivers/Gd/Modifiers/ResizeModifier.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Drivers/Gd/Modifiers/ResizeModifier.php b/src/Drivers/Gd/Modifiers/ResizeModifier.php index b030a8e3..7646a22f 100644 --- a/src/Drivers/Gd/Modifiers/ResizeModifier.php +++ b/src/Drivers/Gd/Modifiers/ResizeModifier.php @@ -44,15 +44,14 @@ class ResizeModifier implements ModifierInterface $current = $frame->getCore(); // preserve transparency + imagealphablending($modified, false); $transIndex = imagecolortransparent($current); if ($transIndex != -1) { $rgba = imagecolorsforindex($modified, $transIndex); $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127); imagefill($modified, 0, 0, $transColor); - imagecolortransparent($modified, $transColor); } else { - imagealphablending($modified, false); imagesavealpha($modified, true); } @@ -72,6 +71,22 @@ class ResizeModifier implements ModifierInterface imagedestroy($current); + if ($transIndex != -1) { // @todo refactor because of duplication + imagecolortransparent($modified, $transIndex); + for ($y = 0; $y < $resizeTo->getHeight(); ++$y) { + for ($x = 0; $x < $resizeTo->getWidth(); ++$x) { + if (((imagecolorat($modified, $x, $y) >> 24) & 0x7F) >= 100) { + imagesetpixel( + $modified, + $x, + $y, + $transIndex + ); + } + } + } + } + // set new content as recource $frame->setCore($modified); } From ad0ad160420ac1a441b20c8c38e69f1b9457cbc6 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Thu, 24 Mar 2022 01:54:13 +0300 Subject: [PATCH 21/36] Update GD\FitModifier.php add transparency restore to pass the tests. --- src/Drivers/Gd/Modifiers/FitModifier.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Drivers/Gd/Modifiers/FitModifier.php b/src/Drivers/Gd/Modifiers/FitModifier.php index 0278416e..de0e9725 100644 --- a/src/Drivers/Gd/Modifiers/FitModifier.php +++ b/src/Drivers/Gd/Modifiers/FitModifier.php @@ -37,15 +37,14 @@ class FitModifier extends AbstractFitModifier implements ModifierInterface $current = $frame->getCore(); // preserve transparency + imagealphablending($modified, false); $transIndex = imagecolortransparent($current); if ($transIndex != -1) { $rgba = imagecolorsforindex($modified, $transIndex); $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127); imagefill($modified, 0, 0, $transColor); - imagecolortransparent($modified, $transColor); } else { - imagealphablending($modified, false); imagesavealpha($modified, true); } @@ -65,6 +64,22 @@ class FitModifier extends AbstractFitModifier implements ModifierInterface imagedestroy($current); + if ($transIndex != -1) { // @todo refactor because of duplication + imagecolortransparent($modified, $transIndex); + for ($y = 0; $y < $resize->getHeight(); ++$y) { + for ($x = 0; $x < $resize->getWidth(); ++$x) { + if (((imagecolorat($modified, $x, $y) >> 24) & 0x7F) >= 100) { + imagesetpixel( + $modified, + $x, + $y, + $transIndex + ); + } + } + } + } + // set new content as resource $frame->setCore($modified); } From 161a3229496de8df9e836e4c573830977c50969a Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Thu, 24 Mar 2022 01:59:46 +0300 Subject: [PATCH 22/36] Fix SizeInterface.php add the resize method to fit ResizeModifier usage. --- src/Interfaces/SizeInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Interfaces/SizeInterface.php b/src/Interfaces/SizeInterface.php index 0e8ea82d..fd641fbe 100644 --- a/src/Interfaces/SizeInterface.php +++ b/src/Interfaces/SizeInterface.php @@ -9,6 +9,7 @@ interface SizeInterface public function getPivot(): PointInterface; public function setWidth(int $width): SizeInterface; public function setHeight(int $height): SizeInterface; + public function resize(?int $width = null, ?int $height = null): SizeInterface; public function getAspectRatio(): float; public function fitsInto(SizeInterface $size): bool; public function isLandscape(): bool; From decdbd0bfa6b9df16228c55421563a7a574ef358 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Thu, 24 Mar 2022 02:19:46 +0300 Subject: [PATCH 23/36] Update run-tests.yml some experiments. --- .github/workflows/run-tests.yml | 62 +++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d68dce9e..57136c65 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,9 +6,16 @@ jobs: run: runs-on: ubuntu-latest strategy: - fail-fast: false + fail-fast: true matrix: - php: [ 8.0, 8.1 ] + php: [ '8.0', '8.1' ] + imagemagick: [ + '6.9.12-43', + '7.1.0-28' + ] + imagick: [ + '3.7.0' + ] stability: [ prefer-lowest, prefer-stable ] name: P${{ matrix.php }} - ${{ matrix.stability }} @@ -21,9 +28,55 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: mbstring, gd, imagick + extensions: mbstring, gd coverage: none + - name: Prepare environament for Imagemagick + run: | + sudo apt-get -y remove imagemagick imagemagick-6-common libmagic-dev + sudo apt-get update + sudo apt-get install -y libjpeg62-dev + sudo apt-get install -y libgif-dev + sudo apt-get install -y libtiff-dev + sudo apt-get install -y libpng-dev + sudo apt-get install -y libwebp-dev + sudo apt-get install -y libmagickwand-dev + + - name: Cache ImageMagick + uses: actions/cache@v2 + env: + cache-name: cache-ImageMagick + with: + path: ~/im/imagemagick-${{ matrix.imagemagick }} + key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }} + + - name: Install ImageMagick + run: | + curl -o /tmp/ImageMagick.tar.gz -sL https://www.imagemagick.org/download/ImageMagick-${{ matrix.imagemagick }}.tar.gz + ( + cd /tmp || exit 1 + tar xf ImageMagick.tar.gz + cd ImageMagick-${{ matrix.imagemagick }} + sudo ./configure --prefix=/opt/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=/opt/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 "::set-output name=dir::$(composer config cache-files-dir)" @@ -38,5 +91,8 @@ jobs: - name: Install dependencies run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: Which Imagick Version + run: php -r 'var_dump(Imagick::getVersion());' + - name: Execute tests run: vendor/bin/phpunit --no-coverage From d959e37d89edec25130b9c97de8be73d193044c2 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 10:55:07 +0300 Subject: [PATCH 24/36] Update run-tests.yml rename imagemagick cache name. --- .github/workflows/run-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 57136c65..81c04811 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -44,8 +44,7 @@ jobs: - name: Cache ImageMagick uses: actions/cache@v2 - env: - cache-name: cache-ImageMagick + id: cache-imagemagick with: path: ~/im/imagemagick-${{ matrix.imagemagick }} key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }} From 80dcb4cbd1d5c539ecbd74100349c4235994ab72 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 10:56:26 +0300 Subject: [PATCH 25/36] Update run-tests.yml style file. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 81c04811..455ee966 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,6 +1,6 @@ name: Tests -on: [push, pull_request] +on: [ push, pull_request ] jobs: run: From e988c46b6fe9b10993cfa20500ffca71192d31ac Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 10:56:55 +0300 Subject: [PATCH 26/36] Update run-tests.yml update the fail fast key. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 455ee966..abd92511 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,7 +6,7 @@ jobs: run: runs-on: ubuntu-latest strategy: - fail-fast: true + fail-fast: false matrix: php: [ '8.0', '8.1' ] imagemagick: [ From 81c9b6be7fec5e3850a4760431f2929e1a540d3d Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:08:41 +0300 Subject: [PATCH 27/36] Update run-tests.yml change the configure path. --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index abd92511..ece51ac4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -56,7 +56,7 @@ jobs: cd /tmp || exit 1 tar xf ImageMagick.tar.gz cd ImageMagick-${{ matrix.imagemagick }} - sudo ./configure --prefix=/opt/imagemagick + sudo ./configure --prefix=~/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) @@ -69,7 +69,7 @@ jobs: tar -xzf imagick.tgz cd imagick-${{ matrix.imagick }} phpize - sudo ./configure --with-imagick=/opt/imagemagick + sudo ./configure --with-imagick=~/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) From d2b1cfe00f379b4ac200247cbc8d9f79c2dbc1b8 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:11:32 +0300 Subject: [PATCH 28/36] Update run-tests.yml add cache hit check. --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ece51ac4..76543ad3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,6 +50,7 @@ jobs: key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }} - name: Install ImageMagick + if: steps.cache-imagemagick.outputs.cache-hit != 'true' run: | curl -o /tmp/ImageMagick.tar.gz -sL https://www.imagemagick.org/download/ImageMagick-${{ matrix.imagemagick }}.tar.gz ( From 3fbce7577f5f44bdfc7c3ce548e81715811fc3cd Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:19:57 +0300 Subject: [PATCH 29/36] Fix run-tests.yml update the configure path absolute. --- .github/workflows/run-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 76543ad3..740bf49e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -46,7 +46,7 @@ jobs: uses: actions/cache@v2 id: cache-imagemagick with: - path: ~/im/imagemagick-${{ matrix.imagemagick }} + path: ${HOME}/im/imagemagick-${{ matrix.imagemagick }} key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }} - name: Install ImageMagick @@ -57,7 +57,7 @@ jobs: cd /tmp || exit 1 tar xf ImageMagick.tar.gz cd ImageMagick-${{ matrix.imagemagick }} - sudo ./configure --prefix=~/im/imagemagick-${{ matrix.imagemagick }} + sudo ./configure --prefix=${HOME}/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) @@ -70,7 +70,7 @@ jobs: tar -xzf imagick.tgz cd imagick-${{ matrix.imagick }} phpize - sudo ./configure --with-imagick=~/im/imagemagick-${{ matrix.imagemagick }} + sudo ./configure --with-imagick=${HOME}/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) From e2107fa351bdc8714e4e567469f8178928c57a72 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:28:25 +0300 Subject: [PATCH 30/36] Update run-tests.yml style file. --- .github/workflows/run-tests.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 740bf49e..e456c2ee 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,13 +9,8 @@ jobs: fail-fast: false matrix: php: [ '8.0', '8.1' ] - imagemagick: [ - '6.9.12-43', - '7.1.0-28' - ] - imagick: [ - '3.7.0' - ] + imagemagick: [ '6.9.12-43', '7.1.0-28' ] + imagick: [ '3.7.0' ] stability: [ prefer-lowest, prefer-stable ] name: P${{ matrix.php }} - ${{ matrix.stability }} From 64183b8379f3c8845cb4fe31a2a7856908e0db54 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:44:31 +0300 Subject: [PATCH 31/36] Update run-tests.yml update cache imagemagick section. --- .github/workflows/run-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e456c2ee..c2c6c787 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -42,7 +42,8 @@ jobs: id: cache-imagemagick with: path: ${HOME}/im/imagemagick-${{ matrix.imagemagick }} - key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }} + key: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }}-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-ImageMagick-${{ matrix.imagemagick }}- - name: Install ImageMagick if: steps.cache-imagemagick.outputs.cache-hit != 'true' From 4e63fb9eefd0ca60eafc5162384dcbab2a1a0e37 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:51:03 +0300 Subject: [PATCH 32/36] Update run-tests.yml improve prepare environment section. --- .github/workflows/run-tests.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c2c6c787..61b57807 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -30,11 +30,7 @@ jobs: run: | sudo apt-get -y remove imagemagick imagemagick-6-common libmagic-dev sudo apt-get update - sudo apt-get install -y libjpeg62-dev - sudo apt-get install -y libgif-dev - sudo apt-get install -y libtiff-dev - sudo apt-get install -y libpng-dev - sudo apt-get install -y libwebp-dev + sudo apt-get install -y libjpeg-dev libgif-dev libtiff-dev libpng-dev libwebp-dev sudo apt-get install -y libmagickwand-dev - name: Cache ImageMagick From 7cf7ef5e9ac1443b8aad4b8ebb7417bc2a518d76 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:51:51 +0300 Subject: [PATCH 33/36] Fix run-tests.yml fix a typo in the prepare environment section. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 61b57807..16124b98 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,7 +26,7 @@ jobs: extensions: mbstring, gd coverage: none - - name: Prepare environament for Imagemagick + - name: Prepare environment for Imagemagick run: | sudo apt-get -y remove imagemagick imagemagick-6-common libmagic-dev sudo apt-get update From 976b9ae09af5487c1985011b51dfed0e4acd048d Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 11:52:38 +0300 Subject: [PATCH 34/36] Update run-tests.yml add check of the cache folder. --- .github/workflows/run-tests.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 16124b98..49070540 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -37,19 +37,25 @@ jobs: uses: actions/cache@v2 id: cache-imagemagick with: - path: ${HOME}/im/imagemagick-${{ matrix.imagemagick }} + 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@v1 + id: cache-imagemagick-exists + with: + files: /home/runner/im/imagemagick-${{ matrix.imagemagick }} + - name: Install ImageMagick - if: steps.cache-imagemagick.outputs.cache-hit != 'true' + if: ( steps.cache-imagemagick.outputs.cache-hit != 'true' || steps.cache-imagemagick-exists.outputs.files_exists != 'true' ) run: | curl -o /tmp/ImageMagick.tar.gz -sL https://www.imagemagick.org/download/ImageMagick-${{ matrix.imagemagick }}.tar.gz ( cd /tmp || exit 1 tar xf ImageMagick.tar.gz cd ImageMagick-${{ matrix.imagemagick }} - sudo ./configure --prefix=${HOME}/im/imagemagick-${{ matrix.imagemagick }} + sudo ./configure --prefix=/home/runner/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) @@ -62,7 +68,7 @@ jobs: tar -xzf imagick.tgz cd imagick-${{ matrix.imagick }} phpize - sudo ./configure --with-imagick=${HOME}/im/imagemagick-${{ matrix.imagemagick }} + sudo ./configure --with-imagick=/home/runner/im/imagemagick-${{ matrix.imagemagick }} sudo make -j$(nproc) sudo make install ) From 7a8a02e8c885a602746d6130cffe641d9a2823ea Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 18:41:46 +0300 Subject: [PATCH 35/36] Update TestCase.php remove a redundant import. --- tests/TestCase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index d9b53621..8985b4e8 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,7 +3,6 @@ namespace Intervention\Image\Tests; use Intervention\Image\Interfaces\ColorInterface; -use PHPUnit\Framework\TestCase as PHPUnitTestCase; use Mockery\Adapter\Phpunit\MockeryTestCase; abstract class TestCase extends MockeryTestCase From e9655672aa624cb9128db5d9172f7ee450de24d6 Mon Sep 17 00:00:00 2001 From: Sergey Kudashev Date: Sat, 26 Mar 2022 18:43:26 +0300 Subject: [PATCH 36/36] Fix tests fix ModifierStackTest file name. --- tests/{ModiferStackTest.php => ModifierStackTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{ModiferStackTest.php => ModifierStackTest.php} (100%) diff --git a/tests/ModiferStackTest.php b/tests/ModifierStackTest.php similarity index 100% rename from tests/ModiferStackTest.php rename to tests/ModifierStackTest.php