From 63c7e56e7f1d2dd0faf8c319f890fa5b3e42a0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Thu, 9 Jan 2025 10:01:11 +0100 Subject: [PATCH] Add meta --- .github/workflows/cqrs_pack.yml | 10 ++-------- .github/workflows/split_packages.yaml | 6 +++--- src/Cqrs/.gitattributes | 5 ----- src/Cqrs/.gitignore | 4 ---- src/meta/cqrs-meta/composer.json | 6 ++++++ src/{Cqrs => pack/cqrs-pack}/composer.json | 5 +---- tests/Cqrs/.gitignore | 1 + .../Application/Command/CommandHandlerTest.php | 0 {src => tests}/Cqrs/Makefile | 12 ++++++------ {src/Cqrs => tests/Cqrs/resources}/phpunit.xml.dist | 4 ++-- .../src/Book/Application/Command/BookCommand.php | 0 .../Book/Application/Command/BookCommandHandler.php | 0 12 files changed, 21 insertions(+), 32 deletions(-) delete mode 100644 src/Cqrs/.gitattributes delete mode 100644 src/Cqrs/.gitignore create mode 100644 src/meta/cqrs-meta/composer.json rename src/{Cqrs => pack/cqrs-pack}/composer.json (65%) create mode 100644 tests/Cqrs/.gitignore rename {src/Cqrs/tests => tests/Cqrs}/Integration/Shared/Application/Command/CommandHandlerTest.php (100%) rename {src => tests}/Cqrs/Makefile (60%) rename {src/Cqrs => tests/Cqrs/resources}/phpunit.xml.dist (88%) rename {src/Cqrs/tests/Resources => tests/Cqrs/resources}/src/Book/Application/Command/BookCommand.php (100%) rename {src/Cqrs/tests/Resources => tests/Cqrs/resources}/src/Book/Application/Command/BookCommandHandler.php (100%) diff --git a/.github/workflows/cqrs_pack.yml b/.github/workflows/cqrs_pack.yml index 12c8cf1..fef9acf 100644 --- a/.github/workflows/cqrs_pack.yml +++ b/.github/workflows/cqrs_pack.yml @@ -50,18 +50,12 @@ jobs: ${{ steps.composer-cache.outputs.dir }} key: ${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }} - - name: "Validate composer.json" - run: (cd src/Cqrs && composer validate --no-check-version) - - - name: "Install dependencies" - run: (cd src/Cqrs && composer update --no-interaction --no-scripts) - - name: "Create test application" run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" - (cd src/Cqrs && make create-test-application) + (cd tests/Cqrs && make create-test-application) id: end-of-setup - name: "Run PHPUnit" - run: (cd src/Cqrs && vendor/bin/phpunit) + run: (cd tests/Cqrs/app && vendor/bin/phpunit) diff --git a/.github/workflows/split_packages.yaml b/.github/workflows/split_packages.yaml index 0b2b4d6..5cbd7f9 100644 --- a/.github/workflows/split_packages.yaml +++ b/.github/workflows/split_packages.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: package: - - { name: 'Cqrs', path: 'cqrs-pack' } + - { path: 'pack/cqrs-pack', name: 'cqrs-pack' } steps: - uses: actions/checkout@v3 with: @@ -27,9 +27,9 @@ jobs: - name: Split of ${{ matrix.package.name }} uses: alphpaca/monoplus-split-action@2022.1-beta3 with: - package_path: 'src/${{ matrix.package.name }}' + package_path: 'src/${{ matrix.package.pack }}' personal_access_token: ${{ secrets.MONOPLUS_PAT }} git_username: 'loic425' git_email: 'lc.fremont@gmail.com' repository_owner: "monofony" - repository_name: "${{ matrix.package.path }}" + repository_name: "${{ matrix.package.name }}" diff --git a/src/Cqrs/.gitattributes b/src/Cqrs/.gitattributes deleted file mode 100644 index abbb7c9..0000000 --- a/src/Cqrs/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -/.gitattributes export-ignore -/.gitignore export-ignore -/Makefile export-ignore -/phpunit.xml.dist export-ignore -/tests export-ignore diff --git a/src/Cqrs/.gitignore b/src/Cqrs/.gitignore deleted file mode 100644 index 97f77b7..0000000 --- a/src/Cqrs/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.phpunit.result.cache -composer.lock -/vendor -/tests/app diff --git a/src/meta/cqrs-meta/composer.json b/src/meta/cqrs-meta/composer.json new file mode 100644 index 0000000..478f7ef --- /dev/null +++ b/src/meta/cqrs-meta/composer.json @@ -0,0 +1,6 @@ +{ + "name": "monofony/cqrs-meta", + "type": "metapackage", + "license": "MIT", + "description": "A meta package providing recipes for CQRS" +} diff --git a/src/Cqrs/composer.json b/src/pack/cqrs-pack/composer.json similarity index 65% rename from src/Cqrs/composer.json rename to src/pack/cqrs-pack/composer.json index 1855e98..0176736 100644 --- a/src/Cqrs/composer.json +++ b/src/pack/cqrs-pack/composer.json @@ -1,13 +1,10 @@ { "name": "monofony/cqrs-pack", "description": "Pack for CQRS", - "type": "meta-package", + "type": "symfony-pack", "license": "MIT", "require": { "php": "^8.3", "symfony/messenger": "*" - }, - "require-dev": { - "phpunit/phpunit": "^11.4" } } diff --git a/tests/Cqrs/.gitignore b/tests/Cqrs/.gitignore new file mode 100644 index 0000000..b80f0bd --- /dev/null +++ b/tests/Cqrs/.gitignore @@ -0,0 +1 @@ +app diff --git a/src/Cqrs/tests/Integration/Shared/Application/Command/CommandHandlerTest.php b/tests/Cqrs/Integration/Shared/Application/Command/CommandHandlerTest.php similarity index 100% rename from src/Cqrs/tests/Integration/Shared/Application/Command/CommandHandlerTest.php rename to tests/Cqrs/Integration/Shared/Application/Command/CommandHandlerTest.php diff --git a/src/Cqrs/Makefile b/tests/Cqrs/Makefile similarity index 60% rename from src/Cqrs/Makefile rename to tests/Cqrs/Makefile index cdd0ead..0963732 100644 --- a/src/Cqrs/Makefile +++ b/tests/Cqrs/Makefile @@ -1,21 +1,21 @@ TEST_APP_BASENAME=app -TEST_APP_DIR?=tests/${TEST_APP_BASENAME} +TEST_APP_DIR?=${TEST_APP_BASENAME} .PHONY: create-test-application create-test-application: remove-test-application install-skeleton add-requirements copy-recipe copy-tests-resources .PHONY: remove-test-application remove-test-application: - (cd tests && rm -rf ${TEST_APP_BASENAME}) + rm -rf ${TEST_APP_BASENAME} .PHONY: install-skeleton install-skeleton: - (cd tests && symfony new ${TEST_APP_BASENAME}) + symfony new ${TEST_APP_BASENAME} .PHONY: add-requirements add-requirements: - (cd ${TEST_APP_DIR} && composer require symfony/messenger) - (cd ${TEST_APP_DIR} && composer require --dev phpunit/phpunit) + (cd ${TEST_APP_BASENAME} && composer require symfony/messenger) + (cd ${TEST_APP_BASENAME} && composer require --dev phpunit/phpunit) .PHONY: copy-recipe copy-recipe: @@ -23,4 +23,4 @@ copy-recipe: .PHONY: copy-tests-resources copy-tests-resources: - cp -R tests/Resources/* ${TEST_APP_DIR} + cp -R resources/* ${TEST_APP_DIR} diff --git a/src/Cqrs/phpunit.xml.dist b/tests/Cqrs/resources/phpunit.xml.dist similarity index 88% rename from src/Cqrs/phpunit.xml.dist rename to tests/Cqrs/resources/phpunit.xml.dist index f87df71..86abc51 100644 --- a/src/Cqrs/phpunit.xml.dist +++ b/tests/Cqrs/resources/phpunit.xml.dist @@ -5,7 +5,7 @@ xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" backupGlobals="false" colors="true" - bootstrap="tests/app/tests/bootstrap.php" + bootstrap="tests/bootstrap.php" > @@ -18,7 +18,7 @@ - tests/Integration + ../Integration diff --git a/src/Cqrs/tests/Resources/src/Book/Application/Command/BookCommand.php b/tests/Cqrs/resources/src/Book/Application/Command/BookCommand.php similarity index 100% rename from src/Cqrs/tests/Resources/src/Book/Application/Command/BookCommand.php rename to tests/Cqrs/resources/src/Book/Application/Command/BookCommand.php diff --git a/src/Cqrs/tests/Resources/src/Book/Application/Command/BookCommandHandler.php b/tests/Cqrs/resources/src/Book/Application/Command/BookCommandHandler.php similarity index 100% rename from src/Cqrs/tests/Resources/src/Book/Application/Command/BookCommandHandler.php rename to tests/Cqrs/resources/src/Book/Application/Command/BookCommandHandler.php