|
| 1 | +# Do not edit this file! Make a pull request on changing |
| 2 | +# github/workflows/symfony/php.yaml in |
| 3 | +# https://github.com/itk-dev/devops_itkdev-docker if need be. |
| 4 | + |
| 5 | +### ### Symfony PHP |
| 6 | +### |
| 7 | +### Checks that PHP code adheres to the [Symfony coding |
| 8 | +### standards](https://symfony.com/doc/current/contributing/code/standards.html). |
| 9 | +### |
| 10 | +### #### Assumptions |
| 11 | +### |
| 12 | +### 1. A docker compose service named `phpfpm` can be run and `composer` can be |
| 13 | +### run inside the `phpfpm` service. 2. |
| 14 | +### [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) |
| 15 | +### is a dev requirement in `composer.json`: |
| 16 | +### |
| 17 | +### ``` shell |
| 18 | +### docker compose run --rm phpfpm composer require --dev friendsofphp/php-cs-fixer |
| 19 | +### ``` |
| 20 | +### |
| 21 | +### Clean up and check code by running |
| 22 | +### |
| 23 | +### ``` shell |
| 24 | +### docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix |
| 25 | +### docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff |
| 26 | +### ``` |
| 27 | +### |
| 28 | +### > [!NOTE] The template adds `.php-cs-fixer.dist.php` as [a configuration |
| 29 | +### > file for PHP CS |
| 30 | +### > Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst) |
| 31 | +### > and this makes it possible to override the actual configuration used in a |
| 32 | +### > project by adding a more important configuration file, `.php-cs-fixer.php`. |
| 33 | + |
| 34 | +name: Symfony PHP |
| 35 | + |
| 36 | +env: |
| 37 | + COMPOSE_USER: root |
| 38 | + |
| 39 | +on: |
| 40 | + pull_request: |
| 41 | + push: |
| 42 | + branches: |
| 43 | + - main |
| 44 | + - develop |
| 45 | + |
| 46 | +jobs: |
| 47 | + coding-standards: |
| 48 | + name: PHP - Check Coding Standards |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v5 |
| 52 | + |
| 53 | + - name: Create docker network |
| 54 | + run: | |
| 55 | + docker network create frontend |
| 56 | +
|
| 57 | + - run: | |
| 58 | + docker compose run --rm phpfpm composer install |
| 59 | + # https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/usage.rst#the-check-command |
| 60 | + docker compose run --rm phpfpm vendor/bin/php-cs-fixer fix --dry-run --diff |
0 commit comments