Skip to content
Open
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
18 changes: 11 additions & 7 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ jobs:
- name: "checkout"
uses: "actions/checkout@v4"

- name: "build the environment"
run: "dev/bin/docker-compose build"
- name: "setup php"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
tools: "composer, flex"

- name: "check coding standards"
run: "dev/bin/php php-cs-fixer fix --dry-run --diff --ansi"
- name: "install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
COMPOSER_PREFER_STABLE: 1

- name: clear docker volumes
if: ${{ always() }}
run: dev/bin/docker-compose down --volumes
- name: "check coding standards"
run: "vendor/bin/php-cs-fixer fix --dry-run --diff --ansi"
29 changes: 10 additions & 19 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,20 @@ jobs:
static-analysis:
name: "static analysis"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php: ['8.4']
symfony: ['7.2.*']
composer-flags: ['--prefer-stable']

env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

steps:
- name: "checkout"
uses: "actions/checkout@v4"

- name: "build the environment"
run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} php"
- name: "setup php"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
tools: "composer, flex"

- name: "install dependencies"
run: "dev/bin/php composer update --ansi ${{ matrix.composer-flags }}"
- name: "install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
COMPOSER_PREFER_STABLE: 1

- name: "run phpstan static analysis"
run: "dev/bin/php phpstan --memory-limit=256M --ansi"

- name: clear docker volumes
if: ${{ always() }}
run: dev/bin/docker-compose down --volumes
run: "vendor/bin/phpstan --ansi"
53 changes: 31 additions & 22 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,62 @@ on:
push: ~
schedule:
# Do not make it the first of the month and/or midnight since it is a very busy time
- cron: "10 10 5 * *"
- cron: "* 10 5 * *"

jobs:
tests:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.can-fail }}
runs-on: "ubuntu-latest"
continue-on-error: "${{ matrix.can-fail }}"
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
symfony: ['6.4.*', '7.1.*', '7.2.*']
doctrine-orm: ['^2.14', '^3.0']
composer-flags: ['--prefer-stable']
php: ["8.1", "8.2", "8.3", "8.4"]
symfony: ["6.4.*", "7.1.*", "7.2.*"]
doctrine-orm: ["^2.14", "^3.0"]
dependency-versions: ["highest"]
composer-stable: ["1"]
can-fail: [false]
include:
- php: "8.1"
symfony: "6.4.*"
doctrine-orm: "^2.14"
composer-flags: '--prefer-stable --prefer-lowest'
dependency-versions: "lowest"
composer-stable: "1"
can-fail: false
exclude:
- php: "8.1"
symfony: "7.1.*"
- php: "8.1"
symfony: "7.2.*"

name: "PHP ${{ matrix.php }} - Doctrine ${{ matrix.doctrine-orm }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"

env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }} - Doctrine ORM ${{ matrix.doctrine-orm }} - Composer ${{ matrix.dependency-versions }}"

steps:
- name: "checkout"
uses: "actions/checkout@v4"

- name: "build the PHP environment"
run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} --build-arg XDEBUG_VERSION='3.4.0' php"
- name: "setup php"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
tools: "composer, flex"

- name: "enable Symfony Flex plugin"
run: "composer global config --no-interaction allow-plugins.symfony/flex true"

- name: "require specific Doctrine ORM version"
run: "dev/bin/php composer require --ansi ${{ matrix.composer-flags }} --no-install doctrine/orm:${{ matrix.doctrine-orm }}"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
COMPOSER_PREFER_STABLE: "${{ matrix.composer-stable }}"
run: "composer require --no-scripts --no-install --dev doctrine/orm:${{ matrix.doctrine-orm }} --ansi"

- name: "install dependencies"
run: "dev/bin/php composer update --ansi ${{ matrix.composer-flags }}"
- name: "install composer dependencies"
uses: "ramsey/composer-install@v3"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
COMPOSER_PREFER_STABLE: "${{ matrix.composer-stable }}"
with:
dependency-versions: "${{ matrix.dependency-versions }}"

- name: "run unit tests"
run: "dev/bin/php-test vendor/bin/simple-phpunit --colors=always"

- name: clear docker volumes
if: ${{ always() }}
run: dev/bin/docker-compose down --volumes
run: "vendor/bin/simple-phpunit --colors=always"
30 changes: 6 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,56 +16,38 @@ We accept contributions via Pull Requests on [Github](https://github.com/thephpl

## Development

[Docker](https://www.docker.com/) and [Docker Compose](https://github.com/docker/compose) are required for the development environment.
[PHP](https://www.php.net/) 8.1+ and [Composer](https://getcomposer.org/) 2+ are required for the development environment.

### Building the environment

Make sure your Docker images are all built and up-to-date using the following command:
Download all the needed packages required to develop the project:

```sh
dev/bin/docker-compose build
composer update --prefer-stable
```

> **NOTE:** You can target a different version of PHP during development by appending the `--build-arg PHP_VERSION=<version>` argument.
After that, download all the needed packages required to develop the project:

```sh
dev/bin/php composer update --prefer-stable
```

### Debugging

You can run the debugger using the following command:

```sh
dev/bin/php-debug vendor/bin/simple-phpunit
```

Make sure your IDE is setup properly, for more information check out the [dedicated documentation](docs/debugging.md).

### Code linting

This bundle enforces the PSR-2 and Symfony code standards during development by using the [PHP CS Fixer](https://cs.symfony.com/) utility. Before committing any code, you can run the utility to fix any potential rule violations:

```sh
dev/bin/php php-cs-fixer fix
vendor/bin/php-cs-fixer fix
```

### Running static analysis

You can run static anaysis of code using the following command:

```sh
dev/bin/php phpstan --memory-limit=256M
vendor/bin/phpstan
```

### Testing

You can run the whole test suite using the following command:

```sh
dev/bin/php-test vendor/bin/simple-phpunit
vendor/bin/simple-phpunit
```

**Happy coding**!
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"ext-pdo_sqlite": "*",
"doctrine/doctrine-bundle": "^2.8.0",
"doctrine/orm": "^2.14|^3.0",
"php-cs-fixer/shim": "^3.38",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-symfony": "2.0",
"symfony/browser-kit": "^6.4|^7.0",
"symfony/phpunit-bridge": "^7.2"
},
Expand Down
8 changes: 0 additions & 8 deletions dev/bin/docker-compose

This file was deleted.

7 changes: 0 additions & 7 deletions dev/bin/php

This file was deleted.

10 changes: 0 additions & 10 deletions dev/bin/php-debug

This file was deleted.

8 changes: 0 additions & 8 deletions dev/bin/php-test

This file was deleted.

75 changes: 0 additions & 75 deletions dev/docker/Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions dev/docker/entrypoint.sh

This file was deleted.

18 changes: 0 additions & 18 deletions docs/debugging.md

This file was deleted.

4 changes: 2 additions & 2 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
includes:
- /home/app/.composer/vendor-bin/phpstan/vendor/phpstan/phpstan-symfony/extension.neon
- /home/app/.composer/vendor-bin/phpstan/vendor/phpstan/phpstan-symfony/rules.neon
- ./vendor/phpstan/phpstan-symfony/extension.neon
- ./vendor/phpstan/phpstan-symfony/rules.neon

parameters:
level: 8
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/FixtureFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Development hints:
*
* You can easily generate token identifiers using the following command:
* --- dev/bin/php -r "echo bin2hex(random_bytes(40)) . PHP_EOL;"
* --- php -r "echo bin2hex(random_bytes(40)) . PHP_EOL;"
*/
final class FixtureFactory
{
Expand Down