Skip to content

Commit fcf815e

Browse files
authored
[PHP] Drop PHP 7 & upgrade dependency versions & GH Actions (#24)
1 parent 054909d commit fcf815e

File tree

11 files changed

+162
-212
lines changed

11 files changed

+162
-212
lines changed

.github/workflows/checks.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: avro-php
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
build-source:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
-
12+
name: Checkout
13+
uses: actions/checkout@v4
14+
-
15+
name: Install phars
16+
run: |
17+
make install-phars
18+
-
19+
name: Upload source directory
20+
uses: actions/upload-artifact@v4
21+
with:
22+
name: source
23+
include-hidden-files: true
24+
path: .
25+
php-xdebug-docker:
26+
needs:
27+
- build-source
28+
strategy:
29+
matrix:
30+
php:
31+
-
32+
version: '8.1'
33+
xdebug: '3.4.0'
34+
-
35+
version: '8.2'
36+
xdebug: '3.4.0'
37+
-
38+
version: '8.3'
39+
xdebug: '3.4.0'
40+
-
41+
version: '8.4'
42+
xdebug: '3.4.0'
43+
runs-on: ubuntu-22.04
44+
steps:
45+
-
46+
name: Download sources
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: source
50+
-
51+
name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
-
54+
name: Build
55+
uses: docker/build-push-action@v6
56+
with:
57+
context: .
58+
file: ./Dockerfile
59+
load: true
60+
tags: avro-php:${{ matrix.php.version }}
61+
build-args: |
62+
PHP_VERSION=${{ matrix.php.version }}
63+
XDEBUG_VERSION=${{ matrix.php.xdebug }}
64+
-
65+
name: Inspect docker image
66+
run: |
67+
docker image inspect avro-php:${{ matrix.php.version }}
68+
-
69+
name: Save docker image
70+
run: |
71+
docker save avro-php:${{ matrix.php.version }} -o php-avro-serde-${{ matrix.php.version }}.tgz
72+
-
73+
name: Upload docker image
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: php-avro-serde-${{ matrix.php.version }}
77+
path: php-avro-serde-${{ matrix.php.version }}.tgz
78+
ci-checks:
79+
runs-on: ubuntu-22.04
80+
needs:
81+
- php-xdebug-docker
82+
strategy:
83+
matrix:
84+
php:
85+
-
86+
version: '8.1'
87+
composer: --prefer-stable
88+
-
89+
version: '8.2'
90+
composer: --prefer-stable
91+
-
92+
version: '8.3'
93+
composer: --prefer-stable
94+
-
95+
version: '8.4'
96+
composer: --prefer-stable
97+
steps:
98+
-
99+
name: Download sources
100+
uses: actions/download-artifact@v4
101+
with:
102+
name: source
103+
-
104+
name: Set up Docker Buildx
105+
uses: docker/setup-buildx-action@v3
106+
-
107+
name: Download docker image
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: php-avro-serde-${{ matrix.php.version }}
111+
-
112+
name: Load docker image
113+
run: |
114+
docker load -i php-avro-serde-${{ matrix.php.version }}.tgz
115+
-
116+
name: Install vendors
117+
run: |
118+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
119+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" avro-php:${{ matrix.php.version }} \
120+
composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }}
121+
-
122+
name: Run PHPUnit
123+
run: |
124+
mkdir -p build/tmp build/share/test/schemas build/build/interop/data
125+
chmod -R a+w build
126+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
127+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" avro-php:${{ matrix.php.version }} \
128+
vendor/bin/phpunit --exclude-group integration

Dockerfile

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
ARG PHP_VERSION=8.2
1+
ARG PHP_VERSION=8.1
22

33
FROM php:${PHP_VERSION}-cli-alpine
44

