From dbc6ed42abbd5264486a13b0b3345614aa9a73f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:10:24 +0000 Subject: [PATCH 01/11] Initial plan From e2a201afa2deb0ae5a745e26201a4938ea2eb25a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:15:12 +0000 Subject: [PATCH 02/11] Replace Makefile with Castor task runner Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- .gitignore | 4 ++++ CHANGELOG.md | 5 +++++ CONTRIBUTING.md | 4 ++-- Makefile | 18 ------------------ README.md | 21 +++++++++++++++++++++ castor.php | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 20 deletions(-) delete mode 100644 Makefile create mode 100644 castor.php diff --git a/.gitignore b/.gitignore index c366096..abcbcde 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ /composer.lock /vendor +# Castor +/castor +/.castor.stub.php + # Temporary /tests/app/var /tests/app/public/bundles diff --git a/CHANGELOG.md b/CHANGELOG.md index c86bcc6..d1f1dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changes between versions +## Unreleased + +* Replaced Makefile with Castor task runner +* Added development documentation for Castor + ## 1.10.0 (2026-02-03) * Added support for PHP 8.5 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f31da8c..f81ded0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ changes, improvements or alternatives may be given). Run the tests using the following script: ```shell -make test +castor test ``` ## Manual testing @@ -70,7 +70,7 @@ Use [PHP CS fixer](https://cs.symfony.com/) to make your code compliant with GifExceptionBundle's coding standards: ```shell -make cs +castor cs ``` ## Keeping your fork up-to-date diff --git a/Makefile b/Makefile deleted file mode 100644 index 85e0cbb..0000000 --- a/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -.PHONY: cs cs_dry_run test - -.DEFAULT_GOAL := help - -help: - @grep -h -e ' ## ' $(MAKEFILE_LIST) | fgrep -v fgrep | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}' - -cs: ## Fix PHP CS - vendor/bin/php-cs-fixer fix --verbose - -cs_dry_run: ## Test if PHP CS is correct - vendor/bin/php-cs-fixer fix --verbose --dry-run - -test: ## Run the test suite - vendor/bin/simple-phpunit - -phpstan: ## Run static analysis - vendor/bin/phpstan analyse -c phpstan.neon diff --git a/README.md b/README.md index 018e7de..8ca04f4 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,27 @@ Although it would probably make more sense to use the former and push up the opt It uses [gifsicle](https://www.lcdf.org/gifsicle/) to optimize gifs via the [image-optimizer](https://github.com/psliwa/image-optimizer) library. +## Development + +This project uses [Castor](https://castor.jolicode.com/) as a task runner for common development tasks. + +To install Castor, download the PHAR: + +```shell +curl -L https://github.com/jolicode/castor/releases/latest/download/castor.linux-amd64.phar -o castor +chmod +x castor +``` + +Available tasks: + +```shell +castor list # List all available tasks +castor test # Run the test suite +castor cs # Fix PHP coding standards +castor cs:dry-run # Check PHP coding standards +castor phpstan # Run static analysis +``` + ## Further documentation You can see the current and past versions using one of the following: diff --git a/castor.php b/castor.php new file mode 100644 index 0000000..162919b --- /dev/null +++ b/castor.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Castor\Attribute\AsTask; + +use function Castor\run; + +#[AsTask(description: 'Fix PHP CS')] +function cs(): void +{ + run('vendor/bin/php-cs-fixer fix --verbose'); +} + +#[AsTask(name: 'cs:dry-run', description: 'Test if PHP CS is correct')] +function cs_dry_run(): void +{ + run('vendor/bin/php-cs-fixer fix --verbose --dry-run'); +} + +#[AsTask(description: 'Run the test suite')] +function test(): void +{ + run('vendor/bin/simple-phpunit'); +} + +#[AsTask(description: 'Run static analysis')] +function phpstan(): void +{ + run('vendor/bin/phpstan analyse -c phpstan.neon'); +} From d471dd012c146284b77487db95b7a0301178e941 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:17:00 +0000 Subject: [PATCH 03/11] Improve Castor installation documentation with cross-platform info Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ca04f4..e61b904 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,16 @@ It uses [gifsicle](https://www.lcdf.org/gifsicle/) to optimize gifs via the [ima This project uses [Castor](https://castor.jolicode.com/) as a task runner for common development tasks. -To install Castor, download the PHAR: +To install Castor, download the PHAR (example for Linux AMD64): ```shell curl -L https://github.com/jolicode/castor/releases/latest/download/castor.linux-amd64.phar -o castor chmod +x castor ``` +> **Note:** For other platforms (macOS, Windows, ARM), see the [Castor installation documentation](https://castor.jolicode.com/getting-started/installation). +> You can either place the `castor` binary in your PATH (e.g., `/usr/local/bin/castor`) or keep it in the project root and run it as `./castor`. + Available tasks: ```shell From f08c4634cb3e384853d551405af490311b4e009e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:19:39 +0000 Subject: [PATCH 04/11] Simplify README to only link to Castor installation docs Co-authored-by: pyrech <2021641+pyrech@users.noreply.github.com> --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index e61b904..a322a7f 100644 --- a/README.md +++ b/README.md @@ -53,15 +53,7 @@ It uses [gifsicle](https://www.lcdf.org/gifsicle/) to optimize gifs via the [ima This project uses [Castor](https://castor.jolicode.com/) as a task runner for common development tasks. -To install Castor, download the PHAR (example for Linux AMD64): - -```shell -curl -L https://github.com/jolicode/castor/releases/latest/download/castor.linux-amd64.phar -o castor -chmod +x castor -``` - -> **Note:** For other platforms (macOS, Windows, ARM), see the [Castor installation documentation](https://castor.jolicode.com/getting-started/installation). -> You can either place the `castor` binary in your PATH (e.g., `/usr/local/bin/castor`) or keep it in the project root and run it as `./castor`. +To install Castor, see the [installation documentation](https://castor.jolicode.com/getting-started/installation). Available tasks: From 015b4f85e07417650745abb41a234301f94aa7cc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:21:41 +0000 Subject: [PATCH 05/11] Add castor.php to PHPStan excluded paths Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index e38533b..cf9aab1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,3 +5,4 @@ parameters: excludePaths: - vendor - tests + - castor.php From 7d665dbea90a22bfa6d45e75746b85c7c3fb6694 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:25:36 +0000 Subject: [PATCH 06/11] Use Castor in GitHub Actions for CS and PHPStan checks Co-authored-by: joelwurtz <90466+joelwurtz@users.noreply.github.com> --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3425e9a..081d9a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,20 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: --config=.php-cs-fixer.php --diff --dry-run + php-version: '8.3' + extensions: mbstring, xml + + - name: Setup Castor + uses: castor-php/setup-castor@v1 + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-interaction + + - name: Run PHP-CS-Fixer check + run: castor cs:dry-run phpstan: name: PHPStan @@ -27,10 +37,20 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: PHPStan - uses: docker://oskarstark/phpstan-ga - env: - REQUIRE_DEV: true + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, xml + + - name: Setup Castor + uses: castor-php/setup-castor@v1 + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-interaction + + - name: Run PHPStan + run: castor phpstan ci: name: "Tests (PHP ${{ matrix.php-version }}, Symfony ${{ matrix.symfony }})" From 872b0bf17a528c28565f84ad489ab20831d93e3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 14:37:45 +0000 Subject: [PATCH 07/11] Fix setup-castor action version to v0.1.0 Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 081d9a4..4ba5c20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: extensions: mbstring, xml - name: Setup Castor - uses: castor-php/setup-castor@v1 + uses: castor-php/setup-castor@v0.1.0 - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction @@ -44,7 +44,7 @@ jobs: extensions: mbstring, xml - name: Setup Castor - uses: castor-php/setup-castor@v1 + uses: castor-php/setup-castor@v0.1.0 - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction From 760a579f8afaa516f5323343bcddf49fb103c102 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 17 Feb 2026 15:57:31 +0100 Subject: [PATCH 08/11] Update .github/workflows/ci.yml Co-authored-by: Jorick <48644518+JorickPepin@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ba5c20..390acbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: extensions: mbstring, xml - name: Setup Castor - uses: castor-php/setup-castor@v0.1.0 + uses: castor-php/setup-castor@v1.0.0 - name: Install Composer dependencies run: composer install --prefer-dist --no-interaction From 742ff92cac512f77315c06b866da6838a819812e Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 17 Feb 2026 16:40:25 +0100 Subject: [PATCH 09/11] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Loïck Piera --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f1dfe..61e6ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,7 @@ ## Unreleased -* Replaced Makefile with Castor task runner -* Added development documentation for Castor +* Replaced internal Makefile by Castor ## 1.10.0 (2026-02-03) From 3a074f4cb26b0b00737aeadac6393d2ae0dbe3e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:43:20 +0000 Subject: [PATCH 10/11] Refactor cs task to use --dry-run option instead of separate task Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- README.md | 10 +++++----- castor.php | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 390acbb..11c91a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: run: composer install --prefer-dist --no-interaction - name: Run PHP-CS-Fixer check - run: castor cs:dry-run + run: castor cs --dry-run phpstan: name: PHPStan diff --git a/README.md b/README.md index a322a7f..f74d49f 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,11 @@ To install Castor, see the [installation documentation](https://castor.jolicode. Available tasks: ```shell -castor list # List all available tasks -castor test # Run the test suite -castor cs # Fix PHP coding standards -castor cs:dry-run # Check PHP coding standards -castor phpstan # Run static analysis +castor list # List all available tasks +castor test # Run the test suite +castor cs # Fix PHP coding standards +castor cs --dry-run # Check PHP coding standards +castor phpstan # Run static analysis ``` ## Further documentation diff --git a/castor.php b/castor.php index 162919b..85aad91 100644 --- a/castor.php +++ b/castor.php @@ -13,16 +13,16 @@ use function Castor\run; -#[AsTask(description: 'Fix PHP CS')] -function cs(): void +#[AsTask(description: 'Fix CS', aliases: ['cs'])] +function cs(bool $dryRun = false): void { - run('vendor/bin/php-cs-fixer fix --verbose'); -} - -#[AsTask(name: 'cs:dry-run', description: 'Test if PHP CS is correct')] -function cs_dry_run(): void -{ - run('vendor/bin/php-cs-fixer fix --verbose --dry-run'); + $command = 'vendor/bin/php-cs-fixer fix --verbose'; + + if ($dryRun) { + $command .= ' --dry-run'; + } + + run($command); } #[AsTask(description: 'Run the test suite')] From 6286f860c884f1235d2cee4e16ddabe30375ab66 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 16:24:59 +0000 Subject: [PATCH 11/11] Fix CS: remove trailing whitespace in castor.php Co-authored-by: damienalexandre <225704+damienalexandre@users.noreply.github.com> --- castor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/castor.php b/castor.php index 85aad91..d283680 100644 --- a/castor.php +++ b/castor.php @@ -17,11 +17,11 @@ function cs(bool $dryRun = false): void { $command = 'vendor/bin/php-cs-fixer fix --verbose'; - + if ($dryRun) { $command .= ' --dry-run'; } - + run($command); }