Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: update to latest php clean up package" #21

Merged
merged 7 commits into from
Sep 28, 2023
Merged
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
60 changes: 25 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,52 @@
name: Continous integration
on: [push, pull_request]
on:
pull_request:
push:
branches:
- master
jobs:
cs:
name: Check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: phpcs
extensions: xmlwriter
- uses: actions/checkout@v3
- uses: ramsey/composer-install@v2
- name: Test code style
run: phpcs
run: vendor/bin/ecs
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.4']
php: ['8.1', '8.2']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl
coverage: pcov
extensions: mbstring, curl, json, pdo-sqlite
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Install dependencies
run: composer install --prefer-dist
- uses: ramsey/composer-install@v2
- name: Run tests
run: composer test -- --coverage-xml
- name: Get Ocular
run: wget https://scrutinizer-ci.com/ocular.phar
- name: Push code coverage
run: php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
release:
name: Automated release
needs: [test, cs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: install dependencies for semantic-release
run: npm ci
- run: $(npm bin)/semantic-release
node-version: 18
- run: >
npx
-p "@semantic-release/commit-analyzer"
-p "@semantic-release/release-notes-generator"
-p conventional-changelog-conventionalcommits
-p semantic-release
-- semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
packages: read
contents: read
35 changes: 0 additions & 35 deletions .php_cs.dist

This file was deleted.

14 changes: 0 additions & 14 deletions .phpcs.xml.dist

This file was deleted.

17 changes: 0 additions & 17 deletions .scrutinizer.yml

This file was deleted.

4 changes: 2 additions & 2 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
paths:
tests: tests
log: tests/_output
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
Expand All @@ -27,4 +27,4 @@ coverage:
enabled: true
include:
- src/*.php
# c3_url: 'http://%WEB_IP%'
# c3_url: 'http://%WEB_IP%'
33 changes: 12 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
}
],
"require": {
"php": "^7.4 | > 8",
"sam-it/docker-php": ">= 1.0.5"
"php": ">= 8.1",
"sam-it/docker-php": "^2"
},
"repositories": [
{
Expand All @@ -25,28 +25,19 @@
}
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"codeception/codeception": "> 4",
"yiisoft/yii2": "> 2",
"brainmaestro/composer-git-hooks": "^2.8",
"codeception/module-yii2": "^1.1"
},
"extra": {
"hooks": {
"pre-commit": [
"echo committing as $(git config user.name) &&",
"composer lint-fix &&",
"composer lint &&",
"composer test"
],
"commit-msg": [
"npx commitlint -e $1"
]
}
"codeception/module-yii2": "^1.1",
"symplify/easy-coding-standard": "^12.0",
"phpstan/phpstan": "^1.10",
"captainhook/captainhook": "^5.16"
},
"scripts": {
"lint": "vendor/bin/phpcs",
"lint-fix": "vendor/bin/phpcbf",
"test": "codecept run --coverage"
"test": "codecept run --coverage-html"
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true
}
}
}
49 changes: 49 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

// ecs.php
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ClassNotation\FinalInternalClassFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
// Parallel
$ecsConfig->parallel();

// Paths
$ecsConfig->paths([
__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php'
]);

// A. full sets
$ecsConfig->sets([SetList::PSR_12, SetList::SPACES]);

$ecsConfig->rule(NotOperatorWithSuccessorSpaceFixer::class);
$ecsConfig->rule(ArraySyntaxFixer::class);
$ecsConfig->rule(NoUnusedImportsFixer::class);
$ecsConfig->rule(DeclareStrictTypesFixer::class);
$ecsConfig->ruleWithConfiguration(FinalInternalClassFixer::class, [
'annotation_exclude' => ['@not-fix'],
'annotation_include' => [],
'consider_absent_docblock_as_internal_class' => \true
]);
$ecsConfig->rule(PhpdocAlignFixer::class);

$ecsConfig->ruleWithConfiguration(ForbiddenFunctionsSniff::class, [
'forbiddenFunctions' => [
'passthru' => null,
'var_dump' => null,
]
]);
$ecsConfig->skip([
NotOperatorWithSuccessorSpaceFixer::class,
__DIR__ . '/tests/_support/_generated/*'
]);
};
Loading