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
128 changes: 128 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
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
run: |
mkdir -p build/tmp build/share/test/schemas build/build/interop/data
chmod -R a+w build
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
15 changes: 10 additions & 5 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 All @@ -28,7 +28,12 @@ composer-update:
phpunit:
@mkdir -p build/tmp build/share/test/schemas build/build/interop/data
@chmod -R a+w build
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --coverage-text test/AllTests.php
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit

coverage:
@mkdir -p build/tmp build/share/test/schemas build/build/interop/data
@chmod -R a+w build
PHP_VERSION=$(PHP_VERSION) $(PHP) -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text

run:
PHP_VERSION=$(PHP_VERSION) $(PHP) $(ARGS)
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
Empty file removed build/.gitkeep
Empty file.
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
15 changes: 6 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/10.5/phpunit.xsd"
colors="true"
>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">lib/</directory>
</whitelist>
</filter>

<source>
<include>
<directory>lib</directory>
</include>
</source>
<testsuites>
<testsuite name="unit">
<directory>test</directory>
</testsuite>
</testsuites>

</phpunit>
57 changes: 0 additions & 57 deletions test/AllTests.php

This file was deleted.

79 changes: 0 additions & 79 deletions test/InterOpTest.php

This file was deleted.

Loading