Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for PHP 8.4 #70

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .docker/php-8.2/Dockerfile → .docker/php-8.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build with
# docker buildx build --platform linux/arm64,linux/amd64 -t ghcr.io/digital-craftsman-de/ids-php-8.2:latest ./.docker/php-8.2 --push
# docker buildx build --platform linux/arm64,linux/amd64 -t ghcr.io/digital-craftsman-de/ids-php-8.4:latest ./.docker/php-8.4 --push

FROM php:8.2-fpm-alpine
FROM php:8.4.0RC3-fpm-alpine

RUN apk add --update \
autoconf \
Expand All @@ -15,7 +15,19 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync

# Debugging
RUN install-php-extensions xdebug
# XDebug is not yet compatible with PHP 8.4, therefore we need to build it from source. This will be replaced with the following line once XDebug is compatible with PHP 8.4:
# RUN pecl install xdebug-3.4.0 && docker-php-ext-enable xdebug
RUN apk add git
#RUN apk add -U php8-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN git clone https://github.com/xdebug/xdebug.git \
&& cd xdebug \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& docker-php-ext-enable xdebug
#RUN install-php-extensions xdebug

# Ids package
RUN install-php-extensions uuid
Expand Down
File renamed without changes.
File renamed without changes.
60 changes: 30 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: CI
on: push
jobs:

test-8-2:
name: "Tests on PHP 8.2"
test-8-3:
name: "Tests on PHP 8.3"
runs-on: ubuntu-latest
steps:

Expand All @@ -19,25 +19,25 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

- name: Cache PHP 8.2 dependencies
id: cache-php-8-2-dependencies
- name: Cache PHP 8.3 dependencies
id: cache-php-8-3-dependencies
uses: actions/cache@v3
env:
cache-name: cache-php-8-2-dependencies
cache-name: cache-php-8-3-dependencies
with:
path: |
~/.cache
vendor
key: ${{ runner.os }}-php-8-2-cache-${{ hashFiles('composer.lock') }}
key: ${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8-2-cache-${{ hashFiles('composer.lock') }}
${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}

- name: Install
if: steps.cache-php-8-2-dependencies.outputs.cache-hit != 'true'
run: make install-8.2
if: steps.cache-php-8-3-dependencies.outputs.cache-hit != 'true'
run: make install-8.3

- name: Run PHP tests
run: make php-8.2-tests-ci
run: make php-8.3-tests-ci

- name: Upload to Codecov
uses: codecov/codecov-action@v2
Expand All @@ -46,8 +46,8 @@ jobs:
files: ./coverage.xml
verbose: true

test-8-3:
name: "Tests on PHP 8.3"
test-8-4:
name: "Tests on PHP 8.4"
runs-on: ubuntu-latest
steps:

Expand All @@ -63,25 +63,25 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

- name: Cache PHP 8.3 dependencies
id: cache-php-8-3-dependencies
- name: Cache PHP 8.4 dependencies
id: cache-php-8-4-dependencies
uses: actions/cache@v3
env:
cache-name: cache-php-8-3-dependencies
cache-name: cache-php-8-4-dependencies
with:
path: |
~/.cache
vendor
key: ${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}
key: ${{ runner.os }}-php-8-4-cache-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}
${{ runner.os }}-php-8-4-cache-${{ hashFiles('composer.lock') }}

- name: Install
if: steps.cache-php-8-3-dependencies.outputs.cache-hit != 'true'
run: make install-8.3
if: steps.cache-php-8-4-dependencies.outputs.cache-hit != 'true'
run: make install-8.4

- name: Run PHP tests
run: make php-8.3-tests-ci
run: make php-8.4-tests-ci

mutation-testing:
name: "Mutation tests"
Expand All @@ -100,18 +100,18 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

- name: Restore cache for PHP 8.3 dependencies
id: cache-php-8-3-dependencies
- name: Restore cache for PHP 8.4 dependencies
id: cache-php-8-4-dependencies
uses: actions/cache/restore@v3
with:
path: |
~/.cache
vendor
key: ${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}
key: ${{ runner.os }}-php-8-4-cache-${{ hashFiles('composer.lock') }}

- name: Install
if: steps.cache-php-8-3-dependencies.outputs.cache-hit != 'true'
run: make install-8.3
if: steps.cache-php-8-4-dependencies.outputs.cache-hit != 'true'
run: make install-8.4

- name: Run mutation testing
run: make php-mutation-testing-ci
Expand All @@ -133,18 +133,18 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

