From a5dd7cb3299fe09f1d7023f6161328f41d4e8f18 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 23 Oct 2025 15:48:27 +0200 Subject: [PATCH] Add PHP 8.5 support, drop PHP < 8.4 --- .gitattributes | 18 ++++++++++-------- .github/workflows/ci.yml | 8 ++++---- .gitignore | 1 + Dockerfile | 13 +++++++++++++ Makefile | 24 +++++++++++++++--------- composer.json | 4 ++-- docker-compose.yml | 10 ++++++++++ 7 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitattributes b/.gitattributes index f5446da..ec2b25b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,10 @@ -/.github export-ignore -/tests export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.php-cs-fixer.php export-ignore -Makefile export-ignore -composer-require-checker.json export-ignore -phpunit.xml export-ignore +/.github/ export-ignore +/tests/ export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.php export-ignore +/Makefile export-ignore +/Dockerfile export-ignore +/docker-compose.yml export-ignore +/composer-require-checker.json export-ignore +/phpunit.xml export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b81794..3bf9118 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.4" steps: - uses: "actions/checkout@v5" @@ -40,11 +40,11 @@ jobs: strategy: matrix: php-version: - - "8.4" + - "8.5" code-coverage: - "none" include: - - php-version: "8.3" + - php-version: "8.4" code-coverage: "pcov" steps: @@ -78,7 +78,7 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.4" steps: - uses: "actions/checkout@v5" diff --git a/.gitignore b/.gitignore index 77897c2..b58980d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /.phpunit.cache/ /vendor/ /coverage/ +/.env /.php-cs-fixer.cache /.phpunit.result.cache /composer.lock diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c1470cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM php:8.4 + +ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions @composer pcov + +ARG USER_ID +ARG GROUP_ID + +RUN groupadd --gid ${GROUP_ID} code \ + && useradd --create-home --shell /bin/bash --uid ${USER_ID} --gid code code + +USER code diff --git a/Makefile b/Makefile index d649be0..d02b9c8 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,25 @@ -CSFIX_PHP_BIN=PHP_CS_FIXER_IGNORE_ENV=1 php8.2 -PHP_BIN=php8.2 -d zend.assertions=1 -d error_reporting=-1 -COMPOSER_BIN=$(shell command -v composer) +ifdef CI + DOCKER_PHP_EXEC := +else + DOCKER_PHP_EXEC := docker compose run --rm php +endif all: csfix test @echo "Done." -vendor: composer.json - $(PHP_BIN) $(COMPOSER_BIN) update - $(PHP_BIN) $(COMPOSER_BIN) bump - touch vendor +.env: /etc/passwd /etc/group Makefile + printf "USER_ID=%s\nGROUP_ID=%s\n" `id --user "${USER}"` `id --group "${USER}"` > .env + +vendor: .env docker-compose.yml Dockerfile composer.json + docker compose build --pull + $(DOCKER_PHP_EXEC) composer update + $(DOCKER_PHP_EXEC) composer bump + touch --no-create $@ .PHONY: csfix csfix: vendor - $(CSFIX_PHP_BIN) vendor/bin/php-cs-fixer fix -v + $(DOCKER_PHP_EXEC) vendor/bin/php-cs-fixer fix -v $(arg) .PHONY: test test: vendor - $(PHP_BIN) vendor/bin/phpunit $(PHPUNIT_ARGS) + $(DOCKER_PHP_EXEC) php -d zend.assertions=1 vendor/bin/phpunit $(PHPUNIT_ARGS) diff --git a/composer.json b/composer.json index e3ea3a0..0124750 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ } ], "require": { - "php": "~8.3.0 || ~8.4.0" + "php": "~8.4.0 || ~8.5.0" }, "require-dev": { "phpunit/phpunit": "^12.4.1", - "slam/php-cs-fixer-extensions": "^3.13.0" + "slam/php-cs-fixer-extensions": "^3.14.0" }, "autoload": { "files": [ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d564d0b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + php: + build: + context: . + args: + USER_ID: ${USER_ID} + GROUP_ID: ${GROUP_ID} + volumes: + - .:${PWD} + working_dir: ${PWD}