From f1d0ce4c752d366b7ce2bea62cd7e80e8abe9a81 Mon Sep 17 00:00:00 2001 From: peptiderepo <273788462+peptiderepo@users.noreply.github.com> Date: Tue, 14 Apr 2026 17:37:11 +0700 Subject: [PATCH] ci: add dedicated CI workflow (lint + phpcs + phpunit) on PR and push Tests existed inside deploy.yml but only ran on push to main, so PRs got no validation signal. This adds a standalone ci.yml mirroring the same 3 jobs, triggered on both pull_request and push to main. The in-deploy validate job stays for belt-and-suspenders; remove it in a follow-up if desired. Agent-Session: cowork-ci-parity-20260414 --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..393f031 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: CI — Lint & Test + +# Runs on every PR and every push to main. Validates PHPUnit tests + lint + +# coding standards before deploy can happen. deploy.yml on main continues to +# run its own validate job as a belt-and-suspenders check, but this CI workflow +# is what gives PRs an immediate signal so fixes happen before merge. + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + php-lint: + name: PHP Lint (${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['7.4', '8.1', '8.3'] + steps: + - uses: actions/checkout@v4 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + - name: Syntax check all PHP files + run: | + set -e + find . -name '*.php' \ + -not -path './vendor/*' \ + -not -path './node_modules/*' \ + -not -path './.git/*' \ + -print0 | xargs -0 -n1 -P4 php -l > /dev/null + + phpcs: + name: PHPCS (WordPress standards) + runs-on: ubuntu-latest + continue-on-error: true # non-blocking for now — see CONVENTIONS.md + steps: + - uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: none + tools: composer:v2, phpcs + - name: Install WordPress Coding Standards + run: | + composer global require "wp-coding-standards/wpcs:^3.0" "phpcsstandards/phpcsutils:^1.0" --no-interaction + phpcs --config-set installed_paths "$(composer global config home)/vendor/wp-coding-standards/wpcs" + - name: Run PHPCS + run: | + phpcs --standard=WordPress-Core \ + --extensions=php \ + --ignore=vendor/*,tests/*,node_modules/* \ + --warning-severity=0 \ + --report=summary \ + includes/ prautoblogger.php uninstall.php + + phpunit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['7.4', '8.1', '8.3'] + steps: + - uses: actions/checkout@v4 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + - name: Install composer dependencies + run: composer install --no-progress --no-interaction --prefer-dist + - name: Run PHPUnit (Brain Monkey — no WP install required) + run: vendor/bin/phpunit --testdox