- name: Restore cache for PHP 8.3 dependencies
id: cache-php-8-3-dependencies
- name: Restore cache for PHP 8.4 dependencies
id: cache-php-8-4-dependencies
uses: actions/cache/restore@v3
with:
path: |
~/.cache
vendor
key: ${{ runner.os }}-php-8-3-cache-${{ hashFiles('composer.lock') }}
key: ${{ runner.os }}-php-8-4-cache-${{ hashFiles('composer.lock') }}

- name: Install
if: steps.cache-php-8-3-dependencies.outputs.cache-hit != 'true'
run: make install-8.3
if: steps.cache-php-8-4-dependencies.outputs.cache-hit != 'true'
run: make install-8.4

- name: Run code validation
run: make php-code-validation
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.4.0

- Drop support for PHP 8.2.
- Add support for PHP 8.4.

## 1.3.0

- Added method `mapWithIdKeys(callable $mapFunction): array` to `IdList`.
Expand Down
76 changes: 38 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,34 @@ reset: .reset
.PHONY: .reset
.reset: .down .install .up

## install Install PHP dependencies with the default PHP version (8.3).
## install Install PHP dependencies with the default PHP version (8.4).
.PHONY: .install
install: install-8.3

## install-8.2 Install PHP dependencies with PHP 8.2.
.PHONY: install-8.2
install-8.2:
docker compose run --rm php-8.2 composer install
install: install-8.4

## install-8.3 Install PHP dependencies with PHP 8.3.
.PHONY: install-8.3
install-8.3:
docker compose run --rm php-8.3 composer install

## php-cli Enter a shell for the default PHP version (8.3).
.PHONY: php-cli
php-cli: php-8.3-cli
## install-8.4 Install PHP dependencies with PHP 8.4.
.PHONY: install-8.4
install-8.4:
docker compose run --rm php-8.4 composer install

## php-8.2-cli Enter a shell for PHP 8.2.
.PHONY: php-8.2-cli
php-8.2-cli:
docker compose run --rm php-8.2 sh
## php-cli Enter a shell for the default PHP version (8.4).
.PHONY: php-cli
php-cli: php-8.4-cli

## php-8.3-cli Enter a shell for PHP 8.3.
.PHONY: php-8.3-cli
php-8.3-cli:
docker compose run --rm php-8.3 sh

## php-8.4-cli Enter a shell for PHP 8.4.
.PHONY: php-8.4-cli
php-8.4-cli:
docker compose run --rm php-8.4 sh

##
## Tests and code validation
## -------------------------
Expand All @@ -91,60 +91,60 @@ verify: php-code-validation php-tests php-mutation-testing

## php-tests Run the tests for all relevant PHP versions.
.PHONY: php-tests
php-tests: php-8.2-tests php-8.3-tests
php-tests: php-8.3-tests php-8.4-tests

## php-tests-coverage Run the tests for all relevant PHP versions including coverage report as HTML.
.PHONY: php-tests-coverage
php-tests-coverage: php-8.3-tests-html-coverage

## php-8.2-tests Run tests with PHP 8.2.
.PHONY: php-8.2-tests
php-8.2-tests:
docker compose run --rm php-8.2 ./vendor/bin/phpunit
php-tests-coverage: php-8.4-tests-html-coverage

## php-8.3-tests Run tests with PHP 8.3.
.PHONY: php-8.3-tests
php-8.3-tests:
docker compose run --rm php-8.3 ./vendor/bin/phpunit

## php-8.2-tests-html-coverage Run the tests with PHP 8.2 including coverage report as HTML.
.PHONY: php-8.2-tests-html-coverage
php-8.2-tests-html-coverage:
docker compose run --rm php-8.2 ./vendor/bin/phpunit --coverage-html ./coverage
## php-8.4-tests Run tests with PHP 8.4.
.PHONY: php-8.4-tests
php-8.4-tests:
docker compose run --rm php-8.4 ./vendor/bin/phpunit

## php-8.3-tests-html-coverage Run the tests with PHP 8.3 including coverage report as HTML.
.PHONY: php-8.3-tests-html-coverage
php-8.3-tests-html-coverage:
docker compose run --rm php-8.3 ./vendor/bin/phpunit --coverage-html ./coverage

## php-code-validation Run code fixers and linters with default PHP version (8.2).
## php-8.4-tests-html-coverage Run the tests with PHP 8.4 including coverage report as HTML.
.PHONY: php-8.4-tests-html-coverage
php-8.4-tests-html-coverage:
docker compose run --rm php-8.4 ./vendor/bin/phpunit --coverage-html ./coverage

