Preload image URLs for elements with external background images #2214
This file contains 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: Unit Testing for Plugins | |
on: | |
push: | |
branches: | |
- trunk | |
- 'release/**' | |
# Only run if PHP-related files changed. | |
paths: | |
- '.github/workflows/php-test-plugins.yml' | |
- 'plugins/**.php' | |
- '.wp-env.json' | |
- '**/package.json' | |
- 'package-lock.json' | |
- 'phpunit.xml.dist' | |
- 'tests/multisite.xml' | |
- 'composer.json' | |
- 'composer.lock' | |
pull_request: | |
# Only run if PHP-related files changed. | |
paths: | |
- '.github/workflows/php-test-plugins.yml' | |
- 'plugins/**.php' | |
- '.wp-env.json' | |
- '**/package.json' | |
- 'package-lock.json' | |
- 'phpunit.xml.dist' | |
- 'tests/multisite.xml' | |
- 'composer.json' | |
- 'composer.lock' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
php-test-plugins: | |
name: "PHP ${{ matrix.php }} / WP ${{ matrix.wp }}" | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.1', '8.0', '7.4', '7.3', '7.2'] | |
wp: [ 'latest' ] | |
coverage: [false] | |
include: | |
- php: '7.4' | |
wp: '6.5' | |
- php: '8.3' | |
wp: 'trunk' | |
- php: '8.2' | |
wp: 'latest' | |
# coverage: true # TODO: Uncomment once coverage reports are fixed. See <https://github.com/WordPress/performance/pull/1586#issuecomment-2474498387>. | |
env: | |
WP_ENV_PHP_VERSION: ${{ matrix.php }} | |
WP_ENV_CORE: ${{ matrix.wp == 'trunk' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wp ) }} | |
steps: | |
- uses: styfle/[email protected] | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js (.nvmrc) | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: npm install | |
run: npm ci | |
- name: Build assets | |
run: npm run build | |
- name: Install WordPress | |
run: npm run wp-env start | |
- name: Composer Install | |
run: npm run wp-env run tests-cli -- --env-cwd="wp-content/plugins/$(basename $(pwd))" composer install --no-interaction --no-progress | |
- name: Running single site unit tests | |
run: | | |
if [ "${{ matrix.coverage }}" == "true" ]; then | |
npm run test-php -- --coverage-clover=coverage-${{ github.sha }}.xml | |
else | |
npm run test-php | |
fi | |
- name: Running multisite unit tests | |
run: | | |
if [ "${{ matrix.coverage }}" == "true" ]; then | |
npm run test-php-multisite -- --coverage-clover=coverage-multisite-${{ github.sha }}.xml | |
else | |
npm run test-php-multisite | |
fi | |
- name: Upload single site coverage reports to Codecov | |
if: ${{ matrix.coverage == true }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage-${{ github.sha }}.xml | |
flags: single | |
name: ${{ matrix.php }}-single-site-coverage | |
fail_ci_if_error: true | |
- name: Upload multisite coverage reports to Codecov | |
if: ${{ matrix.coverage == true }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage-multisite-${{ github.sha }}.xml | |
flags: multisite | |
name: ${{ matrix.php }}-multisite-coverage | |
fail_ci_if_error: true |