-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from oleksandr-gribiennikov-paysera/bring_libra…
…ry_code_up_to_php_7.4_standards Bring library code up to php 7.4 standards
- Loading branch information
Showing
56 changed files
with
8,464 additions
and
2,470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check styling | ||
|
||
on: [pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
style: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup PHP for checking styling | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
coverage: none | ||
extensions: mbstring, pdo, xml, xdebug | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install PHP dependencies for checking styling | ||
run: composer install --no-cache --no-interaction --no-progress --ignore-platform-reqs | ||
|
||
- name: Check styling | ||
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection ./src ./tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: PHPStan | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
- 'phpstan.neon.dist' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
phpstan: | ||
name: phpstan | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP for PHPStan | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
extensions: mbstring, pdo, xml | ||
|
||
- name: Install PHPStan dependencies | ||
run: composer install --no-cache --no-interaction --no-progress --ignore-platform-reqs | ||
|
||
- name: Run PHPStan | ||
run: | | ||
./vendor/bin/phpstan --error-format=github analyse src/ | ||
exit_code=$? | ||
if [ $exit_code -ne 0 ]; then | ||
echo "PHPStan analysis failed with exit code $exit_code" | ||
exit $exit_code | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Run tests | ||
|
||
on: [pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [8.3, 8.2, 8.1, 8.0, 7.4] | ||
dependency-version: [prefer-lowest, prefer-stable] | ||
os: [ubuntu-latest] | ||
|
||
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
run: docker build -t lib_webtopay_ci --build-arg PHP_VER=${{ matrix.php }} . | ||
|
||
- name: Run tests in Docker container | ||
run: | | ||
docker run --rm \ | ||
-u root \ | ||
-v $GITHUB_WORKSPACE:/var/www \ | ||
lib_webtopay_ci \ | ||
/bin/bash -c "mkdir -p /var/www/vendor && composer install --no-cache --no-interaction --no-progress --ignore-platform-reqs && composer run phpunit" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
/vendor | ||
composer.lock | ||
.composer | ||
.phpunit.result.cache | ||
coverage | ||
.bash_history | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in([ | ||
__DIR__ . DIRECTORY_SEPARATOR . 'src', | ||
__DIR__ . DIRECTORY_SEPARATOR . 'tests', | ||
]) | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR12' => true, | ||
'@PHP82Migration' => true, | ||
'strict_param' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'declare_strict_types' => true, | ||
]) | ||
->setFinder($finder) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ARG PHP_VER | ||
FROM php:${PHP_VER}-fpm | ||
|
||
RUN groupmod -g 1000 www-data && usermod -u 1000 -g 1000 www-data | ||
|
||
RUN pecl install pcov \ | ||
&& docker-php-ext-enable pcov | ||
|
||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/download/2.1.2/install-php-extensions /usr/local/bin/ | ||
|
||
RUN chmod +x /usr/local/bin/install-php-extensions | ||
RUN install-php-extensions \ | ||
xdebug \ | ||
@composer | ||
|
||
RUN echo "\n[PHP]" >> /usr/local/etc/php/conf.d/docker-fpm.ini \ | ||
&& echo "error_reporting=E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED" >> /usr/local/etc/php/conf.d/docker-fpm.ini \ | ||
&& echo "memory_limit=512M" >> /usr/local/etc/php/conf.d/docker-fpm.ini \ | ||
&& echo "upload_max_filesize=16M" >> /usr/local/etc/php/conf.d/docker-fpm.ini \ | ||
&& echo "max_post_size=16M" >> /usr/local/etc/php/conf.d/docker-fpm.ini | ||
|
||
RUN echo "\n[xdebug]" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "zend_extension=xdebug.so" > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.mode=develop,debug,coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.client_discovery_header=\"\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.client_host=\"host.docker.internal\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.client_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.discover_client_host=On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.output_dir = \"/var/log/nginx/xdebug.log\"" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.remote_cookie_expire_time=3600" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.start_with_request=On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.max_nesting_level=512" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo "xdebug.log_level=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
USER 1000 | ||
WORKDIR /var/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM php:7.4-fpm-buster | ||
|
||
RUN groupmod -g 1000 www-data && usermod -u 1000 -g 1000 www-data | ||
|
||
ADD https://github.com/mlocati/docker-php-extension-installer/releases/download/2.1.2/install-php-extensions /usr/local/bin/ | ||
|
||
RUN chmod +x /usr/local/bin/install-php-extensions | ||
RUN install-php-extensions \ | ||
xdebug \ | ||
@composer | ||
|
||
USER 1000 | ||
WORKDIR /var/www |
Oops, something went wrong.