## php-code-validation Run code fixers and linters with default PHP version (8.3).
.PHONY: php-code-validation
php-code-validation:
docker compose run --rm php-8.2 ./vendor/bin/php-cs-fixer fix
docker compose run --rm php-8.2 ./vendor/bin/psalm --show-info=false --no-diff
docker compose run --rm php-8.2 ./vendor/bin/phpstan --xdebug
docker compose run --rm php-8.4 ./vendor/bin/php-cs-fixer fix
docker compose run --rm php-8.4 ./vendor/bin/psalm --show-info=false --no-diff
docker compose run --rm php-8.4 ./vendor/bin/phpstan --xdebug

## php-mutation-testing Run mutation testing with default PHP version (8.2).
## php-mutation-testing Run mutation testing with default PHP version (8.3).
.PHONY: php-mutation-testing
php-mutation-testing:
docker compose run --rm php-8.2 ./vendor/bin/infection --show-mutations --only-covered --threads=8
docker compose run --rm php-8.4 ./vendor/bin/infection --show-mutations --only-covered --threads=8

##
## CI
## --
##

## php-8.2-tests-ci Run the tests for PHP 8.2 for CI.
.PHONY: php-8.2-tests-ci
php-8.2-tests-ci:
docker compose run --rm php-8.2 ./vendor/bin/phpunit --coverage-clover ./coverage.xml

## php-8.3-tests-ci Run the tests for PHP 8.3 for CI.
.PHONY: php-8.3-tests-ci
php-8.3-tests-ci:
docker compose run --rm php-8.3 ./vendor/bin/phpunit
docker compose run --rm php-8.3 ./vendor/bin/phpunit --coverage-clover ./coverage.xml

## php-8.4-tests-ci Run the tests for PHP 8.4 for CI.
.PHONY: php-8.4-tests-ci
php-8.4-tests-ci:
docker compose run --rm php-8.4 ./vendor/bin/phpunit

## php-mutation-testing-ci Run mutation testing for CI.
.PHONY: php-mutation-testing-ci
php-mutation-testing-ci:
docker compose run --rm php-8.2 ./vendor/bin/infection --only-covered --threads=max
docker compose run --rm php-8.4 ./vendor/bin/infection --only-covered --threads=max
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A Symfony bundle to work with id and id list value objects in Symfony. It includ
As it's a central part of an application, it's tested thoroughly (including mutation testing).

[![Latest Stable Version](https://img.shields.io/badge/stable-1.3.0-blue)](https://packagist.org/packages/digital-craftsman/ids)
[![PHP Version Require](https://img.shields.io/badge/php-8.2|8.3-5b5d95)](https://packagist.org/packages/digital-craftsman/ids)
[![PHP Version Require](https://img.shields.io/badge/php-8.3|8.4-5b5d95)](https://packagist.org/packages/digital-craftsman/ids)
[![codecov](https://codecov.io/gh/digital-craftsman-de/ids/branch/main/graph/badge.svg?token=BL0JKZYLBG)](https://codecov.io/gh/digital-craftsman-de/ids)
![Packagist Downloads](https://img.shields.io/packagist/dt/digital-craftsman/ids)
![Packagist License](https://img.shields.io/packagist/l/digital-craftsman/ids)
Expand Down
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Upgrade guide

## From 1.3.* to 1.4.0

### Upgrade to at least PHP 8.3

Support for PHP 8.2 was dropped, so you have to upgrade to at least PHP 8.3.

## From 1.2.* to 1.3.0

Nothing to do.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Working with value objects for ids in Symfony",
"type": "symfony-bundle",
"require": {
"php": "8.2.*|8.3.*",
"php": "8.3.*|8.4.*",
"symfony/framework-bundle": "^6.3|^7.0",
"symfony/serializer": "^6.3|^7.0",
"doctrine/dbal": "^2.13.8|^3.3.6",
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
services:

php-8.2:
image: ghcr.io/digital-craftsman-de/ids-php-8.2
php-8.3:
image: ghcr.io/digital-craftsman-de/ids-php-8.3
env_file:
- .env
volumes:
- .:/var/www/html
extra_hosts:
- "host.docker.internal:host-gateway"

php-8.3:
image: ghcr.io/digital-craftsman-de/ids-php-8.3
php-8.4:
image: ghcr.io/digital-craftsman-de/ids-php-8.4
env_file:
- .env
volumes:
Expand Down
Loading