Skip to content
Closed
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
106 changes: 46 additions & 60 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,49 @@ on:
- master
jobs:
build-source:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6
-
name: Install phars
run: |
make install-phars
-
name: Upload source directory
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v6
with:
name: source
path: .
include-hidden-files: true
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'
-
version: '8.2'
xdebug: '3.2.1'
runs-on: ubuntu-20.04
- version: '8.2'
xdebug: '3.5.0'
- version: '8.3'
xdebug: '3.5.0'
- version: '8.4'
xdebug: '3.5.0'
- version: '8.5'
xdebug: '3.5.0'
runs-on: ubuntu-24.04
steps:
-
name: Download sources
uses: actions/download-artifact@v2
uses: actions/download-artifact@v7
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 +67,45 @@ jobs:
docker save schema-registry-client:${{ matrix.php.version }} -o schema-registry-client-${{ matrix.php.version }}.tgz
-
name: Upload docker image
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v6
with:
name: schema-registry-client-${{ matrix.php.version }}
path: schema-registry-client-${{ matrix.php.version }}.tgz
ci-checks:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs:
- php-xdebug-docker
strategy:
matrix:
php:
-
version: '7.4'
- version: '8.2'
composer: --prefer-lowest
-
version: '8.0'
- version: '8.3'
composer: --prefer-lowest
-
version: '8.1'
- version: '8.4'
composer: --prefer-lowest
-
version: '8.2'
- version: '8.5'
composer: --prefer-lowest
-
version: '7.4'
- version: '8.2'
composer: --prefer-stable
-
version: '8.0'
- version: '8.3'
composer: --prefer-stable
-
version: '8.1'
- version: '8.4'
composer: --prefer-stable
-
version: '8.2'
- version: '8.5'
composer: --prefer-stable
steps:
-
name: Download sources
uses: actions/download-artifact@v2
uses: actions/download-artifact@v7
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@v2
uses: actions/download-artifact@v7
with:
name: schema-registry-client-${{ matrix.php.version }}
-
Expand All @@ -131,81 +120,78 @@ jobs:
composer update --no-interaction --no-scripts --no-ansi ${{ matrix.php.composer }}
-
name: Run PHPStan analysis
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
if: ${{ matrix.php.version == '8.2' && matrix.php.composer == '--prefer-stable' }}
run: |
chmod a+x bin/phpstan.phar
docker run -i --rm --net=host --sig-proxy=true --pid=host -m 4000M --entrypoint="php" \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
-d memory_limit=4G -d xdebug.mode=off bin/phpstan.phar analyse
-
name: Run CS Fixer
if: ${{ matrix.php.version == '7.4' && matrix.php.composer == '--prefer-stable' }}
if: ${{ matrix.php.version == '8.2' && matrix.php.composer == '--prefer-stable' }}
run: |
chmod a+x bin/php-cs-fixer.phar
docker run -i --rm --net=host --sig-proxy=true --pid=host -m 1000M --entrypoint="php" \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:${{ matrix.php.version }} \
-d xdebug.mode=off -d xdebug.coverage_enable=0 bin/php-cs-fixer.phar fix --config=.php-cs-fixer.dist.php \
-d xdebug.mode=off 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.2' && 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}" schema-registry-client:${{ 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.2' && 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}" schema-registry-client:${{ 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' }}
if: ${{ matrix.php.version == '8.2' && matrix.php.composer == '--prefer-stable' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: paambaati/codeclimate-action@v3.0.0
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-24.04
needs:
- php-xdebug-docker
strategy:
matrix:
confluent:
-
version: latest
-
version: 4.1.4
-
version: 5.5.2
- version: latest
- version: 7.7.7
- version: 8.0.3
steps:
-
name: Download sources
uses: actions/download-artifact@v2
uses: actions/download-artifact@v7
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@v2
uses: actions/download-artifact@v7
with:
name: schema-registry-client-7.4
name: schema-registry-client-8.2
-
name: Load docker image
run: |
docker load -i schema-registry-client-7.4.tgz
docker load -i schema-registry-client-8.2.tgz
-
name: Install vendors
run: |
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:8.2 \
composer update --no-interaction --no-scripts --no-ansi --prefer-stable
-
name: Run PHPUnit Integration
Expand All @@ -216,5 +202,5 @@ jobs:
make platform
docker run -i --rm --net=host --sig-proxy=true --pid=host \
-e ENABLE_INTEGRATION_TEST=1 -e TEST_SCHEMA_REGISTRY_HOST=172.68.0.103 -e TEST_SCHEMA_REGISTRY_PORT=8081 \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:7.4 \
-v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" -w "${GITHUB_WORKSPACE}" schema-registry-client:8.2 \
vendor/bin/phpunit --group integration
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PHP_VERSION=7.4
ARG PHP_VERSION=8.2

FROM php:${PHP_VERSION}-cli-alpine

ARG XDEBUG_VERSION=2.9.8
ARG XDEBUG_VERSION=3.5.0

COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer --version
Expand Down
21 changes: 10 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ CONFLUENT_NETWORK_SUBNET ?= 172.68.0.0/24
CONFLUENT_NETWORK_GATEWAY ?= 172.68.0.1
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.1.12
COMPOSER_VERSION ?= 2.9.3
COMPOSER_STABILITY ?= --prefer-stable
PHP_STAN ?= bin/phpstan.phar
PHP_STAN_VERSION ?= 1.1.2
PHP_STAN_VERSION ?= 2.1.33
PHP_CS_FIXER ?= bin/php-cs-fixer.phar
PHP_CS_FIXER_VERSION ?= 3.2.1
PHP_CS_FIXER_VERSION ?= 3.92.5
PHPUNIT ?= vendor/bin/phpunit
PHP ?= bin/php
PHP_VERSION ?= 7.4
XDEBUG_VERSION ?= 3.1.1
PHP_VERSION ?= 8.2
XDEBUG_VERSION ?= 3.5.0
XDEBUG_OPTIONS ?= -d xdebug.mode=off
export

Expand Down Expand Up @@ -53,7 +52,7 @@ phpunit:

coverage:
mkdir -p build
PHP_VERSION=$(PHP_VERSION) $(PHP) -d xdebug.mode=coverage -d xdebug.coverage_enable=1 vendor/bin/phpunit --exclude-group integration \
PHP_VERSION=$(PHP_VERSION) $(PHP) -d xdebug.mode=coverage vendor/bin/phpunit --exclude-group integration \
--coverage-clover=build/coverage.clover --coverage-text

ci-local: cs-fixer phpstan phpunit
Expand All @@ -70,13 +69,13 @@ install-phars:
chmod a+x bin/phpstan.phar

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

platform-logs:
docker-compose logs -f
docker compose logs -f

clean:
rm -rf build
docker-compose down
docker compose down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Total Downloads](https://poser.pugx.org/flix-tech/confluent-schema-registry-api/downloads)](https://packagist.org/packages/flix-tech/confluent-schema-registry-api)
[![License](https://poser.pugx.org/flix-tech/confluent-schema-registry-api/license)](https://packagist.org/packages/flix-tech/confluent-schema-registry-api)

A PHP 7.4+ library to consume the Confluent Schema Registry REST API. It provides low level functions to create PSR-7
A PHP 8.2+ library to consume the Confluent Schema Registry REST API. It provides low level functions to create PSR-7
compliant requests that can be used as well as high level abstractions to ease developer experience.

#### Contents
Expand All @@ -31,27 +31,26 @@ compliant requests that can be used as well as high level abstractions to ease d

### Hard dependencies

| Dependency | Version | Reason |
|:--- |:---:|:--- |
| **`php`** | ~7.4 | Anything lower has reached EOL |
| **`guzzlephp/guzzle`** | ~7.0 | Using `Request` to build PSR-7 `RequestInterface` |
| **`beberlei/assert`** | ~2.7\|~3.0 | The de-facto standard assertions library for PHP |
| **`flix-tech/avro-php`** | ^4.1 | Maintained fork of the only Avro PHP implementation: `rg/avro-php` |
| Dependency | Version | Reason |
|:-----------------------|:----------:|:--------------------------------------------------|
| **`php`** | ~8.2 | Anything lower has reached EOL |
| **`guzzlephp/guzzle`** | ~7.0 | Using `Request` to build PSR-7 `RequestInterface` |
| **`beberlei/assert`** | ~2.7\|~3.0 | The de-facto standard assertions library for PHP |
| **`apache/avro`** | dev-main | Official apache AVRO package |

### Optional dependencies

| Dependency | Version | Reason |
|:--- |:---:|:--- |
| **`doctrine/cache`** | ~1.3 | If you want to use the `DoctrineCacheAdapter` |
| **`psr/cache`** | ^1.0 | If you want to use the `CacheItemPoolAdapter` |
| **`psr/simple-cache`** | ^1.0 | If you want to use the `SimpleCacheAdapter` |
| Dependency | Version | Reason |
|:--- |:-----------:|:--- |
| **`psr/cache`** | ^1.13\|^2.0 | If you want to use the `CacheItemPoolAdapter` |
| **`psr/simple-cache`** | ^3.0 | If you want to use the `SimpleCacheAdapter` |

## Installation

This library is installed via [`composer`](http://getcomposer.org).

```bash
composer require "flix-tech/confluent-schema-registry-api=^7.4"
composer require mattiabasone/confluent-schema-registry-api
```

> **NOTE**
Expand Down Expand Up @@ -256,7 +255,6 @@ CONFLUENT_VERSION=latest
CONFLUENT_NETWORK_SUBNET=172.68.0.0/24
SCHEMA_REGISTRY_IPV4=172.68.0.103
KAFKA_BROKER_IPV4=172.68.0.102
ZOOKEEPER_IPV4=172.68.0.101
```

##### Building the confluent platform with a specific version and run the integration tests
Expand Down
2 changes: 0 additions & 2 deletions bin/wait-for-all.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash

ZOOKEEPER_IPV4=${ZOOKEEPER_IPV4:-localhost}
KAFKA_BROKER_IPV4=${KAFKA_BROKER_IPV4:-localhost}
SCHEMA_REGISTRY_IPV4=${SCHEMA_REGISTRY_IPV4:-localhost}

bin/wait-for-it.sh "${ZOOKEEPER_IPV4}:2181" -t 30 -- echo "zookeeper is up"
bin/wait-for-it.sh "${KAFKA_BROKER_IPV4}:9092" -t 30 -- echo "kafka broker is up"
bin/wait-for-it.sh "${SCHEMA_REGISTRY_IPV4}:8081" -t 60 -- echo "schema registry is up"
Empty file modified bin/wait-for-it.sh
100644 → 100755
Empty file.
Loading