From 84659462d775f87e1c9703606be260eb17941e3f Mon Sep 17 00:00:00 2001 From: David Herrera Date: Tue, 29 Oct 2024 00:24:14 -0400 Subject: [PATCH] Repo updates and maintenance --- .editorconfig | 11 ++---- .gitattributes | 5 ++- .github/workflows/all-pr-tests.yml | 45 ++++++++++++++++++++++++ .github/workflows/coding-quality.yml | 13 ------- .github/workflows/coding-standards.yml | 13 ------- phpcs.xml => .phpcs.xml | 29 +++++++--------- CHANGELOG.md | 10 ++++++ composer.json | 47 +++++++++++++++++++------- 8 files changed, 106 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/all-pr-tests.yml delete mode 100644 .github/workflows/coding-quality.yml delete mode 100644 .github/workflows/coding-standards.yml rename phpcs.xml => .phpcs.xml (75%) diff --git a/.editorconfig b/.editorconfig index 3f81e6e..5087309 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,14 +5,9 @@ charset = utf-8 end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true -indent_style = tab -indent_size = 4 - -[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}] indent_style = space indent_size = 2 -# Dotfiles -[.*] -indent_style = space -indent_size = 2 +[*.{html,php}] +indent_size = 4 +indent_style = tab 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..46669e3 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { "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", + "type": "wp-cli-package", "authors": [ { "name": "Alley", "email": "info@alley.com" } ], + "homepage": "https://github.com/alleyinteractive/wp-block-audit-command", "require": { - "php": "^8.1", + "php": "^8.2", "alleyinteractive/composer-wordpress-autoloader": "^1.0", "alleyinteractive/wp-bulk-task": "^0.2", "alleyinteractive/wp-match-blocks": "^3.0", @@ -19,35 +19,56 @@ }, "require-dev": { "alleyinteractive/alley-coding-standards": "^2.0", - "szepeviktor/phpstan-wordpress": "^1.1", + "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 }, - "autoload": { - "files": [ - "command.php" - ] - }, "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + }, "wordpress-autoloader": { "autoload": { "Alley\\WP": "src" } } }, - "minimum-stability": "dev", - "prefer-stable": true, "scripts": { + "pre-install-cmd": [ + "@tidy" + ], + "post-install-cmd": [ + "@tidy" + ], "phpcbf": "phpcbf .", "phpcs": "phpcs .", - "phpstan": "phpstan --memory-limit=512M" + "phpstan": "phpstan -v --memory-limit=512M", + "test": [ + "@phpcs", + "@phpstan", + "@phpunit" + ], + "tidy": "[ $COMPOSER_DEV_MODE -eq 0 ] || composer normalize" } -} +} \ No newline at end of file