diff --git a/.gitattributes b/.gitattributes index 4688723..0b0f718 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,11 +7,10 @@ # /.github export-ignore /.phpcs export-ignore -/phpcs.xml export-ignore +/.phpcs.xml export-ignore +/phpstan.neon export-ignore /phpunit.xml export-ignore /tests export-ignore -/configure.php export-ignore -/Makefile export-ignore # # Auto detect text files and perform LF normalization. diff --git a/.github/workflows/all-pr-tests.yml b/.github/workflows/all-pr-tests.yml new file mode 100644 index 0000000..eba45dd --- /dev/null +++ b/.github/workflows/all-pr-tests.yml @@ -0,0 +1,45 @@ +name: "All Pull Request Tests" + +on: + pull_request: + branches: + - main + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + # We use a single job to ensure that all steps run in the same environment and + # reduce the number of minutes used. + pr-tests: + # Don't run on draft PRs + if: github.event.pull_request.draft == false + # Timeout after 10 minutes + timeout-minutes: 10 + # Define a matrix of PHP/WordPress versions to test against + strategy: + matrix: + php: [8.2, 8.3] + wordpress: ["latest"] + multisite: [false] + runs-on: ubuntu-latest + # Cancel any existing runs of this workflow + concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}-MS${{ matrix.multisite }} + cancel-in-progress: true + # Name the job in the matrix + name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }} multisite ${{ matrix.multisite }}" + steps: + - uses: actions/checkout@v4 + + - name: Run General Tests + # See https://github.com/alleyinteractive/action-test-general for more options + uses: alleyinteractive/action-test-general@develop + + - name: Run PHP Tests + # See https://github.com/alleyinteractive/action-test-php for more options + uses: alleyinteractive/action-test-php@develop + with: + php-version: '${{ matrix.php }}' + audit-command: 'composer audit --no-dev --ansi --no-interaction' + wordpress-version: '${{ matrix.wordpress }}' + wordpress-multisite: '${{ matrix.multisite }}' + skip-wordpress-install: 'true' diff --git a/.github/workflows/coding-quality.yml b/.github/workflows/coding-quality.yml deleted file mode 100644 index 30ce26e..0000000 --- a/.github/workflows/coding-quality.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Code Quality - -on: - pull_request: - branches: - - main - -jobs: - code-quality: - if: github.event.pull_request.draft == false - uses: alleyinteractive/.github/.github/workflows/php-code-quality.yml@main - with: - php: '8.2' diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml deleted file mode 100644 index e2be7a9..0000000 --- a/.github/workflows/coding-standards.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Coding Standards - -on: - pull_request: - branches: - - main - -jobs: - coding-standards: - if: github.event.pull_request.draft == false - uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main - with: - php: '8.2' diff --git a/phpcs.xml b/.phpcs.xml similarity index 75% rename from phpcs.xml rename to .phpcs.xml index 8c0ac54..3a89a44 100644 --- a/phpcs.xml +++ b/.phpcs.xml @@ -2,42 +2,37 @@ PHP_CodeSniffer standard for alleyinteractive/wp-block-audit-command. - src/ - tests/ - vendor/ - - + - + + + src/ + tests/ + vendor/ + + + - + - + - - - - - - - - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8b9bc..967f460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +Nothing yet. + +## 2.0.0 + +### Changed + +- The minimum PHP version is now 8.2. + ## 1.2.0 ### Changed diff --git a/composer.json b/composer.json index 3683f14..c1a5c64 100644 --- a/composer.json +++ b/composer.json @@ -1,53 +1,69 @@ { - "name": "alleyinteractive/wp-block-audit-command", - "description": "Audit WordPress block usage in post content.", - "type": "wp-cli-package", - "homepage": "https://github.com/alleyinteractive/wp-block-audit-command", - "license": "GPL-2.0-or-later", - "authors": [ - { - "name": "Alley", - "email": "info@alley.com" - } - ], - "require": { - "php": "^8.1", - "alleyinteractive/composer-wordpress-autoloader": "^1.0", - "alleyinteractive/wp-bulk-task": "^0.2", - "alleyinteractive/wp-match-blocks": "^3.0", - "alleyinteractive/wp-type-extensions": "^2.1" - }, - "require-dev": { - "alleyinteractive/alley-coding-standards": "^2.0", - "szepeviktor/phpstan-wordpress": "^1.1", - "wp-cli/entity-command": "^2.6", - "wp-cli/wp-cli": "^2.10" - }, - "config": { - "allow-plugins": { - "alleyinteractive/composer-wordpress-autoloader": true, - "dealerdirect/phpcodesniffer-composer-installer": true, - "pestphp/pest-plugin": true + "name": "alleyinteractive/wp-block-audit-command", + "description": "Audit WordPress block usage in post content.", + "license": "GPL-2.0-or-later", + "type": "wp-cli-package", + "authors": [ + { + "name": "Alley", + "email": "info@alley.com" + } + ], + "homepage": "https://github.com/alleyinteractive/wp-block-audit-command", + "require": { + "php": "^8.2", + "alleyinteractive/composer-wordpress-autoloader": "^1.0", + "alleyinteractive/wp-bulk-task": "^0.2", + "alleyinteractive/wp-match-blocks": "^3.0", + "alleyinteractive/wp-type-extensions": "^2.1" + }, + "require-dev": { + "alleyinteractive/alley-coding-standards": "^2.0", + "ergebnis/composer-normalize": "^2.44", + "mantle-framework/testkit": "^1.2", + "phpstan/phpstan": "^1.12", + "szepeviktor/phpstan-wordpress": "^1.3", + "wp-cli/entity-command": "^2.6", + "wp-cli/wp-cli": "^2.10" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "autoload": { + "files": [ + "command.php" + ] + }, + "config": { + "allow-plugins": { + "alleyinteractive/composer-wordpress-autoloader": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true, + "pestphp/pest-plugin": true + }, + "lock": false, + "sort-packages": true + }, + "extra": { + "wordpress-autoloader": { + "autoload": { + "Alley\\WP": "src" + } + } }, - "sort-packages": true - }, - "autoload": { - "files": [ - "command.php" - ] - }, - "extra": { - "wordpress-autoloader": { - "autoload": { - "Alley\\WP": "src" - } + "scripts": { + "pre-install-cmd": [ + "@tidy" + ], + "post-install-cmd": [ + "@tidy" + ], + "phpcbf": "phpcbf .", + "phpcs": "phpcs .", + "phpstan": "phpstan -v --memory-limit=512M", + "test": [ + "@phpcs", + "@phpstan" + ], + "tidy": "[ $COMPOSER_DEV_MODE -eq 0 ] || composer normalize" } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "scripts": { - "phpcbf": "phpcbf .", - "phpcs": "phpcs .", - "phpstan": "phpstan --memory-limit=512M" - } }