Skip to content

Commit

Permalink
[PHP] Drop PHP 7.4 & 8.0
Browse files Browse the repository at this point in the history
- Upgrade all dependencies
- Refurbish code to pass CI tests again
  • Loading branch information
tPl0ch committed Dec 25, 2024
1 parent fb16416 commit 9d4f98d
Show file tree
Hide file tree
Showing 92 changed files with 506 additions and 833 deletions.
File renamed without changes.
87 changes: 43 additions & 44 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,53 @@ on:
- master
jobs:
build-source:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
-
name: Install phars
run: |
make install-phars
-
name: Upload source directory
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: source
include-hidden-files: true
path: .
php-xdebug-docker:
needs:
- build-source
strategy:
matrix:
php:
-
version: '7.4'
xdebug: '3.1.5'
-
version: '8.0'
xdebug: '3.1.5'
-
version: '8.1'
xdebug: '3.1.5'
xdebug: '3.4.0'
-
version: '8.2'
xdebug: '3.2.1'
runs-on: ubuntu-20.04
xdebug: '3.4.0'
-
version: '8.3'
xdebug: '3.4.0'
-
version: '8.4'
xdebug: '3.4.0'
runs-on: ubuntu-22.04
steps:
-
name: Download sources
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: source
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
Expand All @@ -70,53 +71,53 @@ jobs:
docker save php-avro-serde:${{ matrix.php.version }} -o php-avro-serde-${{ matrix.php.version }}.tgz
-
name: Upload docker image
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: php-avro-serde-${{ matrix.php.version }}
path: php-avro-serde-${{ matrix.php.version }}.tgz
ci-checks:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- php-xdebug-docker
strategy:
matrix:
php:
-
version: '7.4'
version: '8.1'
composer: --prefer-lowest
-
version: '8.0'
version: '8.2'
composer: --prefer-lowest
-
version: '8.1'
version: '8.3'
composer: --prefer-lowest
-
version: '8.2'
version: '8.4'
composer: --prefer-lowest
-
version: '7.4'
version: '8.1'
composer: --prefer-stable
-
version: '8.0'
version: '8.2'
composer: --prefer-stable
-
version: '8.1'
version: '8.3'
composer: --prefer-stable
-
version: '8.2'
version: '8.4'
composer: --prefer-stable
steps:
-
name: Download sources
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: source
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Download docker image
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: php-avro-serde-${{ matrix.php.version }}
-
Expand All @@ -131,75 +132,73 @@ jobs:
composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }}
-
name: Run Static analysis
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
if: ${{ matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' }}
run: |
chmod a+x bin/phpstan.phar bin/php-cs-fixer.phar
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:${{ matrix.php.version }} \
bin/phpstan.phar analyse
bin/phpstan.phar analyse --memory-limit 4G
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:${{ matrix.php.version }} \
bin/php-cs-fixer.phar fix --config=.php-cs-fixer.dist.php --diff -v --dry-run --path-mode=intersection --allow-risky=yes \
src test
-
name: Run PHPUnit
if: ${{ !(matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable') }}
if: ${{ !(matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable') }}
run: |
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:${{ matrix.php.version }} \
vendor/bin/phpunit --exclude-group integration
-
name: Run PHPUnit with Coverage Report
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
if: ${{ matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' }}
run: |
mkdir -p build
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:${{ matrix.php.version }} \
-d xdebug.mode=coverage vendor/bin/phpunit --exclude-group integration --coverage-clover=build/coverage.clover --coverage-text
- name: Publish code coverage
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: paambaati/codeclimate-action@v3.0.0
if: ${{ matrix.php.version == '8.3' && matrix.php.composer == '--prefer-stable' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: paambaati/codeclimate-action@v9
env:
CC_TEST_REPORTER_ID: ${{secrets.CODE_CLIMATE_REPORTER_ID}}
with:
coverageLocations: |
${{github.workspace}}/build/coverage.clover:clover
confluent-integration:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs:
- php-xdebug-docker
strategy:
matrix:
confluent:
-
version: latest
-
version: 4.1.4
-
version: 5.5.2
steps:
-
name: Download sources
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: source
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Download docker image
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: php-avro-serde-7.4
name: php-avro-serde-8.3
-
name: Load docker image
run: |
docker load -i php-avro-serde-7.4.tgz
docker load -i php-avro-serde-8.3.tgz
-
name: Install vendors
run: |
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:7.4 \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:8.3 \
composer update --no-interaction --no-scripts --no-ansi --prefer-stable
-
name: Run PHPUnit Integration
Expand All @@ -209,5 +208,5 @@ jobs:
chmod a+x bin/wait-for-all.sh bin/wait-for-it.sh
make platform
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:7.4 \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" php-avro-serde:8.3 \
vendor/bin/phpunit --group integration
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ composer.lock

# Custom entries
.php_cs*.cache
.env
variables.mk
build/
ocular.phar
Expand Down
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all', 'strict' => false],
'ordered_class_elements' => true,
'php_unit_method_casing' => false,
'fully_qualified_strict_types' => false,
])
->setFinder($finder)
->setCacheFile('.php_cs.' . (string) getenv('PHP_VERSION') . '.cache')
->setCacheFile('.php_cs.' . getenv('PHP_VERSION') . '.cache')
->setUsingCache(true);
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.3

FROM php:${PHP_VERSION}-cli-alpine

ARG XDEBUG_VERSION=3.1.5
ARG XDEBUG_VERSION=3.4.0

COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer --version
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ SCHEMA_REGISTRY_IPV4 ?= 172.68.0.103
KAFKA_BROKER_IPV4 ?= 172.68.0.102
ZOOKEEPER_IPV4 ?= 172.68.0.101
COMPOSER ?= bin/composer.phar
COMPOSER_VERSION ?= 2.3.10
COMPOSER_VERSION ?= 2.8.4
PHP_STAN ?= bin/phpstan.phar
PHP_STAN_VERSION ?= 1.8.2
PHP_STAN_VERSION ?= 2.0.4
PHP_CS_FIXER ?= bin/php-cs-fixer.phar
PHP_CS_FIXER_VERSION ?= 3.9.5
PHP_CS_FIXER_VERSION ?= 3.65.0
PHPUNIT ?= vendor/bin/phpunit
PHP ?= bin/php
PHP_VERSION ?= 8.1
XDEBUG_VERSION ?= 3.1.5
PHP_VERSION ?= 8.3
XDEBUG_VERSION ?= 3.4.0
XDEBUG_OPTIONS ?= -d xdebug.mode=off
export

Expand All @@ -34,10 +34,10 @@ composer-install:
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(COMPOSER) install --no-interaction --no-progress --no-scripts

composer-update:
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(COMPOSER) update --prefer-stable --no-interaction --no-progress --no-scripts
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(COMPOSER) update --prefer-lowest --no-interaction --no-progress --no-scripts

phpstan:
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(PHP_STAN) analyse
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(PHP_STAN) analyse --memory-limit 4G

cs-fixer:
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) $(PHP_CS_FIXER) fix --config=.php-cs-fixer.dist.php --diff -v --dry-run \
Expand Down Expand Up @@ -72,14 +72,14 @@ install-phars:
chmod a+x bin/phpstan.phar

platform:
docker-compose down
docker-compose up -d
docker compose down
docker compose up -d
bin/wait-for-all.sh

clean:
rm -rf build
docker-compose down
docker compose down

benchmark: platform
PHP_VERSION=$(PHP_VERSION) $(PHP) $(XDEBUG_OPTIONS) ./vendor/bin/phpbench run benchmarks/AvroEncodingBench.php --report=aggregate --retry-threshold=5
docker-compose down
docker compose down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ integrates FlixTech's [Schema Registry Client](https://github.com/flix-tech/sche
This library is using the [composer package manager](https://getcomposer.org/) for PHP.

```bash
composer require 'flix-tech/avro-serde-php:^1.6'
composer require 'flix-tech/avro-serde-php:^2.2'
```

## Quickstart
Expand Down
Loading

0 comments on commit 9d4f98d

Please sign in to comment.