Skip to content

Commit

Permalink
[PHP] Drop PHP 7 & upgrade dependency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tPl0ch committed Dec 25, 2024
1 parent 054909d commit d4548e0
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 18 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: avro-php
on:
pull_request:
push:
branches:
- master
jobs:
build-source:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Install phars
run: |
make install-phars
-
name: Upload source directory
uses: actions/upload-artifact@v4
with:
name: source
include-hidden-files: true
path: .
php-xdebug-docker:
needs:
- build-source
strategy:
matrix:
php:
-
version: '8.1'
xdebug: '3.4.0'
-
version: '8.2'
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
with:
name: source
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
load: true
tags: avro-php:${{ matrix.php.version }}
build-args: |
PHP_VERSION=${{ matrix.php.version }}
XDEBUG_VERSION=${{ matrix.php.xdebug }}
-
name: Inspect docker image
run: |
docker image inspect avro-php:${{ matrix.php.version }}
-
name: Save docker image
run: |
docker save avro-php:${{ matrix.php.version }} -o php-avro-serde-${{ matrix.php.version }}.tgz
-
name: Upload docker image
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-22.04
needs:
- php-xdebug-docker
strategy:
matrix:
php:
-
version: '8.1'
composer: --prefer-stable
-
version: '8.2'
composer: --prefer-stable
-
version: '8.3'
composer: --prefer-stable
-
version: '8.4'
composer: --prefer-stable
steps:
-
name: Download sources
uses: actions/download-artifact@v4
with:
name: source
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Download docker image
uses: actions/download-artifact@v4
with:
name: php-avro-serde-${{ matrix.php.version }}
-
name: Load docker image
run: |
docker load -i php-avro-serde-${{ matrix.php.version }}.tgz
-
name: Install vendors
run: |
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" avro-php:${{ matrix.php.version }} \
composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }}
-
name: Run PHPUnit
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}" avro-php:${{ matrix.php.version }} \
vendor/bin/phpunit --exclude-group integration
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
ARG PHP_VERSION=8.2
ARG PHP_VERSION=8.1

FROM php:${PHP_VERSION}-cli-alpine

ARG XDEBUG_VERSION=3.2.0
RUN apk add --update linux-headers \
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
ARG XDEBUG_VERSION=3.4.0

COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer --version

RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
&& apk add --no-cache --virtual .runtime-deps git libzip-dev gmp-dev \
&& docker-php-source extract \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip gmp \
&& pecl install xdebug-$XDEBUG_VERSION \
&& apk add --update linux-headers \
&& mkdir -p /usr/src/php/ext/xdebug \
&& curl -fsSL https://github.com/xdebug/xdebug/archive/$XDEBUG_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/xdebug --strip 1 \
&& docker-php-ext-install xdebug \
&& docker-php-ext-enable xdebug \
&& echo "xdebug.max_nesting_level=15000" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
&& echo "xdebug.client_host=localhost" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
&& echo "xdebug.idekey=PHPSTORM" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
&& echo "xdebug.remote_handler=dbgp" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
&& echo "xdebug.mode=develop" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
&& git clone --recursive --depth=1 https://github.com/kjdev/php-ext-snappy.git \
&& cd php-ext-snappy \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& docker-php-ext-enable snappy \
&& docker-php-source delete \
&& apk del .build-deps
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# no buildin rules and variables
# no builtin rules and variables
MAKEFLAGS =+ -rR --warn-undefined-variables

.PHONY: composer-install composer-update examples docker run

COMPOSER ?= bin/composer.phar
COMPOSER_VERSION ?= 2.5.4
COMPOSER_VERSION ?= 2.8.4
PHP ?= bin/php
PHP_VERSION ?= 8.2
XDEBUG_VERSION ?= 3.2.0
PHP_VERSION ?= 8.3
XDEBUG_VERSION ?= 3.4.0

export

Expand Down
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 library for using [Avro](http://avro.apache.org/) with PHP.

Requirements
============
* PHP >= 7.1
* PHP >= 8.1
* On 32-bit platforms, the [GMP PHP extension](http://php.net/gmp)
* For testing, [PHPUnit](http://www.phpunit.de/)
* For Deflate codec, [Zlib](https://www.php.net/zlib)
Expand Down
2 changes: 1 addition & 1 deletion bin/php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ command -v docker >/dev/null 2>&1 || { echo "docker is required to run this bina
USER=${USER:-$( id -un )}
GROUP=${GROUP:-$( id -gn )}
COMPOSER_HOME=${COMPOSER_HOME:-${HOME}/.composer}
PHP_VERSION=${PHP_VERSION:-7.1}
PHP_VERSION=${PHP_VERSION:-8.1}
DOCKER_OPTS=${DOCKER_OPTS:-'-it'}

exec docker run ${DOCKER_OPTS} --rm \
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"description": "Avro schema encoder/decoder. Fork of rg/avro-php",
"license": "Apache-2.0",
"require": {
"php": ">=7.4|>=8.0"
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "~8.5"
"phpunit/phpunit": "^10.5"
},
"suggest": {
"ext-gmp": "Large integer support for 32-bit platforms.",
Expand Down

0 comments on commit d4548e0

Please sign in to comment.