Skip to content

Commit 84df795

Browse files
authored
[FT] Drop PHP 7.2 and add PHP 7.4 and 8.0 (#53)
* Increase default versions for PHP and XDebug in `Dockerfile` * Use PHP 7.4 in PHP shell wrapper * Install XDebug from source in `Dockerfile` * Use composer v2 in `Makefile` * Remove now useless `--no-suggest` option * Migrate to new PHPUnit config format * Add `wait-for-it` scripts * Add GitHub actions CI scripts * Remove travis * Update `Makefile` * Remove custom XDebug options in `Dockerfile` * Remove phpstan from `composer.json` * Add composer binary to docker image in `Dockerfile` * PHPUnit v 9.4 is required for PHP8 compat * Add `phpstan.phar` to `.gitignore` * Fix badges in `README.md` * Fix copypasta from avro serde repository * Require guzzle promises `^1.4.0` for PHP 8.0 support * Add required env vars for integration test
1 parent 9e30414 commit 84df795

File tree

11 files changed

+452
-217
lines changed

11 files changed

+452
-217
lines changed

.github/workflows/checks.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: schema-registry-ci
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
build-source:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
-
12+
name: Checkout
13+
uses: actions/checkout@v2
14+
-
15+
name: Install phars
16+
run: |
17+
make install-phars
18+
-
19+
name: Upload source directory
20+
uses: actions/upload-artifact@v2
21+
with:
22+
name: source
23+
path: .
24+
php-xdebug-docker:
25+
needs:
26+
- build-source
27+
strategy:
28+
matrix:
29+
php:
30+
-
31+
version: 7.4
32+
xdebug: 2.9.8
33+
-
34+
version: 7.3
35+
xdebug: 2.9.8
36+
-
37+
version: rc
38+
xdebug: 3.0.0beta1
39+
runs-on: ubuntu-20.04
40+
steps:
41+
-
42+
name: Download sources
43+
uses: actions/download-artifact@v2
44+
with:
45+
name: source
46+
-
47+
name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v1
49+
-
50+
name: Build
51+
uses: docker/build-push-action@v2
52+
with:
53+
context: .
54+
file: ./Dockerfile
55+
load: true
56+
tags: schema-registry-client:${{ matrix.php.version }}
57+
build-args: |
58+
PHP_VERSION=${{ matrix.php.version }}
59+
XDEBUG_VERSION=${{ matrix.php.xdebug }}
60+
-
61+
name: Inspect docker image
62+
run: |
63+
docker image inspect schema-registry-client:${{ matrix.php.version }}
64+
-
65+
name: Save docker image
66+
run: |
67+
docker save schema-registry-client:${{ matrix.php.version }} -o schema-registry-client-${{ matrix.php.version }}.tgz
68+
-
69+
name: Upload docker image
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: schema-registry-client-${{ matrix.php.version }}
73+
path: schema-registry-client-${{ matrix.php.version }}.tgz
74+
ci-checks:
75+
runs-on: ubuntu-20.04
76+
needs:
77+
- php-xdebug-docker
78+
strategy:
79+
matrix:
80+
php:
81+
-
82+
version: 7.3
83+
composer: --prefer-lowest
84+
-
85+
version: 7.4
86+
composer: --prefer-lowest
87+
-
88+
version: rc
89+
composer: --prefer-lowest
90+
-
91+
version: 7.3
92+
composer: --prefer-stable
93+
-
94+
version: 7.4
95+
composer: --prefer-stable
96+
-
97+
version: rc
98+
composer: --prefer-stable
99+
steps:
100+
-
101+
name: Download sources
102+
uses: actions/download-artifact@v2
103+
with:
104+
name: source
105+
-
106+
name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@v1
108+
-
109+
name: Download docker image
110+
uses: actions/download-artifact@v2
111+
with:
112+
name: schema-registry-client-${{ matrix.php.version }}
113+
-
114+
name: Load docker image
115+
run: |
116+
docker load -i schema-registry-client-${{ matrix.php.version }}.tgz
117+
-
118+
name: Install vendors
119+
run: |
120+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
121+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
122+
composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }}
123+
-
124+
name: Run Static analysis
125+
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
126+
run: |
127+
chmod a+x bin/phpstan.phar bin/php-cs-fixer.phar
128+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
129+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
130+
bin/phpstan.phar analyse
131+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
132+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
133+
bin/php-cs-fixer.phar fix --config=.php_cs.dist --diff -v --dry-run --path-mode=intersection --allow-risky=yes \
134+
src test
135+
-
136+
name: Run PHPUnit
137+
if: ${{ !(matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable') }}
138+
run: |
139+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
140+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
141+
vendor/bin/phpunit --exclude-group integration
142+
-
143+
name: Run PHPUnit with Coverage Report
144+
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
145+
run: |
146+
mkdir -p build
147+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
148+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
149+
vendor/bin/phpunit --exclude-group integration --coverage-clover=build/coverage.clover --coverage-text
150+
- name: Publish code coverage
151+
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
152+
uses: paambaati/codeclimate-action@v2.7.4
153+
env:
154+
CC_TEST_REPORTER_ID: ${{secrets.CODE_CLIMATE_REPORTER_ID}}
155+
with:
156+
coverageLocations: |
157+
${{github.workspace}}/build/coverage.clover:clover
158+
confluent-integration:
159+
runs-on: ubuntu-20.04
160+
needs:
161+
- php-xdebug-docker
162+
strategy:
163+
matrix:
164+
confluent:
165+
-
166+
version: latest
167+
-
168+
version: 4.1.4
169+
-
170+
version: 5.5.2
171+
steps:
172+
-
173+
name: Download sources
174+
uses: actions/download-artifact@v2
175+
with:
176+
name: source
177+
-
178+
name: Set up Docker Buildx
179+
uses: docker/setup-buildx-action@v1
180+
-
181+
name: Download docker image
182+
uses: actions/download-artifact@v2
183+
with:
184+
name: schema-registry-client-7.4
185+
-
186+
name: Load docker image
187+
run: |
188+
docker load -i schema-registry-client-7.4.tgz
189+
-
190+
name: Install vendors
191+
run: |
192+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
193+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \
194+
composer update --no-interaction --no-scripts --no-ansi --prefer-stable
195+
-
196+
name: Run PHPUnit Integration
197+
env:
198+
CONFLUENT_VERSION: ${{ matrix.confluent.version }}
199+
run: |
200+
chmod a+x bin/wait-for-all.sh bin/wait-for-it.sh
201+
make platform
202+
docker run -i --rm --net=host --sig-proxy=true --pid=host \
203+
-e ENABLE_INTEGRATION_TEST=1 -e TEST_SCHEMA_REGISTRY_HOST=172.68.0.103 -e TEST_SCHEMA_REGISTRY_PORT=8081 \
204+
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \
205+
vendor/bin/phpunit --group integration

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ variables.mk
1717
/build/
1818
ocular.phar
1919
php-cs-fixer.phar
20+
phpstan.phar
2021

2122
.phpunit.result.cache

.travis.yml

Lines changed: 0 additions & 147 deletions
This file was deleted.

Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
ARG PHP_VERSION=7.2
1+
ARG PHP_VERSION=7.4
22

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

5-
ARG XDEBUG_VERSION=2.7.2
5+
ARG XDEBUG_VERSION=2.9.8
6+
7+
COPY --from=composer /usr/bin/composer /usr/bin/composer
8+
RUN composer --version
69

710
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
811
&& apk add --no-cache --virtual .runtime-deps git libzip-dev \
12+
&& docker-php-source extract \
13+
&& docker-php-ext-configure zip \
914
&& docker-php-ext-install zip \
10-
&& pecl install xdebug-$XDEBUG_VERSION \
15+
&& mkdir -p /usr/src/php/ext/xdebug \
16+
&& curl -fsSL https://github.com/xdebug/xdebug/archive/$XDEBUG_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/xdebug --strip 1 \
17+
&& docker-php-ext-install xdebug \
1118
&& 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.remote_enable=true" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
14-
&& echo "xdebug.remote_host=localhost" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
15-
&& echo "xdebug.idekey=PHPSTORM" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
16-
&& echo "xdebug.remote_handler=dbgp" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
17-
&& echo "xdebug.remote_autostart=1" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
18-
&& echo "xdebug.remote_connect_back=0" >> "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini" \
19+
&& docker-php-source delete \
1920
&& apk del .build-deps

0 commit comments

Comments
 (0)