diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml new file mode 100644 index 0000000..98f1239 --- /dev/null +++ b/.github/workflows/run-test.yml @@ -0,0 +1,41 @@ +name: Unit tests, static analysis and code style + +on: + push: + branches: + - develop + - 'release/**' + - 'hotfix/**' + tags: ['**'] + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + +jobs: + run-tests: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: ['8.0', '8.1'] + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + - uses: actions/checkout@v3 + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php-version }}- + - name: Install Dependencies + run: composer install --no-scripts --no-ansi --no-interaction --no-progress + - name: Run PHP Code Sniffer + run: vendor/bin/phpcs -p ./src + - name: Run PHPStan + run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon diff --git a/.travis.yml b/.travis.yml index ed91b5e..eb3285d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php sudo: required php: - - 7.4 - 8.0 - 8.1 - nightly diff --git a/README.md b/README.md index 154e145..d230c90 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # doc-generator Roadiz sub-package which generates Markdown documentation skeleton based on your schema + +[![Unit tests, static analysis and code style](https://github.com/roadiz/doc-generator/actions/workflows/run-test.yml/badge.svg?branch=develop)](https://github.com/roadiz/doc-generator/actions/workflows/run-test.yml) + +## Contributing + +Report [issues](https://github.com/roadiz/core-bundle-dev-app/issues) and send [Pull Requests](https://github.com/roadiz/core-bundle-dev-app/pulls) in the [main Roadiz repository](https://github.com/roadiz/core-bundle-dev-app) diff --git a/composer.json b/composer.json index 301f8c3..e306044 100644 --- a/composer.json +++ b/composer.json @@ -3,25 +3,33 @@ "description": "Roadiz sub-package which generates Markdown documentation skeleton based on your schema", "type": "library", "require": { - "php": ">=7.4", + "php": ">=8.0", "roadiz/nodetype-contracts": "~1.1.2", - "symfony/translation": "~4.4.1 || ^5.2", - "symfony/http-foundation": "~5.0.7 || ^5.2" + "symfony/translation": "5.4.*", + "symfony/http-foundation": "5.4.*" }, "license": "MIT", "authors": [ { "name": "Ambroise Maupate", - "email": "ambroise@rezo-zero.com" + "email": "ambroise@roadiz.io", + "homepage": "https://www.roadiz.io", + "role": "Lead developer" } ], "autoload": { "psr-4": { - "RZ\\Roadiz\\": "src/" + "RZ\\Roadiz\\Documentation\\": "src/" } }, "require-dev": { "phpstan/phpstan": "^1.5.3", "squizlabs/php_codesniffer": "^3.5" + }, + "extra": { + "branch-alias": { + "dev-main": "2.0.x-dev", + "dev-develop": "2.2.x-dev" + } } } diff --git a/src/Documentation/Generators/AbstractFieldGenerator.php b/src/Generators/AbstractFieldGenerator.php similarity index 100% rename from src/Documentation/Generators/AbstractFieldGenerator.php rename to src/Generators/AbstractFieldGenerator.php diff --git a/src/Documentation/Generators/ChildrenNodeFieldGenerator.php b/src/Generators/ChildrenNodeFieldGenerator.php similarity index 100% rename from src/Documentation/Generators/ChildrenNodeFieldGenerator.php rename to src/Generators/ChildrenNodeFieldGenerator.php diff --git a/src/Documentation/Generators/CommonFieldGenerator.php b/src/Generators/CommonFieldGenerator.php similarity index 100% rename from src/Documentation/Generators/CommonFieldGenerator.php rename to src/Generators/CommonFieldGenerator.php diff --git a/src/Documentation/Generators/DefaultValuedFieldGenerator.php b/src/Generators/DefaultValuedFieldGenerator.php similarity index 100% rename from src/Documentation/Generators/DefaultValuedFieldGenerator.php rename to src/Generators/DefaultValuedFieldGenerator.php diff --git a/src/Documentation/Generators/DocumentationGenerator.php b/src/Generators/DocumentationGenerator.php similarity index 100% rename from src/Documentation/Generators/DocumentationGenerator.php rename to src/Generators/DocumentationGenerator.php diff --git a/src/Documentation/Generators/MarkdownGeneratorFactory.php b/src/Generators/MarkdownGeneratorFactory.php similarity index 100% rename from src/Documentation/Generators/MarkdownGeneratorFactory.php rename to src/Generators/MarkdownGeneratorFactory.php diff --git a/src/Documentation/Generators/NodeReferencesFieldGenerator.php b/src/Generators/NodeReferencesFieldGenerator.php similarity index 100% rename from src/Documentation/Generators/NodeReferencesFieldGenerator.php rename to src/Generators/NodeReferencesFieldGenerator.php diff --git a/src/Documentation/Generators/NodeTypeGenerator.php b/src/Generators/NodeTypeGenerator.php similarity index 98% rename from src/Documentation/Generators/NodeTypeGenerator.php rename to src/Generators/NodeTypeGenerator.php index 4b5a4b9..4a98426 100644 --- a/src/Documentation/Generators/NodeTypeGenerator.php +++ b/src/Generators/NodeTypeGenerator.php @@ -6,7 +6,6 @@ use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface; use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface; -use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Contracts\Translation\TranslatorInterface; /** diff --git a/src/Documentation/Resources/translations/messages.ar.xlf b/src/Resources/translations/messages.ar.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.ar.xlf rename to src/Resources/translations/messages.ar.xlf diff --git a/src/Documentation/Resources/translations/messages.de.xlf b/src/Resources/translations/messages.de.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.de.xlf rename to src/Resources/translations/messages.de.xlf diff --git a/src/Documentation/Resources/translations/messages.en.xlf b/src/Resources/translations/messages.en.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.en.xlf rename to src/Resources/translations/messages.en.xlf diff --git a/src/Documentation/Resources/translations/messages.es.xlf b/src/Resources/translations/messages.es.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.es.xlf rename to src/Resources/translations/messages.es.xlf diff --git a/src/Documentation/Resources/translations/messages.fr.xlf b/src/Resources/translations/messages.fr.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.fr.xlf rename to src/Resources/translations/messages.fr.xlf diff --git a/src/Documentation/Resources/translations/messages.id.xlf b/src/Resources/translations/messages.id.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.id.xlf rename to src/Resources/translations/messages.id.xlf diff --git a/src/Documentation/Resources/translations/messages.it.xlf b/src/Resources/translations/messages.it.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.it.xlf rename to src/Resources/translations/messages.it.xlf diff --git a/src/Documentation/Resources/translations/messages.ru.xlf b/src/Resources/translations/messages.ru.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.ru.xlf rename to src/Resources/translations/messages.ru.xlf diff --git a/src/Documentation/Resources/translations/messages.sr.xlf b/src/Resources/translations/messages.sr.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.sr.xlf rename to src/Resources/translations/messages.sr.xlf diff --git a/src/Documentation/Resources/translations/messages.tr.xlf b/src/Resources/translations/messages.tr.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.tr.xlf rename to src/Resources/translations/messages.tr.xlf diff --git a/src/Documentation/Resources/translations/messages.uk.xlf b/src/Resources/translations/messages.uk.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.uk.xlf rename to src/Resources/translations/messages.uk.xlf diff --git a/src/Documentation/Resources/translations/messages.xlf b/src/Resources/translations/messages.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.xlf rename to src/Resources/translations/messages.xlf diff --git a/src/Documentation/Resources/translations/messages.zh.xlf b/src/Resources/translations/messages.zh.xlf similarity index 100% rename from src/Documentation/Resources/translations/messages.zh.xlf rename to src/Resources/translations/messages.zh.xlf