70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
name: CI — Lint & Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# ── PHP Syntax Check ─────────────────────────────────────────────
|
|
lint-php:
|
|
name: PHP Lint (${{ matrix.php }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
php: ['7.4', '8.1', '8.3']
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP ${{ matrix.php }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
|
|
- name: Syntax check all PHP files
|
|
run: find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l
|
|
|
|
# ── 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 with WordPress-Core standard
|
|
run: |
|
|
composer run lint
|
|
|
|
# ── JavaScript Lint ──────────────────────────────────────────────
|
|
lint-js:
|
|
name: JavaScript Linting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Check JavaScript syntax
|
|
run: |
|
|
for f in $(find assets/js -name '*.js' -type f); do
|
|
node --check "$f" || exit 1
|
|
done
|
|
echo "All JavaScript files passed syntax check"
|