Enhance PHP compatibility and structure for WP_REST_Blocks #147
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: PHP Unit Tests | |
| on: | |
| push: | |
| # Only run if PHP-related files changed. | |
| paths: | |
| - '**.php' | |
| - 'phpunit.xml.dist' | |
| - 'phpunit-multisite.xml.dist' | |
| - 'composer.json' | |
| - 'composer.lock' | |
| - 'tests/**' | |
| - '.wp-env.json' | |
| branches: | |
| - master | |
| - release/* | |
| pull_request: | |
| # Only run if PHP-related files changed. | |
| paths: | |
| - '**.php' | |
| - 'phpunit.xml.dist' | |
| - 'phpunit-multisite.xml.dist' | |
| - 'composer.json' | |
| - 'composer.lock' | |
| - 'tests/**' | |
| - '.wp-env.json' | |
| - '.github/workflows/tests-unit-php.yml' | |
| # Cancel in-progress runs for the same workflow and branch/PR | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-php: | |
| name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| continue-on-error: ${{ matrix.experimental == true }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
| wp: ['5.9.1'] | |
| include: | |
| - php: '8.5' | |
| wp: 'master' | |
| experimental: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'npm' | |
| - name: Setup PHP with Composer | |
| uses: ./.github/actions/setup-php-composer | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: 'mysql' | |
| tools: 'composer' | |
| - name: Dump autoload | |
| run: composer dump-autoload --no-interaction | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Start wp-env | |
| run: | | |
| echo "WP_ENV_PHP_VERSION: $WP_ENV_PHP_VERSION" | |
| echo "WP_ENV_CORE: $WP_ENV_CORE" | |
| npm run env:start -- --debug | |
| env: | |
| WP_ENV_PHP_VERSION: ${{ matrix.php }} | |
| WP_ENV_CORE: ${{ format('WordPress/WordPress#{0}', matrix.wp) }} | |
| - name: Run tests | |
| run: | | |
| npm run test:php | |
| npm run test:php:multisite | |
| - name: Stop wp-env | |
| if: always() | |
| run: npm run env:stop | |