Skip to content
Merged
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
32 changes: 0 additions & 32 deletions .docker/php-8.3/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion .docker/php-8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --update \
curl

# Add php extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync

# Debugging
Expand Down
40 changes: 40 additions & 0 deletions .docker/php-8.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Build with
# docker buildx build --platform linux/arm64,linux/amd64 -t ghcr.io/digital-craftsman-de/date-time-precision-php-8.5:latest ./.docker/php-8.5 --push

FROM php:8.5-fpm-alpine

RUN apk add --update \
autoconf \
g++ \
automake \
make \
gnupg \
libzip \
libzip-dev \
util-linux-dev \
linux-headers \
libuuid \
$PHPIZE_DEPS \
libtool \
unzip

RUN curl -L --output /usr/bin/pie https://github.com/php/pie/releases/download/1.3.1/pie.phar \
&& chmod +x /usr/bin/pie

# Debugging
RUN pie install xdebug/xdebug

# Install composer
RUN curl -s https://getcomposer.org/installer | php
RUN alias composer='php composer.phar'
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

ADD php.ini /etc/php/conf.d/
ADD php.ini /etc/php/cli/conf.d/
ADD php.ini /usr/local/etc/php
ADD php-fpm.conf /etc/php/php-fpm.d/
ADD docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/

WORKDIR /var/www/html

CMD ["php-fpm", "-F"]
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
XDEBUG_MODE=coverage

# PHP-CS-Fixer is not officially compatible with PHP 8.4 yet.
PHP_CS_FIXER_IGNORE_ENV=1
3 changes: 0 additions & 3 deletions .github/workflows/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
XDEBUG_MODE=coverage

# PHP-CS-Fixer is not officially compatible with PHP 8.4 yet.
PHP_CS_FIXER_IGNORE_ENV=1
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-3:
name: "Tests on PHP 8.3"
test-8-4:
name: "Tests on PHP 8.4"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -18,28 +18,28 @@ 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

test-8-4:
name: "Tests on PHP 8.4"
test-8-5:
name: "Tests on PHP 8.5"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -54,25 +54,25 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

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

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

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

- name: Upload to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -98,18 +98,18 @@ jobs:
- name: Setup env
run: cp .github/workflows/.env .env

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

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

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

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

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

- name: Run code validation
run: make php-code-validation
9 changes: 6 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

$finder = (new PhpCsFixer\Finder())
$finder = new PhpCsFixer\Finder()
->in(__DIR__)
->exclude('vendor')
;

return (new PhpCsFixer\Config())
return new PhpCsFixer\Config()
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setUnsupportedPhpVersionAllowed(true)
->setRules([
'@Symfony' => true,

Expand Down Expand Up @@ -45,4 +47,5 @@
// Throw in a single line is worse to read when using ternary operator
'single_line_throw' => false,
])
->setFinder($finder);
->setFinder($finder)
;
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.12.0

- Added support for PHP 8.5.
- Dropped support for PHP 8.3.
- Added support for Symfony ^8.0.
- Dropped support for Symfony 7.3 and below. Only the 7.4 LTS version is still supported.

## 0.11.1

- Updated `digital-craftsman/self-aware-normalizers` to use the first stable version.
Expand Down
63 changes: 27 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,28 @@ down: .down
.down:
docker compose down

.PHONY: update
update: build up

.PHONY: reset
reset: .reset

.PHONY: .reset
.reset: .down .install .up

.PHONY: .install
install: install-8.4

.PHONY: install-8.3
install-8.3:
docker compose run --rm php-8.3 composer install
install: install-8.5

.PHONY: install-8.4
install-8.4:
docker compose run --rm php-8.4 composer install

.PHONY: .php-cli
php-cli: php-8.4-cli
.PHONY: install-8.5
install-8.5:
docker compose run --rm php-8.5 composer install

.PHONY: php-8.3-cli
php-8.3-cli:
docker compose run --rm php-8.3 sh
.PHONY: .php-cli
php-cli: php-8.5-cli

.PHONY: php-8.4-cli
php-8.4-cli:
docker compose run --rm php-8.4 sh

.PHONY: php-8.5-cli
php-8.5-cli:
docker compose run --rm php-8.5 sh

##
## Tests and code quality
## ----------------------
Expand All @@ -72,49 +63,49 @@ php-8.4-cli:
verify: php-code-validation php-tests php-mutation-testing

