Files
peptide-search-ai/.github/workflows/ci.yml
peptiderepo 14a0f86810 fix(ci): treat phpcs exit 2 (warnings-only) as success
After phpcbf auto-fix in previous commit, remaining violations are
all warnings (exit code 2). Apply same pattern as peptide-news-plugin:
  composer run lint || test $? -eq 2
2026-04-24 06:34:33 +00:00

92 lines
2.7 KiB
YAML
Executable File

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 || test $? -eq 2 # exit 2 = warnings-only, not a build failure
# ── PHPUnit Tests ────────────────────────────────────────────────
test-phpunit:
name: PHPUnit Tests (PHP ${{ 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 }}
tools: composer
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Run PHPUnit tests
run: composer run test
# ── 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"