5-
ARG XDEBUG_VERSION=3.2.0
6-
RUN apk add --update linux-headers \
7-
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
5+
ARG XDEBUG_VERSION=3.4.0
6+
7+
COPY --from=composer /usr/bin/composer /usr/bin/composer
8+
RUN composer --version
9+
10+
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
811
&& apk add --no-cache --virtual .runtime-deps git libzip-dev gmp-dev \
12+
&& docker-php-source extract \
13+
&& docker-php-ext-configure zip \
914
&& docker-php-ext-install zip gmp \
10-
&& pecl install xdebug-$XDEBUG_VERSION \
15+
&& apk add --update linux-headers \
16+
&& mkdir -p /usr/src/php/ext/xdebug \
17+
&& curl -fsSL https://github.com/xdebug/xdebug/archive/$XDEBUG_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/xdebug --strip 1 \
18+
&& docker-php-ext-install xdebug \
1119
&& docker-php-ext-enable xdebug \
12-
&& echo "xdebug.max_nesting_level=15000" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
13-
&& echo "xdebug.client_host=localhost" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
14-
&& echo "xdebug.idekey=PHPSTORM" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
15-
&& echo "xdebug.remote_handler=dbgp" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
16-
&& echo "xdebug.mode=develop" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
1720
&& git clone --recursive --depth=1 https://github.com/kjdev/php-ext-snappy.git \
1821
&& cd php-ext-snappy \
1922
&& phpize \
2023
&& ./configure \
2124
&& make \
2225
&& make install \
2326
&& docker-php-ext-enable snappy \
27+
&& docker-php-source delete \
2428
&& apk del .build-deps

Makefile

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# no buildin rules and variables
1+
# no builtin rules and variables
22
MAKEFLAGS =+ -rR --warn-undefined-variables
33

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

66
COMPOSER ?= bin/composer.phar
7-
COMPOSER_VERSION ?= 2.5.4
7+
COMPOSER_VERSION ?= 2.8.4
88
PHP ?= bin/php
9-
PHP_VERSION ?= 8.2
10-
XDEBUG_VERSION ?= 3.2.0
9+
PHP_VERSION ?= 8.3
10+
XDEBUG_VERSION ?= 3.4.0
1111

1212
export
1313

@@ -28,7 +28,12 @@ composer-update:
2828
phpunit:
2929
@mkdir -p build/tmp build/share/test/schemas build/build/interop/data
3030
@chmod -R a+w build
31-
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --coverage-text test/AllTests.php
31+
PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit
32+
33+
coverage:
34+
@mkdir -p build/tmp build/share/test/schemas build/build/interop/data
35+
@chmod -R a+w build
36+
PHP_VERSION=$(PHP_VERSION) $(PHP) -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text
3237

3338
run:
3439
PHP_VERSION=$(PHP_VERSION) $(PHP) $(ARGS)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A library for using [Avro](http://avro.apache.org/) with PHP.
55

66
Requirements
77
============
8-
* PHP >= 7.1
8+
* PHP >= 8.1
99
* On 32-bit platforms, the [GMP PHP extension](http://php.net/gmp)
1010
* For testing, [PHPUnit](http://www.phpunit.de/)
1111
* For Deflate codec, [Zlib](https://www.php.net/zlib)

bin/php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ command -v docker >/dev/null 2>&1 || { echo "docker is required to run this bina
77
USER=${USER:-$( id -un )}
88
GROUP=${GROUP:-$( id -gn )}
99
COMPOSER_HOME=${COMPOSER_HOME:-${HOME}/.composer}
10-
PHP_VERSION=${PHP_VERSION:-7.1}
10+
PHP_VERSION=${PHP_VERSION:-8.1}
1111
DOCKER_OPTS=${DOCKER_OPTS:-'-it'}
1212

1313
exec docker run ${DOCKER_OPTS} --rm \

build/.gitkeep

Whitespace-only changes.

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"description": "Avro schema encoder/decoder. Fork of rg/avro-php",
44
"license": "Apache-2.0",
55
"require": {
6-
"php": ">=7.4|>=8.0"
6+
"php": "^8.1"
77
},
88
"require-dev": {
9-
"phpunit/phpunit": "~8.5"
9+
"phpunit/phpunit": "^10.5"
1010
},
1111
"suggest": {
1212
"ext-gmp": "Large integer support for 32-bit platforms.",

phpunit.xml.dist

+6-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22

33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/10.5/phpunit.xsd"
66
colors="true"
77
>
8-
9-
<filter>
10-
<whitelist processUncoveredFilesFromWhitelist="true">
11-
<directory suffix=".php">lib/</directory>
12-
</whitelist>
13-
</filter>
14-
8+
<source>
9+
<include>
10+
<directory>lib</directory>
11+
</include>
12+
</source>
1513
<testsuites>
1614
<testsuite name="unit">
1715
<directory>test</directory>
1816
</testsuite>
1917
</testsuites>
20-
2118
</phpunit>

test/AllTests.php

-57
This file was deleted.

test/InterOpTest.php

-79
This file was deleted.

0 commit comments

Comments
 (0)