diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3425e9a..11c91a6 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.0.0 + + - 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@v0.1.0 + + - 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 }})" 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..61e6ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changes between versions +## Unreleased + +* Replaced internal Makefile by 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..f74d49f 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,22 @@ 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, see the [installation documentation](https://castor.jolicode.com/getting-started/installation). + +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..d283680 --- /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 CS', aliases: ['cs'])] +function cs(bool $dryRun = false): void +{ + $command = 'vendor/bin/php-cs-fixer fix --verbose'; + + if ($dryRun) { + $command .= ' --dry-run'; + } + + run($command); +} + +#[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'); +} 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