-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement coding standards and static analysis
- Loading branch information
Showing
13 changed files
with
168 additions
and
42 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
name: Headsnet Doctrine Tools Test | ||
name: CI Pipeline | ||
|
||
on: | ||
push: ~ | ||
|
@@ -11,7 +11,7 @@ jobs: | |
name: PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }} | ||
strategy: | ||
matrix: | ||
operating-system: [ 'ubuntu-22.04', 'windows-2022' ] | ||
operating-system: [ 'ubuntu-22.04' ] | ||
php: [ '8.1', '8.2', '8.3' ] | ||
symfony: ['6.4.*', '7.0.*'] | ||
exclude: | ||
|
@@ -26,11 +26,43 @@ jobs: | |
with: | ||
php-version: ${{ matrix.php }} | ||
tools: flex | ||
coverage: pcov | ||
|
||
- name: Download dependencies | ||
env: | ||
SYMFONY_REQUIRE: ${{ matrix.symfony }} | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Run test suite on PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }} | ||
run: ./vendor/bin/phpunit | ||
run: ./vendor/bin/phpunit --coverage-clover clover.xml | ||
|
||
- name: Make code coverage badge | ||
uses: timkrase/[email protected] | ||
with: | ||
coverage_badge_path: output/coverage.svg | ||
push_badge: false | ||
|
||
- name: Git push to image-data branch | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
publish_dir: ./output | ||
publish_branch: image-data | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
|
||
ecs: | ||
name: Easy Coding Standard | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ramsey/composer-install@v3 | ||
- run: vendor/bin/ecs | ||
|
||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ramsey/composer-install@v3 | ||
- run: vendor/bin/phpstan |
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,27 @@ | ||
.PHONY: help | ||
.DEFAULT_GOAL := help | ||
|
||
PHP = php | ||
PHPUNIT = ${PHP} vendor/bin/phpunit | ||
|
||
cs: ## Run ECS Coding Standards analysis | ||
@${PHP} vendor/bin/ecs check | ||
|
||
cs-fix: ## Fix ECS Coding Standards | ||
@${PHP} vendor/bin/ecs check --fix | ||
|
||
static: ## Run PHPStan static analysis | ||
@${PHP} vendor/bin/phpstan analyse | ||
|
||
test: ## Run PHPUnit tests | ||
@${PHPUNIT} | ||
|
||
test-coverage: ## Run PHPUnit tests with code coverage | ||
@${PHPUNIT} --coverage-html=var/coverage | ||
|
||
######################################################################################################################## | ||
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
help: | ||
@echo "\nMakefile is used to run various utilities related to this project\n" | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
######################################################################################################################## |
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
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
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,33 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer; | ||
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer; | ||
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer; | ||
use Symplify\EasyCodingStandard\Config\ECSConfig; | ||
use Symplify\EasyCodingStandard\ValueObject\Set\SetList; | ||
|
||
return function (ECSConfig $ecsConfig): void { | ||
$ecsConfig->paths([ | ||
__DIR__ . '/src', | ||
__DIR__ . '/tests', | ||
]); | ||
|
||
$ecsConfig->skip([ | ||
BlankLineAfterOpeningTagFixer::class, | ||
NotOperatorWithSuccessorSpaceFixer::class, | ||
]); | ||
|
||
$ecsConfig->rules([ | ||
NoUnusedImportsFixer::class, | ||
]); | ||
|
||
$ecsConfig->sets([ | ||
SetList::SPACES, | ||
SetList::ARRAY, | ||
SetList::DOCBLOCK, | ||
SetList::NAMESPACES, | ||
SetList::COMMENTS, | ||
SetList::PSR_12, | ||
]); | ||
}; |
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,10 @@ | ||
parameters: | ||
|
||
level: 9 | ||
|
||
paths: | ||
- src/ | ||
- tests/ | ||
|
||
ignoreErrors: | ||
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\).#' |
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
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
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
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
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
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
Oops, something went wrong.