.PHONY: php-tests
php-tests: php-8.3-tests php-8.4-tests

.PHONY: php-8.3-tests
php-8.3-tests:
docker compose run --rm php-8.3 ./vendor/bin/phpunit
php-tests: php-8.4-tests php-8.5-tests

.PHONY: php-8.4-tests
php-8.4-tests:
docker compose run --rm php-8.4 ./vendor/bin/phpunit

.PHONY: php-tests-coverage
php-tests-coverage: php-8.4-tests-html-coverage
.PHONY: php-8.5-tests
php-8.5-tests:
docker compose run --rm php-8.5 ./vendor/bin/phpunit

.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
.PHONY: php-tests-coverage
php-tests-coverage: php-8.5-tests-html-coverage

.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

.PHONY: php-8.5-tests-html-coverage
php-8.5-tests-html-coverage:
docker compose run --rm php-8.5 ./vendor/bin/phpunit --coverage-html ./coverage

.PHONY: php-code-validation
php-code-validation:
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

.PHONY: php-mutation-testing
php-mutation-testing:
docker compose run --rm php-8.4 ./vendor/bin/infection --show-mutations --only-covered --threads=8
docker compose run --rm php-8.4 ./vendor/bin/infection --show-mutations --threads=8

##
## CI
## --
##

.PHONY: php-8.3-tests-ci
php-8.3-tests-ci:
docker compose run --rm php-8.3 ./vendor/bin/phpunit

.PHONY: php-8.4-tests-ci
php-8.4-tests-ci:
docker compose run --rm php-8.4 ./vendor/bin/phpunit --coverage-clover ./coverage.xml
docker compose run --rm php-8.4 ./vendor/bin/phpunit

.PHONY: php-8.5-tests-ci
php-8.5-tests-ci:
docker compose run --rm php-8.5 ./vendor/bin/phpunit --coverage-clover ./coverage.xml

.PHONY: php-mutation-testing-ci
php-mutation-testing-ci:
docker compose run --rm php-8.4 ./vendor/bin/infection --only-covered --threads=max
docker compose run --rm php-8.4 ./vendor/bin/infection --threads=max
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ This Symfony bundle includes Symfony normalizers for automatic normalization and

As it's a central part of an application, it's tested thoroughly (including mutation testing). Currently, more than 80% of the lines of code in this repository are tests.

[![Latest Stable Version](https://img.shields.io/badge/stable-0.11.1-blue)](https://packagist.org/packages/digital-craftsman/date-time-precision)
[![PHP Version Require](https://img.shields.io/badge/php-8.3|8.4-5b5d95)](https://packagist.org/packages/digital-craftsman/date-time-precision)
[![Latest Stable Version](https://img.shields.io/badge/stable-0.12.0-blue)](https://packagist.org/packages/digital-craftsman/date-time-precision)
[![PHP Version Require](https://img.shields.io/badge/php-8.4|8.5-5b5d95)](https://packagist.org/packages/digital-craftsman/date-time-precision)
[![codecov](https://codecov.io/gh/digital-craftsman-de/date-time-precision/branch/main/graph/badge.svg?token=vZ0IvKPj2f)](https://codecov.io/gh/digital-craftsman-de/date-time-precision)
![Packagist Downloads](https://img.shields.io/packagist/dt/digital-craftsman/date-time-precision)
![Packagist License](https://img.shields.io/packagist/l/digital-craftsman/date-time-precision)
Expand All @@ -36,7 +36,7 @@ Install package through composer:
composer require digital-craftsman/date-time-precision
```

> ⚠️ This bundle can be used (and is being used) in production, but hasn't reached version 1.0 yet. Therefore, there will be breaking changes between minor versions. I'd recommend that you require the bundle only with the current minor version like `composer require digital-craftsman/date-time-precision:0.11.*`. Breaking changes are described in the releases and [the changelog](./CHANGELOG.md). Updates are described in the [upgrade guide](./UPGRADE.md).
> ⚠️ This bundle can be used (and is being used) in production, but hasn't reached version 1.0 yet. Therefore, there will be breaking changes between minor versions. I'd recommend that you require the bundle only with the current minor version like `composer require digital-craftsman/date-time-precision:0.12.*`. Breaking changes are described in the releases and [the changelog](./CHANGELOG.md). Updates are described in the [upgrade guide](./UPGRADE.md).

## When would I need that?

Expand Down
Loading