fix(ci): restructure CI for PHP 8.1+ and proper PHPCS setup

- Drop PHP 8.0 from matrix — DTOs use readonly properties (8.1+)
- Add composer.json with PHPCS/WPCS as dev dependencies
- Add phpcs.xml.dist for WordPress coding standard config
- Use dealerdirect/phpcodesniffer-composer-installer for auto path setup
- Separate lint jobs: PHP syntax (8.1/8.2/8.3) + PHPCS + file-size
- Update Requires PHP header to 8.1
- Update ARCHITECTURE.md file tree

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-17 07:43:01 +07:00
parent 106f15e027
commit c9361b0283
5 changed files with 70 additions and 32 deletions

View File

@@ -6,15 +6,17 @@ on:
pull_request:
branches: [ main ]
jobs:
lint:
name: PHP Lint + PHPCS
runs-on: ubuntu-latest
permissions:
contents: read
jobs:
# ── PHP Syntax Check ─────────────────────────────────────────────
lint-php:
name: PHP Lint (${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.0', '8.1', '8.2' ]
php: [ '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@v4
@@ -22,37 +24,30 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, cs2pr
extensions: mbstring
- name: PHP syntax check
- name: Syntax check all PHP files
run: find . -name "*.php" -not -path "./vendor/*" | xargs -n 1 php -l
- name: Install PHPCS + WordPress standards
run: |
composer global require --with-all-dependencies \
"squizlabs/php_codesniffer=^3.13" \
"wp-coding-standards/wpcs=^3.0" \
"phpcsstandards/phpcsutils=^1.0"
phpcs --config-set installed_paths $(composer global config home)/vendor/wp-coding-standards/wpcs
# ── WordPress Coding Standards (PHP CodeSniffer) ──────────────────
lint-phpcs:
name: WordPress Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Run PHPCS
run: |
phpcs --standard=WordPress --extensions=php \
--ignore=vendor/*,node_modules/*,tests/* \
--report=checkstyle \
--warning-severity=0 \
. | cs2pr || true
- name: Run PHPCS (strict — fail on errors)
run: |
phpcs --standard=WordPress --extensions=php \
--ignore=vendor/*,node_modules/*,tests/* \
--error-severity=1 --warning-severity=0 \
--report=summary \
.
run: composer run lint
continue-on-error: true
# ── 300-line file check ──────────────────────────────────────────
file-size:
name: 300-line file check
runs-on: ubuntu-latest