Bump @wordpress/scripts from 26.13.0 to 26.14.0 #402
Workflow file for this run
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: Lint and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint-js: | |
name: JS Lints | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint JS | |
run: npm run lint | |
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@83af392bf5f031813d25e6fe4cd626cdba9a2df6 | |
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'] | |
coverage: [false] | |
experimental: [false] | |
include: | |
- php: '8.0' | |
wp: 'latest' | |
coverage: true | |
experimental: false | |
- php: '7.4' | |
wp: 'trunk' | |
experimental: true | |
- php: '8.3' | |
wp: 'trunk' | |
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@83af392bf5f031813d25e6fe4cd626cdba9a2df6 | |
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" ]]; 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@v3.1.4 | |
with: | |
file: coverage.xml | |
flags: default | |
if: ${{ matrix.coverage }} | |
- name: Upload code coverage report | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
file: coverage-integration.xml | |
flags: default | |
if: ${{ matrix.coverage }} | |
- name: Upload code coverage report | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
file: coverage-integration-multisite.xml | |
flags: multisite | |
if: ${{ matrix.coverage }} | |
phpbench: | |
name: 'Benchmarks ${{ matrix.php }} - WP ${{ matrix.wp }} - OPCache ${{ matrix.opcache }}' | |
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 | |
strategy: | |
matrix: | |
php: ['8.2'] | |
wp: ['latest'] | |
opcache: [true, false] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: ${{ matrix.opcache == false && ':opcache' || 'opcache' }} | |
coverage: none | |
tools: composer | |
ini-values: opcache.enable_cli=1 | |
- name: Install PHP dependencies | |
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 | |
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 | |
- name: Run benchmarks | |
run: composer phpbench | |
e2e-tests: | |
name: 'E2E Tests (${{ matrix.wp }})' | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental == true }} | |
strategy: | |
fail-fast: false | |
matrix: | |
wp: ['latest'] | |
experimental: [false] | |
include: | |
- wp: 'trunk' | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Configure WordPress version | |
run: | | |
if [[ $WP_VERSION == 'trunk' ]]; then | |
echo "Using WordPress trunk" | |
echo "{\"core\":\"WordPress/WordPress#master\"}" >> .wp-env.override.json | |
fi | |
env: | |
WP_VERSION: ${{ matrix.wp }} | |
- name: Install WordPress | |
run: | | |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env | |
npm run wp-env start | |
# Ensure the wp-content/languages folder exists and is writable. | |
# See https://github.com/WordPress/gutenberg/issues/22515 | |
# and https://github.com/WordPress/gutenberg/tree/trunk/packages/env#installing-a-plugin-or-theme-on-the-development-instance | |
- name: Install languages | |
run: | | |
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1) | |
cd $WP_ENV_DIR | |
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade | |
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language core install de_DE es_ES fr_FR it_IT | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language plugin install de_DE es_ES fr_FR it_IT --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language plugin update --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language theme update --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language theme install de_DE es_ES fr_FR it_IT --all | |
cd - | |
- name: Run tests | |
run: npm run test:e2e | |
- name: Archive debug artifacts (screenshots, HTML snapshots) | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: failures-artifacts | |
path: artifacts | |
if-no-files-found: ignore | |
core-php: | |
name: 'WP core tests (${{ matrix.wp }})' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
wp: ['trunk', '6.3'] | |
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@83af392bf5f031813d25e6fe4cd626cdba9a2df6 | |
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 Ginger MO | |
uses: actions/checkout@v4 | |
with: | |
path: 'src/wp-content/plugins/performant-translations' | |
- name: Load Ginger MO 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 (JSON format) | |
run: | | |
echo "add_filter( 'performant_translations_preferred_format', static function () { return 'json'; } );" >> tests/phpunit/includes/bootstrap.php | |
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 | |
performance-tests: | |
name: 'Performance Tests (trunk)' | |
runs-on: ubuntu-latest | |
env: | |
WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Configure WordPress version | |
run: | | |
echo "{\"core\":\"WordPress/WordPress#master\"}" >> .wp-env.override.json | |
- name: Install WordPress | |
run: | | |
chmod -R 767 ./ # TODO: Possibly integrate in wp-env | |
npm run wp-env start | |
- name: Update permalink structure | |
run: | | |
npm run wp-env run tests-cli wp rewrite structure '/%postname%/' -- --hard | |
- name: Import mock data | |
run: | | |
npm run wp-env run tests-cli curl https://raw.githubusercontent.com/WordPress/theme-test-data/b9752e0533a5acbb876951a8cbb5bcc69a56474c/themeunittestdata.wordpress.xml -- --output /tmp/themeunittestdata.wordpress.xml | |
npm run wp-env run tests-cli wp import /tmp/themeunittestdata.wordpress.xml -- --authors=create | |
# Ensure the wp-content/languages folder exists and is writable. | |
# See https://github.com/WordPress/gutenberg/issues/22515 | |
# and https://github.com/WordPress/gutenberg/tree/trunk/packages/env#installing-a-plugin-or-theme-on-the-development-instance | |
- name: Install languages | |
run: | | |
WP_ENV_DIR=$(npm run wp-env install-path --silent 2>&1 | head -1) | |
cd $WP_ENV_DIR | |
mkdir -p tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade | |
chmod -R 767 tests-WordPress/wp-content/languages tests-WordPress/wp-content/upgrade | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language core install de_DE | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language plugin install de_DE --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language theme update --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language theme install de_DE --all | |
docker-compose run --rm -u $(id -u) -e HOME=/tmp tests-cli wp language theme update --all | |
cd - | |
- name: Run tests | |
run: | | |
npm run test:performance | |
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_after.json | |
- name: Check out base commit | |
run: | | |
if [[ -z "$BASE_REF" ]]; then | |
git fetch -n origin $BASE_SHA | |
git reset --hard $BASE_SHA | |
else | |
git fetch -n origin $BASE_REF | |
git reset --hard $BASE_SHA | |
fi | |
env: | |
BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }} | |
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} | |
# Run tests without causing job to fail if they don't pass (e.g. because of env issues). | |
- name: Run tests for base | |
run: | | |
npm run test:performance || true | |
if [ -f "{{ env.WP_ARTIFACTS_PATH }}/performance-results.json" ]; then | |
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_before.json | |
fi; | |
- name: Reset to original commit | |
run: | | |
git reset --hard $GITHUB_SHA | |
- name: Compare results with base | |
run: | | |
if [ -f "${{ runner.temp }}/results_before.json" ]; then | |
node tests/performance/cli/results.js ${{ runner.temp }}/results_after.json ${{ runner.temp }}/results_before.json | |
else | |
node tests/performance/cli/results.js ${{ runner.temp }}/results_after.json | |
fi; | |
- name: Check if a comment was already made | |
id: find-comment | |
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 | |
if: > | |
github.event.pull_request.number && | |
github.event.pull_request.head.repo.fork == false | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: swissspidy | |
body-includes: Performance test results for | |
- name: Comment on PR with test results | |
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa | |
if: > | |
github.event.pull_request.number && | |
github.event.pull_request.head.repo.fork == false | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
edit-mode: replace | |
body-path: ${{ env.WP_ARTIFACTS_PATH }}/performance-results.md | |
token: ${{ secrets.WORKFLOW_TOKEN }} | |
- name: Add workflow summary | |
run: | | |
cat ${{ env.WP_ARTIFACTS_PATH }}/performance-results.md >> $GITHUB_STEP_SUMMARY | |
- name: Archive performance results | |
if: success() | |
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1 | |
with: | |
name: performance-results | |
path: ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json | |
- name: Archive debug artifacts (screenshots, HTML snapshots) | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: failures-artifacts | |
path: artifacts | |
if-no-files-found: ignore |