Skip to content
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
107 changes: 70 additions & 37 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: CI

on:
pull_request: ~
push:
branches:
- main
pull_request:
branches:
- main
branches: [ "main" ]

env:
PHP_VERSION: "8.4"
PHP_EXTENSIONS: "mbstring, intl, pdo_mysql, opcache, zip, bcmath"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Artifact (with permissions)
uses: actions/cache@v4
Expand All @@ -25,14 +26,17 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: symfony, composer:v2
extensions: gd,json,iconv,intl,mbstring,pdo,pdo_mysql,xml,zip,curl,apcu
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
tools: composer:v2,symfony-cli

- name: "Validate composer.json"
run: composer validate --strict

- name: Install Composer dependencies
run: |
composer validate --no-check-publish
composer install --prefer-dist --no-progress --optimize-autoloader --no-interaction
uses: ramsey/composer-install@v3
with:
composer-options: --prefer-dist --no-progress --no-interaction

- name: Cleanup build
run: |
Expand All @@ -44,7 +48,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Artifact (with permissions)
uses: actions/cache@v4
Expand All @@ -55,20 +59,20 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: symfony
extensions: gd,json,iconv,intl,mbstring,pdo,pdo_mysql,xml,zip,curl,apcu
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
tools: composer:v2,symfony-cli

- name: Security checker
run: symfony check:security
- name: "Security Check"
run: symfony security:check

coding-standards:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Artifact (with permissions)
uses: actions/cache@v4
Expand All @@ -79,23 +83,41 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: symfony
extensions: gd,json,iconv,intl,mbstring,pdo,pdo_mysql,xml,zip,curl,apcu
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
tools: symfony-cli
ini-values: memory_limit=-1

- name: Run php_codesniffer with PSR12 standard
run: composer cs
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
composer-options: --prefer-dist --no-progress --optimize-autoloader --no-interaction

- name: Run PHPStan
run: composer stan
- name: Install phpstan
uses: ramsey/composer-install@v3
with:
composer-options: --no-progress --no-scripts --prefer-dist
working-directory: tools/phpstan

- name: Run phpstan
run: tools/phpstan/vendor/bin/phpstan analyse

- name: Install php-cs-fixer
uses: ramsey/composer-install@v3
with:
composer-options: --no-progress --no-scripts --prefer-dist
working-directory: tools/php-cs-fixer

- name: Run php-cs-fixer
run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff

tests:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Artifact (with permissions)
uses: actions/cache@v4
Expand All @@ -106,17 +128,28 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: symfony
extensions: gd,json,iconv,intl,mbstring,pdo,pdo_mysql,xml,zip,curl,apcu
php-version: ${{ env.PHP_VERSION }}
extensions: ${{ env.PHP_EXTENSIONS }}
tools: symfony-cli
coverage: xdebug
ini-values: memory_limit=-1

- name: All Tests (unit & functional)
run: composer test
- name: Run PHPUnit
run: |
vendor/bin/phpunit \
--testdox \
--log-junit junit.xml \
--coverage-text \
--coverage-clover coverage.xml

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
file: junit.xml
token: ${{ secrets.CODECOV_TOKEN }}

- name: Publish coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
directory: coverage
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
/.phpunit.result.cache
/var/
.php-cs-fixer.cache
27 changes: 27 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => ['preserve_existing_declaration' => true],
'ordered_imports' => true,
'no_unused_imports' => true,
'header_comment' => [
'header' => <<<EOF
This file is part of the EnabelCodingStandardBundle.
Copyright (c) Enabel <https://github.com/Enabel>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF
]
])
->setFinder($finder)
;
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [4.0.0](https://github.com/enabel/coding-standard-bundle/tree/4.0.0) (2025-11-07)

[Full Changelog](https://github.com/enabel/coding-standard-bundle/compare/3.0.7...4.0.0)

## [3.0.7](https://github.com/enabel/coding-standard-bundle/tree/3.0.7) (2025-03-31)

[Full Changelog](https://github.com/enabel/coding-standard-bundle/compare/3.0.6...3.0.7)
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,25 @@

The bundle aims to provide basics Coding Standard and helper, including:

- PHP Code Sniffer (PSR-12)
- PHP Mess Detector
- PHPStan
- PHP Insight (Symfony)
- PHP Copy/Paste Detector
- Rector
- PHPLoc
- Twig Coding Standard
- PHPCsFixer (PSR-12, Symfony)
- PHPStan (Symfony, Doctrine, PHPUnit)
- Linter
- Twig
- Yaml
- XLIFF
- Symfony container
- Symfony services
- Doctrine
- Composer
- Makefile
- Docker (MySQL, Redis, Mailcatcher, PHPQA)
- Docker (MySQL, Redis, Mailcatcher)

## Installation & usage

You can check docs [here](docs/index.md)

## Versions & dependencies

The current version of the bundle works with Symfony 6.0+.
The current version of the bundle works with Symfony 7.0+.
The project follows SemVer.

You can check the [changelog](CHANGELOG.md).
Expand All @@ -46,9 +40,8 @@ or [creating issues](https://github.com/enabel/coding-standard-bundle/issues)
Note there are a few helpers to maintain code quality, that you can run using these commands:

```bash
composer cs # Code style check
composer csf # Code style check
composer stan # Static analysis
composer insight # Code analysis
composer test # Run tests
```

Loading