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
50 changes: 50 additions & 0 deletions .github/workflows/config-shape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Check Configuration Shape"

on:
pull_request:
push:
branches:
- "[0-9]+.[0-9]+.x"
- "renovate/*"

jobs:
config-shape:
name: "Configuration shape is up to date"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.5"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v7

- name: "Install PHP"
uses: "shivammathur/setup-php@2.37.2"
with:
coverage: none
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1, opcache.enable_cli=1

- uses: ramsey/composer-install@4.0.0
with:
dependency-versions: ${{ matrix.dependencies }}

- name: "Generate configuration shape"
run: "bin/generate-config-shape"

- name: "Check for changes"
run: |
if ! git diff --exit-code -- src/Container/Configuration.php; then
echo "::error file=src/Container/Configuration.php::The configuration shape is outdated, run \"make config-shape\" and commit the changes."
exit 1
fi
61 changes: 61 additions & 0 deletions .github/workflows/container-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Container integration tests"

on:
pull_request:
push:
branches:
- "[0-9]+.[0-9]+.x"
- "renovate/*"

jobs:
container:
name: "${{ matrix.container }}"

runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
dependencies:
- "locked"
php-version:
- "8.5"
operating-system:
- "ubuntu-latest"
container:
- "PHP-DI"
- "Laminas ServiceManager"
- "League Container"
include:
- container: "PHP-DI"
package: "php-di/php-di:^7.0"
test: "PhpDiContainerTest"
- container: "Laminas ServiceManager"
package: "laminas/laminas-servicemanager:^4.0"
test: "LaminasServiceManagerTest"
- container: "League Container"
package: "league/container:^5.0"
test: "LeagueContainerTest"

steps:
- name: "Checkout"
uses: actions/checkout@v7

- name: "Install PHP"
uses: "shivammathur/setup-php@2.37.2"
with:
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
extensions: pdo_sqlite

- uses: ramsey/composer-install@4.0.0
with:
dependency-versions: ${{ matrix.dependencies }}

- name: "Install ${{ matrix.container }}"
run: "composer require --dev --no-interaction --no-progress '${{ matrix.package }}'"

- name: "Tests"
run: "vendor/bin/phpunit tests/Integration/Container/${{ matrix.test }}.php"
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ phpunit-integration-postgres: vendor
phpunit-integration-mysql: vendor ## run phpunit integration tests on mysql
DB_URL="pdo-mysql://root@127.0.0.1:3306/eventstore?charset=utf8" vendor/bin/phpunit --testsuite=integration

.PHONY: phpunit-container
phpunit-container: vendor ## run phpunit integration tests with third party containers (changes composer.json)
composer require --dev php-di/php-di laminas/laminas-servicemanager league/container
vendor/bin/phpunit --no-coverage tests/Integration/Container

.PHONY: phpunit-unit
phpunit-unit: vendor ## run phpunit unit tests
XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite=unit
Expand Down Expand Up @@ -74,6 +79,10 @@ benchmark-diff-test: benchmark-base benchmark-diff
.PHONY: dev
dev: static test ## run dev tools

.PHONY: config-shape
config-shape: vendor ## generate the array shapes of the container configuration
bin/generate-config-shape

.PHONY: docs-extract-php
docs-extract-php:
bin/docs-extract-php-code
Expand Down
16 changes: 16 additions & 0 deletions bin/generate-config-shape
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

use Patchlevel\EventSourcing\Container\Configuration;
use Patchlevel\EventSourcing\Container\ConfigurationShapeGenerator;

require __DIR__ . '/../vendor/autoload.php';

$file = __DIR__ . '/../src/Container/Configuration.php';

file_put_contents(
$file,
(new ConfigurationShapeGenerator())->generate(Configuration::tree(), (string)file_get_contents($file)),
);
5 changes: 5 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ You can create it with the [schema commands](#schema-commands).

## CLI example

:::tip
If you use the [container](container.md), `Factory::commands()` returns all commands already configured.
:::

A cli php file can look like this:

```php
Expand Down Expand Up @@ -545,5 +549,6 @@ Here you can find more information on how to
## Learn more

* [How to configure store](store.md)
* [How to configure the container](container.md)
* [How to configure subscription engine](subscription.md)
* [How to use subscriptions](subscription.md#usage)
Loading
Loading