Skip to content

Prepare for WordPress 7.0 and improve plugin robustness #25

Prepare for WordPress 7.0 and improve plugin robustness

Prepare for WordPress 7.0 and improve plugin robustness #25

Workflow file for this run

name: WordPress Plugin Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Tier 1: Build + PHP compatibility (run in parallel)
build:
name: Build Plugin
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Prepare plugin folder for CI
run: |
mkdir -p ci-build/chip-for-gravity-forms
git archive HEAD | tar -x -C ci-build/chip-for-gravity-forms
echo "✅ Plugin folder prepared"
ls -la ci-build/chip-for-gravity-forms/
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: chip-for-gravity-forms-build
path: ci-build/
retention-days: 5
php-compatibility:
name: PHP ${{ matrix.php-version }} Compatibility
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.2', '8.4', '8.5']
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Install PHPCompatibility
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer phpcompatibility/phpcompatibility-wp:"*"
echo "$(composer global config bin-dir --absolute)" >> $GITHUB_PATH
- name: Verify PHPCS Standards
run: phpcs -i
- name: Check PHP ${{ matrix.php-version }} Compatibility
run: |
phpcs --standard=PHPCompatibilityWP --runtime-set testVersion ${{ matrix.php-version }} --extensions=php --ignore=vendor,node_modules,assets .
phpunit:
name: PHPUnit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: phpunit
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHPUnit
run: phpunit
# Tier 2: PHPCS (depends on nothing, runs in parallel)
phpcs:
name: PHP CodeSniffer (WordPress Standards)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Install WordPress Coding Standards
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer wp-coding-standards/wpcs:"^3.0"
echo "$(composer global config bin-dir --absolute)" >> $GITHUB_PATH
- name: Verify PHPCS Standards
run: phpcs -i
- name: Run PHPCS
run: phpcs --standard=phpcs.xml .
continue-on-error: false
# Tier 3: Plugin Check (needs build artifact)
plugin-check:
name: Plugin Check
runs-on: ubuntu-latest
needs: [build, php-compatibility, phpcs, phpunit]
steps:
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: chip-for-gravity-forms-build
path: ./build
- name: Run Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: './build/chip-for-gravity-forms'
exclude-directories: 'vendor,node_modules'