Updated readme, fixed error #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request Checks | |
| on: | |
| pull_request: | |
| branches: [master, main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| php-checks: | |
| name: PHP Quality Checks | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: ['7.4', '8.1', '8.2'] # Removed 8.0 - 8.1 covers most use cases | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer-${{ matrix.php-version }}- | |
| ${{ runner.os }}-composer- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-interaction --no-dev | |
| - name: Install dev dependencies for checks | |
| run: composer install --prefer-dist --no-interaction | |
| - name: Run PHP CodeSniffer | |
| run: composer run-script phpcs -- --error-severity=1 --warning-severity=8 | |
| - name: Run PHPStan | |
| run: composer run-script phpstan | |
| if: matrix.php-version == '8.1' # Only run PHPStan on one PHP version to save time | |
| javascript-checks: | |
| name: JavaScript Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint (JavaScript) | |
| run: npm run lint:js | |
| - name: Run Stylelint (CSS) | |
| run: npm run lint:css || true | |
| - name: Check code formatting | |
| run: npm run format -- --check | |
| - name: Check licenses | |
| run: npm run check-licenses | |
| - name: Check engines compatibility | |
| run: npm run check-engines | |
| - name: Build assets | |
| run: npm run build | |
| tests: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| wp-version: ['6.2', '6.3', '6.4'] # Focus on recent versions | |
| php-version: ['7.4', '8.1'] | |
| exclude: | |
| # Test latest WP with both PHP versions, older WP with just 7.4 | |
| - wp-version: '6.2' | |
| php-version: '8.1' | |
| - wp-version: '6.3' | |
| php-version: '8.1' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv | |
| coverage: xdebug | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build assets | |
| run: npm run build | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer-${{ matrix.php-version }}- | |
| ${{ runner.os }}-composer- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-interaction | |
| - name: Setup WordPress test environment | |
| run: | | |
| bash bin/install-wp-tests.sh wordpress_test root '' localhost ${{ matrix.wp-version }} | |
| if: hashFiles('bin/install-wp-tests.sh') != '' | |
| - name: Run JavaScript tests | |
| run: npm run test:ci | |
| - name: Upload JavaScript coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: javascript | |
| name: javascript-${{ matrix.php-version }}-wp${{ matrix.wp-version }} | |
| if: matrix.php-version == '8.1' && matrix.wp-version == '6.4' | |
| security-checks: | |
| name: Security Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| extensions: dom, curl, libxml, mbstring, zip | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-security-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer-security- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-interaction | |
| - name: Run Composer security audit | |
| run: composer audit --format=plain || true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Run npm security audit | |
| run: npm audit --audit-level=moderate || true | |
| compatibility-check: | |
| name: WordPress Compatibility | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| - name: Install PHPCompatibility | |
| run: | | |
| composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true | |
| composer global require phpcompatibility/php-compatibility | |
| composer global require wp-coding-standards/wpcs | |
| - name: Check PHP compatibility | |
| run: | | |
| ~/.composer/vendor/bin/phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 7.4-8.2 --ignore=vendor/,node_modules/,tests/ || true | |
| - name: Check WordPress compatibility | |
| run: | | |
| ~/.composer/vendor/bin/phpcs -p . --standard=WordPress --ignore=vendor/,node_modules/,tests/ --severity=1 || true | |
| build-check: | |
| name: Build Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build for production | |
| run: npm run build | |
| - name: Check bundle size | |
| run: npm run build:analyze | |
| env: | |
| ANALYZE_BUNDLE: true | |
| - name: Create plugin ZIP | |
| run: npm run plugin-zip | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: plugin-build-${{ github.sha }} | |
| path: | | |
| *.zip | |
| assets/dist/ | |
| retention-days: 7 | |
| status-check: | |
| name: All Checks Passed | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ | |
| php-checks, | |
| javascript-checks, | |
| tests, | |
| security-checks, | |
| compatibility-check, | |
| build-check, | |
| ] | |
| if: always() | |
| steps: | |
| - name: Check all jobs status | |
| run: | | |
| if [[ "${{ needs.php-checks.result }}" != "success" ]] || \ | |
| [[ "${{ needs.javascript-checks.result }}" != "success" ]] || \ | |
| [[ "${{ needs.tests.result }}" != "success" ]] || \ | |
| [[ "${{ needs.security-checks.result }}" != "success" ]] || \ | |
| [[ "${{ needs.compatibility-check.result }}" != "success" ]] || \ | |
| [[ "${{ needs.build-check.result }}" != "success" ]]; then | |
| echo "One or more checks failed!" | |
| exit 1 | |
| fi | |
| echo "All checks passed! 🎉" |