Skip to content

Bump @wordpress/scripts from 27.7.0 to 27.8.0 (#181) #637

Bump @wordpress/scripts from 27.7.0 to 27.8.0 (#181)

Bump @wordpress/scripts from 27.7.0 to 27.8.0 (#181) #637

Workflow file for this run

name: Lint and Test
on:
push:
branches:
- main
pull_request:
jobs:
lint-php:
name: PHP Lints
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: composer, cs2pr
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-scripts'
- name: Validate composer.json
run: composer validate --no-check-all --strict
# So PHPStan uses information from the latest version
- name: Update PHPUnit
run: |
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
- name: Lint PHP
run: composer lint
- name: PHPStan
run: composer phpstan
unit-php:
name: 'PHP ${{ matrix.php }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:latest
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: wordpress_test
MARIADB_MYSQL_LOCALHOST_USER: 1
MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
ports:
- 3306
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php: ['8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0']
wp: ['latest', 'trunk']
coverage: [false]
experimental: [false]
exclude:
- php: '7.0'
wp: 'trunk'
coverage: false
experimental: false
- php: '7.1'
wp: 'trunk'
coverage: false
experimental: false
- php: '8.2'
wp: 'latest'
coverage: false
experimental: false
include:
- php: '8.2'
wp: 'latest'
coverage: true
experimental: false
- php: '8.3'
wp: 'trunk'
coverage: true
experimental: true
- php: '8.4'
wp: 'trunk'
coverage: false
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
tools: composer, cs2pr
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-scripts'
- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Set up tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true
# Installs a different PHPUnit version depending on the WP/PHP version combo we're testing against.
#
# | WP / PHP | PHPUnit |
# |-----------|---------|
# | * / 7.0 | 6 |
# | * / 7.1 | 7 |
# | * / 7.2 | 8 |
# | * / 7.4 | 9 |
# | * / 8 | 9 |
#
# See https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/
- name: Update PHPUnit
run: |
if [[ $PHP_VERSION == "7.4" || $PHP_VERSION == "8.0" || $PHP_VERSION == "8.1" || $PHP_VERSION == "8.2" || $PHP_VERSION == "8.3" || $PHP_VERSION == "8.4" ]]; then
echo "Installing latest version of PHPUnit"
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
fi
env:
WP_VERSION: ${{ matrix.wp }}
PHP_VERSION: ${{ matrix.php }}
- name: Run tests
run: composer test
if: ${{ ! matrix.coverage }}
- name: Run tests with coverage
run: composer test:coverage
if: ${{ matrix.coverage }}
- name: Upload code coverage report
uses: codecov/codecov-action@v4.3.0
with:
file: coverage.xml
flags: ${{ matrix.wp == 'trunk' && 'trunk,unit' || 'default' }}
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.coverage }}
- name: Upload code coverage report
uses: codecov/codecov-action@v4.3.0
with:
file: coverage-integration.xml
flags: ${{ matrix.wp == 'trunk' && 'trunk,integration' || 'integration' }}
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.coverage }}
- name: Upload code coverage report
uses: codecov/codecov-action@v4.3.0
with:
file: coverage-integration-multisite.xml
flags: ${{ matrix.wp == 'trunk' && 'trunk,multisite' || 'multisite' }}
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.coverage }}
core-php:
name: 'WP core tests (${{ matrix.wp }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
wp: ['trunk']
services:
mysql:
image: mariadb:latest
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: wordpress_test
MARIADB_MYSQL_LOCALHOST_USER: 1
MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
ports:
- 3306
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: 'wordpress/wordpress-develop'
ref: ${{ matrix.wp }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mysql
coverage: none
tools: composer
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist'
dependency-versions: 'highest'
- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Set up tests config
run: |
cp wp-tests-config-sample.php wp-tests-config.php
sed -i.bak "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
sed -i.bak "s/yourusernamehere/$DB_USER/" wp-tests-config.php
sed -i.bak "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
sed -i.bak "s|localhost|${DB_HOST}|" wp-tests-config.php
cat wp-tests-config.php
env:
DB_NAME: wordpress_test
DB_USER: root
DB_PASSWORD: ''
DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
- name: Checkout Performant Translations
uses: actions/checkout@v4
with:
path: 'src/wp-content/plugins/performant-translations'
- name: Load Performant Translations for tests
run: |
echo "require dirname( __DIR__, 3 ) . '/src/wp-content/plugins/performant-translations/performant-translations.php';" >> tests/phpunit/includes/bootstrap.php
- name: Run tests (PHP format)
run: vendor/bin/phpunit --group=l10n,i18n,pomo
- name: Run tests (MO format)
run: |
echo "add_filter( 'performant_translations_preferred_format', static function () { return 'mo'; } );" >> tests/phpunit/includes/bootstrap.php
vendor/bin/phpunit --group=l10n,i18n,pomo