From dc01a15d1d110ec0ae825d2f4ea647f451a1dea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 19 Jun 2023 16:12:07 +0200 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-package-template --- .github/CODEOWNERS | 2 +- .github/CONTRIBUTING.md | 2 +- .github/FUNDING.yaml | 5 +++ .github/FUNDING.yml | 6 --- .github/SECURITY.md | 17 ++++++++ .github/settings.yml | 2 + .github/workflows/integrate.yaml | 73 +++++++++++++++++++++++--------- .github/workflows/renew.yaml | 6 +-- .phive/phars.xml | 2 +- README.md | 6 ++- composer-require-checker.json | 18 +------- rector.php | 5 +++ test/Functional/ExampleTest.php | 7 +-- test/Functional/phpunit.xml | 2 +- test/Integration/ExampleTest.php | 7 +-- test/Integration/phpunit.xml | 2 +- test/Unit/Entity/ExampleTest.php | 6 +-- test/Unit/phpunit.xml | 3 +- 18 files changed, 101 insertions(+), 70 deletions(-) create mode 100644 .github/FUNDING.yaml delete mode 100644 .github/FUNDING.yml create mode 100644 .github/SECURITY.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1d765050..21dd5340 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ -# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-size +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners * @ergebnis-bot @localheinz diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7eefa786..45f3e399 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -140,7 +140,7 @@ Run make ``` -to enforce coding standards, run a static code analysis, and run tests! +to automatically refactor code, enforce coding standards, run a static code analysis, and run tests! ## Help diff --git a/.github/FUNDING.yaml b/.github/FUNDING.yaml new file mode 100644 index 00000000..8730580c --- /dev/null +++ b/.github/FUNDING.yaml @@ -0,0 +1,5 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository + +github: + - "ergebnis" + - "localheinz" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 119ff9f4..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,6 +0,0 @@ -custom: - - "https://buymeacoff.ee/localheinz" - - "https://ko-fi.com/localheinz" - - "https://shop.localheinz.com" - - "https://www.amazon.de/hz/wishlist/ls/2NCHMSJ4BC1OW" -github: "localheinz" diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..b325ea98 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +The following versions of `ergebnis/symfony-application-template` have active support: + +- `x.y.z` + +## Unsupported Versions + +The following versions of `ergebnis/symfony-application-template` have reached their end of life: + +- `x.y.z` + +## Reporting a Vulnerability + +If you believe that you have found a security vulnerability, please send an email to `am@localheinz.com`. Ensure to include all details required to understand the severity of the issue. diff --git a/.github/settings.yml b/.github/settings.yml index 61f03341..13bb8dac 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -72,11 +72,13 @@ repository: description: ":octocat: + :musical_score: Provides a GitHub template repository for a Symfony application, using GitHub Actions." enable_automated_security_fixes: true enable_vulnerability_alerts: true + has_discussions: false has_downloads: true has_issues: true has_pages: false has_projects: false has_wiki: false + is_template: false name: "symfony-application-template" private: false diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index a241cb25..4c066282 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -24,13 +24,13 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "xdebug" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -39,6 +39,9 @@ jobs: - name: "Set up problem matchers for phpunit/phpunit" run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -80,7 +83,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Lint YAML files" uses: "ibiqlik/action-yamllint@v3.1.1" @@ -93,7 +96,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -124,7 +127,7 @@ jobs: run: "vendor/bin/config-transformer --ansi --dry-run config" - name: "Create cache directory for friendsofphp/php-cs-fixer" - run: "mkdir -p .build/php-cs-fixer" + run: "mkdir -p .build/php-cs-fixer/" - name: "Cache cache directory for friendsofphp/php-cs-fixer" uses: "actions/cache@v3.3.1" @@ -137,8 +140,6 @@ jobs: - name: "Run friendsofphp/php-cs-fixer" run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose" - env: - PHP_CS_FIXER_IGNORE_ENV: 1 dependency-analysis: name: "Dependency Analysis" @@ -155,19 +156,22 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" tools: "phive" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -209,18 +213,21 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "xdebug" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -262,18 +269,21 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, intl, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, intl, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -290,7 +300,7 @@ jobs: dependencies: "${{ matrix.dependencies }}" - name: "Create cache directory for rector/rector" - run: "mkdir -p .build/rector" + run: "mkdir -p .build/rector/" - name: "Cache cache directory for rector/rector" uses: "actions/cache@v3.3.1" @@ -319,13 +329,13 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -334,6 +344,21 @@ jobs: - name: "Validate composer.json and composer.lock" run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v3.3.1" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.8.0" + with: + dependencies: "${{ matrix.dependencies }}" + - name: "Check installed packages for security vulnerability advisories" run: "composer audit --ansi" @@ -355,7 +380,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" @@ -367,6 +392,9 @@ jobs: - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" @@ -389,7 +417,7 @@ jobs: run: "bin/console cache:warmup --ansi" - name: "Create cache directory for vimeo/psalm" - run: "mkdir -p .build/psalm" + run: "mkdir -p .build/psalm/" - name: "Run vimeo/psalm" run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4" @@ -415,7 +443,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Determine composer cache directory" @@ -477,13 +505,13 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" - name: "Set up PHP" uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -492,6 +520,9 @@ jobs: - name: "Set up problem matchers for phpunit/phpunit" run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 3660cee6..55e6ad2f 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -22,7 +22,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3.3.0" + uses: "actions/checkout@v3.5.3" with: token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" @@ -30,7 +30,7 @@ jobs: uses: "shivammathur/setup-php@2.25.4" with: coverage: "none" - extensions: "none, ctype, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, iconv, json, mbstring, pdo, pdo_pgsql, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -68,8 +68,6 @@ jobs: - name: "Run friendsofphp/php-cs-fixer" run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --verbose" - env: - PHP_CS_FIXER_IGNORE_ENV: 1 - name: "Commit modified files" uses: "stefanzweifel/git-auto-commit-action@v4.16.0" diff --git a/.phive/phars.xml b/.phive/phars.xml index 6eea48c8..b195d717 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,4 +1,4 @@ - + diff --git a/README.md b/README.md index fd9667ca..797a1ba6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # symfony-application-template [![Integrate](https://github.com/ergebnis/symfony-application-template/workflows/Integrate/badge.svg)](https://github.com/ergebnis/symfony-application-template/actions) -[![Prune](https://github.com/ergebnis/symfony-application-template/workflows/Prune/badge.svg)](https://github.com/ergebnis/symfony-application-template/actions) +[![Merge](https://github.com/ergebnis/symfony-application-template/workflows/Merge/badge.svg)](https://github.com/ergebnis/symfony-application-template/actions) [![Release](https://github.com/ergebnis/symfony-application-template/workflows/Release/badge.svg)](https://github.com/ergebnis/symfony-application-template/actions) [![Renew](https://github.com/ergebnis/symfony-application-template/workflows/Renew/badge.svg)](https://github.com/ergebnis/symfony-application-template/actions) @@ -20,6 +20,10 @@ Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md). Please have a look at [`CODE_OF_CONDUCT.md`](.github/CODE_OF_CONDUCT.md). +## Security Policy + +Please have a look at [`SECURITY.md`](.github/SECURITY.md). + ## License This application is licensed using the MIT License. diff --git a/composer-require-checker.json b/composer-require-checker.json index c2741f06..86e6db12 100644 --- a/composer-require-checker.json +++ b/composer-require-checker.json @@ -2,21 +2,5 @@ "scan-files": [ "bin/console" ], - "symbol-whitelist": [ - "array", - "bool", - "callable", - "false", - "float", - "int", - "iterable", - "null", - "object", - "parent", - "self", - "static", - "string", - "true", - "void" - ] + "symbol-whitelist": [] } diff --git a/rector.php b/rector.php index 74618379..c68a4bf5 100644 --- a/rector.php +++ b/rector.php @@ -13,6 +13,7 @@ use Rector\Config; use Rector\Core; +use Rector\PHPUnit; return static function (Config\RectorConfig $rectorConfig): void { $rectorConfig->cacheDirectory(__DIR__ . '/.build/rector/'); @@ -25,4 +26,8 @@ ]); $rectorConfig->phpVersion(Core\ValueObject\PhpVersion::PHP_82); + + $rectorConfig->sets([ + PHPUnit\Set\PHPUnitSetList::PHPUNIT_100, + ]); }; diff --git a/test/Functional/ExampleTest.php b/test/Functional/ExampleTest.php index 1691a362..fef09ecf 100644 --- a/test/Functional/ExampleTest.php +++ b/test/Functional/ExampleTest.php @@ -13,13 +13,10 @@ namespace App\Test\Functional; +use PHPUnit\Framework; use Symfony\Bundle\FrameworkBundle; -/** - * @internal - * - * @coversNothing - */ +#[Framework\Attributes\CoversNothing] final class ExampleTest extends FrameworkBundle\Test\WebTestCase { public function testTrueIsTrue(): void diff --git a/test/Functional/phpunit.xml b/test/Functional/phpunit.xml index 29fb0eb0..4f42c1f3 100644 --- a/test/Functional/phpunit.xml +++ b/test/Functional/phpunit.xml @@ -7,7 +7,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" bootstrap="bootstrap.php" - cacheDirectory="../../.build/phpunit/cache/unit/" + cacheDirectory="../../.build/phpunit/functional/" cacheResult="true" colors="true" columns="max" diff --git a/test/Integration/ExampleTest.php b/test/Integration/ExampleTest.php index 971c6730..39d1e342 100644 --- a/test/Integration/ExampleTest.php +++ b/test/Integration/ExampleTest.php @@ -13,13 +13,10 @@ namespace App\Test\Integration; +use PHPUnit\Framework; use Symfony\Bundle\FrameworkBundle; -/** - * @internal - * - * @coversNothing - */ +#[Framework\Attributes\CoversNothing] final class ExampleTest extends FrameworkBundle\Test\KernelTestCase { public function testTrueIsTrue(): void diff --git a/test/Integration/phpunit.xml b/test/Integration/phpunit.xml index ed1a04cb..ef2b2bea 100644 --- a/test/Integration/phpunit.xml +++ b/test/Integration/phpunit.xml @@ -7,7 +7,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" bootstrap="bootstrap.php" - cacheDirectory="../../.build/phpunit/cache/unit/" + cacheDirectory="../../.build/phpunit/integration/" cacheResult="true" colors="true" columns="max" diff --git a/test/Unit/Entity/ExampleTest.php b/test/Unit/Entity/ExampleTest.php index 48c0833e..ca0d60a5 100644 --- a/test/Unit/Entity/ExampleTest.php +++ b/test/Unit/Entity/ExampleTest.php @@ -17,11 +17,7 @@ use App\Test; use PHPUnit\Framework; -/** - * @internal - * - * @covers \App\Entity\Example - */ +#[Framework\Attributes\CoversClass(Entity\Example::class)] final class ExampleTest extends Framework\TestCase { use Test\Util\Helper; diff --git a/test/Unit/phpunit.xml b/test/Unit/phpunit.xml index 1c5a5990..131f3a5b 100644 --- a/test/Unit/phpunit.xml +++ b/test/Unit/phpunit.xml @@ -7,7 +7,7 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" bootstrap="../../vendor/autoload.php" - cacheDirectory="../../.build/phpunit/cache/unit/" + cacheDirectory="../../.build/phpunit/unit/" cacheResult="true" colors="true" columns="max" @@ -18,6 +18,7 @@ displayDetailsOnTestsThatTriggerNotices="true" displayDetailsOnTestsThatTriggerWarnings="true" executionOrder="random" + requireCoverageMetadata="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false"