Skip to content

Commit ea730bb

Browse files
haebercalinblaga
andauthored
feat(BE-2913): update guzzle ci and docker (#17)
* feat(BE-2913): update guzzle ci and docker * feat(BE-2913): docker adjustments * chore(): code & tests adjustments * feat(BE-2913): T&V Feedback; remove useless or wrong PHPDoc Co-authored-by: Călin Blaga <[email protected]>
1 parent cbff245 commit ea730bb

22 files changed

+195
-229
lines changed

.circleci/config.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,27 @@ orbs:
55
ci-php: jobcloud/[email protected]
66

77
workflows:
8-
php-kafka-schema-registry-client:
8+
version: 2
9+
test-php-kafka-schema-registry-client:
910
jobs:
10-
- ci-caching/build-docker-images:
11-
dockerComposeFile: "./docker/docker-compose.yml"
11+
- ci-caching/build-docker-images
1212
- ci-php/install-dependencies:
13-
dockerComposeFile: "./docker/docker-compose.yml"
1413
dependencyCheckSumFile: "./composer.json"
1514
requires:
1615
- ci-caching/build-docker-images
1716
- ci-php/coverage:
18-
dockerComposeFile: "./docker/docker-compose.yml"
1917
dependencyCheckSumFile: "./composer.json"
2018
requires:
2119
- ci-php/install-dependencies
2220
- ci-php/code-style:
23-
dockerComposeFile: "./docker/docker-compose.yml"
2421
dependencyCheckSumFile: "./composer.json"
2522
requires:
2623
- ci-php/install-dependencies
2724
- ci-php/static-analysis:
28-
dockerComposeFile: "./docker/docker-compose.yml"
2925
dependencyCheckSumFile: "./composer.json"
3026
requires:
3127
- ci-php/install-dependencies
3228
- ci-php/infection-testing:
33-
dockerComposeFile: "./docker/docker-compose.yml"
3429
dependencyCheckSumFile: "./composer.json"
3530
requires:
3631
- ci-php/install-dependencies

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
# Packages
55
vendor/
66
composer.lock
7-
composer.symlink
87

98
# Builds & caches
109
/build/
1110
.phpunit.result.cache
12-

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ composer require jobcloud/php-kafka-schema-registry-client
1111
```
1212

1313
## Requirements
14-
- php: >= 7.4
14+
- php: ^7.4|^8.0
1515

1616
## Supported API calls
1717
Currently it supports:

composer.json

+19-12
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,42 @@
55
"keywords": ["kafka", "schema", "registry", "php"],
66
"autoload": {
77
"psr-4": {
8-
"Jobcloud\\Kafka\\SchemaRegistryClient\\": "src/",
8+
"Jobcloud\\Kafka\\SchemaRegistryClient\\": "src/"
9+
}
10+
},
11+
"autoload-dev": {
12+
"psr-4": {
913
"Jobcloud\\Kafka\\SchemaRegistryClient\\Tests\\": "tests/"
1014
}
1115
},
1216
"authors": [
1317
{
14-
"name": "Jobcloud AG",
18+
"name": "JobCloud AG",
1519
"homepage": "https://careers.jobcloud.ch/en/our-team/?term=133"
1620
}
1721
],
1822
"require": {
19-
"php": ">=7.4",
23+
"php": "^7.4|^8.0",
2024
"ext-json": "*",
21-
"psr/http-message": "^1.0",
25+
"psr/http-message": "^1.0.1",
2226
"psr/http-client": "^1.0.1"
2327
},
2428
"require-dev": {
25-
"infection/infection": "^0.25",
26-
"kriswallsmith/buzz": "^1.0",
27-
"nyholm/psr7": "^1.2",
28-
"php-mock/php-mock-phpunit": "^2.6",
29-
"phpstan/phpstan": "^1.2",
30-
"phpunit/phpunit": "^9.5",
31-
"pimple/pimple": "^3.2",
29+
"infection/infection": "^0.26.6",
30+
"kriswallsmith/buzz": "^1.2.1",
31+
"nyholm/psr7": "^1.5.1",
32+
"php-mock/php-mock-phpunit": "^2.6.0",
33+
"phpstan/phpstan": "^1.7.15",
34+
"phpunit/phpunit": "^9.5.21",
35+
"pimple/pimple": "^3.5.0",
3236
"rregeer/phpunit-coverage-check": "^0.3.1",
33-
"squizlabs/php_codesniffer": "^3.4.2"
37+
"squizlabs/php_codesniffer": "^3.7.1"
3438
},
3539
"config": {
3640
"sort-packages": true,
41+
"platform": {
42+
"php": "7.4.7"
43+
},
3744
"allow-plugins": {
3845
"infection/extension-installer": true
3946
}

docker/dev/php/Dockerfile

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
FROM php:7.4-cli-alpine3.15
1+
FROM php:8.1-cli-alpine3.16
22

3-
ARG HOST_USER_ID
3+
ARG USER_ID
4+
5+
COPY files/bin /usr/local/bin/
6+
COPY files/php /phpIni
47

58
# SYS: Install required packages
69
RUN apk --no-cache upgrade && \
710
apk --no-cache add bash git sudo autoconf gcc g++ make make shadow
811

9-
COPY dev/php/files/bin/ /usr/local/bin/
10-
1112
# Set host user id if given, to avoid permission conflicts in dev
12-
RUN /bin/bash -c 'if [ -n "$HOST_USER_ID" ] && [ "$HOST_USER_ID" -lt 60000 ]; then \
13-
usermod -u ${HOST_USER_ID} www-data; \
14-
fi'
13+
RUN if [ -n "$USER_ID" ] && [ "$USER_ID" -lt 60001 ]; then \
14+
usermod -u ${USER_ID} -o www-data; \
15+
fi
1516

1617
RUN usermod -s /bin/bash www-data && \
1718
echo 'www-data ALL=(ALL) NOPASSWD: ALL' > '/etc/sudoers.d/www-data'
1819

20+
# USER: copy home
21+
COPY --chown=www-data:www-data files/user-home /home/www-data
22+
1923
# PHP: Install php extensions
2024
RUN pecl channel-update pecl.php.net && \
2125
pecl install pcov && \

docker/dev/php/files/php/20-pcov.ini

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=pcov.so
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
alias cls='printf "\033c"'
2+
3+
export PS1='\[\e[1;32m\]\h\[\e[0m\] \[\e[1;37m\]\w\[\e[0m\] \[\e[1;32m\]\u\[\e[0m\] \[\e[1;37m\]\$\[\e[0m\] '
4+
5+
if [ -f ~/.bash_aliases ]; then
6+
. ~/.bash_aliases
7+
fi

docker/docker-compose.ci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.2'
2+
3+
services:
4+
php:
5+
hostname: kafka-schema-registry-client-php
6+
container_name: kafka-schema-registry-client-php
7+
build:
8+
context: dev/php
9+
args:
10+
USER_ID: ${USER_ID}
11+
volumes:
12+
- ../:/var/www/html
13+
tty: true

docker/docker-compose.dev.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.2'
2+
3+
services:
4+
php:
5+
hostname: kafka-schema-registry-client-php
6+
container_name: kafka-schema-registry-client-php
7+
build:
8+
context: dev/php
9+
args:
10+
USER_ID: ${USER_ID}
11+
volumes:
12+
- ../:/var/www/html
13+
tty: true

docker/docker-compose.yml

-17
This file was deleted.

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
33
<file>src</file>
4+
<file>tests</file>
45
<rule ref="PSR12"/>
56
<arg name="report-gitblame"/>
67
<arg name="report-full"/>

src/ErrorHandler.php

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
class ErrorHandler implements ErrorHandlerInterface
2727
{
2828
/**
29-
* @param ResponseInterface $response
30-
* @param string|null $uri
31-
* @param RequestInterface|null $request
32-
* @return void
3329
* @throws BackendDatastoreException
3430
* @throws ClientException
3531
* @throws CompatibilityException

src/ErrorHandlerInterface.php

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
interface ErrorHandlerInterface
1212
{
1313
/**
14-
* @param ResponseInterface $response
15-
* @param string|null $uri
1614
* @throws ClientExceptionInterface
1715
* @throws SchemaRegistryExceptionInterface
1816
* @throws JsonException

src/HttpClient.php

-13
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ class HttpClient implements HttpClientInterface
4141
*/
4242
private $errorHandler;
4343

44-
/**
45-
* @param ClientInterface $client
46-
* @param RequestFactoryInterface $requestFactory
47-
* @param ErrorHandlerInterface $errorHandler
48-
* @param string $baseUrl
49-
* @param string|null $username
50-
* @param string|null $password
51-
*/
5244
public function __construct(
5345
ClientInterface $client,
5446
RequestFactoryInterface $requestFactory,
@@ -66,11 +58,8 @@ public function __construct(
6658
}
6759

6860
/**
69-
* @param string $method
70-
* @param string $uri
7161
* @param array<string,mixed> $body
7262
* @param array<string,mixed> $queryParams
73-
* @return RequestInterface
7463
* @throws JsonException
7564
*/
7665
private function createRequest(
@@ -108,8 +97,6 @@ private function createRequest(
10897
}
10998

11099
/**
111-
* @param string $method
112-
* @param string $uri
113100
* @param array<string,mixed> $body
114101
* @param array<string,mixed> $queryParams
115102
* @return mixed

src/HttpClientInterface.php

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
interface HttpClientInterface
1010
{
1111
/**
12-
* @param string $method
13-
* @param string $uri
1412
* @param array<string,mixed> $body
1513
* @param array<string,mixed> $queryParams
1614
* @return mixed

0 commit comments

Comments
 (0)