mirror of
git://develop.git.wordpress.org/
synced 2025-01-16 20:38:35 +01:00
Build/Test Tools: Make use of new reusable workflows for 5.3.
This updates the 5.3 branch to utilize the new reusable workflows in trunk introduced in [58165]. This also includes backports for a some additional improvements and bug fixes that are necessary for the local development environment to continue working long term: - The image and platform properties for the mysql container have been updated to always prefer `amd64` containers (#60822). - `macos-13` is now pinned for MacOS jobs instead of `macos-latest` (#61340). - Migrating to Docker Compose V2 (#60901). - Removing the version property from docker-compose.yml (#59416). - Improvements to how artifacts and comments for Playground testing are generated. - Removing SVN related commands causing failures (#61216). - Updating the `actions/github-scripts` action to the latest version. - Cache the results of `PHP_CodeSniffer` runs (#49783). - Move the Memcached container into the Docker Compose config (#55700). - Improvements to the `healthcheck` command for the `mysql` container (#58867). - Skip some tests when not in the primary branch (#50401). Merges [49264], [51673], [52179], [53552], [53895], [56464], [57918], [58157], [57124], [57125], [57249] to the 5.3 branch. Props johnbillion, joemcgill, swissspidy, thelovekesh, narenin, mukesh27, JeffPaul, peterwilsoncc, zieladam, ockham, SergeyBiryukov, jorbin, Clorith, afragen, jrf. See #49783, #58867, #61340, #60822, #61216, #60901, #61101, #59416, #59805, #61213. git-svn-id: https://develop.svn.wordpress.org/branches/5.3@58624 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
21b92694c9
commit
33c83c0796
0
.cache/.gitkeep
Normal file
0
.cache/.gitkeep
Normal file
112
.github/workflows/coding-standards.yml
vendored
112
.github/workflows/coding-standards.yml
vendored
@ -40,112 +40,36 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Disable permissions for all available scopes by default.
|
||||
# Any needed permissions should be configured at the job level.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# Runs PHP coding standards checks.
|
||||
#
|
||||
# Violations are reported inline with annotations.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Sets up PHP.
|
||||
# - Logs debug information.
|
||||
# - Installs Composer dependencies (use cache if possible).
|
||||
# - Make Composer packages available globally.
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs PHPCS on the full codebase with warnings suppressed.
|
||||
# - Runs PHPCS on the `tests` directory without warnings suppressed.
|
||||
phpcs:
|
||||
name: PHP coding standards
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-php.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@d30ad8b1843ace22e6698ab99bbafaa747b6bd0d # v2.24.0
|
||||
with:
|
||||
php-version: '7.3'
|
||||
coverage: none
|
||||
tools: composer, cs2pr
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
|
||||
with:
|
||||
composer-options: "--no-progress --no-ansi"
|
||||
|
||||
- name: Make Composer packages available globally
|
||||
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Log PHPCS debug information
|
||||
run: phpcs -i
|
||||
|
||||
- name: Run PHPCBF on all Core files
|
||||
run: phpcbf
|
||||
|
||||
- name: Run PHPCS on all Core files
|
||||
run: phpcs -q -n --report=checkstyle | cs2pr
|
||||
|
||||
- name: Check test suite files for warnings
|
||||
run: phpcs tests -q --report=checkstyle | cs2pr
|
||||
with:
|
||||
php-version: '7.3'
|
||||
old-branch: true
|
||||
|
||||
# Runs the JavaScript coding standards checks.
|
||||
#
|
||||
# JSHint violations are not currently reported inline with annotations.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs Node.js.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs npm dependencies.
|
||||
# - Run the WordPress JSHint checks.
|
||||
jshint:
|
||||
name: JavaScript coding standards
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-coding-standards-javascript.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
git --version
|
||||
svn --version
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run JSHint
|
||||
run: npm run grunt jshint
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
needs: [ phpcs, jshint ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
@ -159,6 +83,8 @@ jobs:
|
||||
failed-workflow:
|
||||
name: Failed workflow tasks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
needs: [ phpcs, jshint, slack-notifications ]
|
||||
if: |
|
||||
always() &&
|
||||
@ -172,7 +98,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
retries: 2
|
||||
retry-exempt-status-codes: 418
|
||||
|
52
.github/workflows/javascript-tests.yml
vendored
52
.github/workflows/javascript-tests.yml
vendored
@ -38,53 +38,25 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Disable permissions for all available scopes by default.
|
||||
# Any needed permissions should be configured at the job level.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# Runs the QUnit tests for WordPress.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs Node.js.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs npm dependencies.
|
||||
# - Run the WordPress QUnit tests.
|
||||
test-js:
|
||||
name: QUnit Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-javascript-tests.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
git --version
|
||||
svn --version
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run QUnit tests
|
||||
run: npm run grunt qunit:compiled
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
needs: [ test-js ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
@ -98,6 +70,8 @@ jobs:
|
||||
failed-workflow:
|
||||
name: Failed workflow tasks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
needs: [ test-js, slack-notifications ]
|
||||
if: |
|
||||
always() &&
|
||||
@ -110,7 +84,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
retries: 2
|
||||
retry-exempt-status-codes: 418
|
||||
|
206
.github/workflows/phpunit-tests.yml
vendored
206
.github/workflows/phpunit-tests.yml
vendored
@ -26,48 +26,27 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
# Controls which npm script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
|
||||
PHPUNIT_SCRIPT: php
|
||||
LOCAL_PHP_MEMCACHED: ${{ false }}
|
||||
SLOW_TESTS: 'external-http,media,restapi'
|
||||
# Disable permissions for all available scopes by default.
|
||||
# Any needed permissions should be configured at the job level.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# Runs the PHPUnit tests for WordPress.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Sets environment variables.
|
||||
# - Sets up the environment variables needed for testing with memcached (if desired).
|
||||
# - Installs Node.js.
|
||||
# - Installs npm dependencies
|
||||
# - Configures caching for Composer.
|
||||
# - Installs Composer dependencies.
|
||||
# - Logs Docker debug information (about the Docker installation within the runner).
|
||||
# - Starts the WordPress Docker container.
|
||||
# - Starts the Memcached server after the Docker network has been created (if desired).
|
||||
# - Logs general debug information about the runner.
|
||||
# - Logs the running Docker containers.
|
||||
# - Logs debug information from inside the WordPress Docker container.
|
||||
# - Logs debug information about what's installed within the WordPress Docker containers.
|
||||
# - Install WordPress within the Docker container.
|
||||
# - Run the PHPUnit tests.
|
||||
# - Checks out the WordPress Test reporter repository.
|
||||
# - Reconnect the directory to the Git repository.
|
||||
# - Submit the test results to the WordPress.org host test results.
|
||||
# Creates PHPUnit test jobs.
|
||||
test-php:
|
||||
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
name: PHP ${{ matrix.php }}
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v2.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
secrets: inherit
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ]
|
||||
os: [ ubuntu-latest ]
|
||||
memcached: [ false ]
|
||||
split_slow: [ false ]
|
||||
php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4' ]
|
||||
multisite: [ false, true ]
|
||||
split_slow: [ false ]
|
||||
memcached: [ false ]
|
||||
include:
|
||||
# Additional "slow" jobs for PHP 5.6.
|
||||
- php: '5.6'
|
||||
@ -85,155 +64,31 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
memcached: true
|
||||
multisite: false
|
||||
split_slow: false
|
||||
- php: '7.4'
|
||||
os: ubuntu-latest
|
||||
memcached: true
|
||||
multisite: true
|
||||
# Report the results of the PHP 7.4 without memcached job.
|
||||
- php: '7.4'
|
||||
os: ubuntu-latest
|
||||
memcached: false
|
||||
multisite: false
|
||||
report: true
|
||||
env:
|
||||
LOCAL_PHP: ${{ matrix.php }}-fpm
|
||||
LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }}
|
||||
PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
|
||||
|
||||
steps:
|
||||
- name: Configure environment variables
|
||||
run: |
|
||||
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
|
||||
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Get Composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "composer_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12 # v3.2.3
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.composer_dir }}
|
||||
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: |
|
||||
if [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then
|
||||
docker-compose run --rm php composer update
|
||||
git checkout -- composer.lock
|
||||
elif [[ ${{ env.LOCAL_PHP }} == '5.6.20-fpm' || ${{ env.LOCAL_PHP }} == '5.6-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then
|
||||
docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies
|
||||
git checkout -- composer.lock composer.json
|
||||
else
|
||||
docker-compose run --rm php composer install
|
||||
fi
|
||||
|
||||
- name: Docker debug information
|
||||
run: |
|
||||
docker -v
|
||||
docker-compose -v
|
||||
|
||||
- name: Start Docker environment
|
||||
run: |
|
||||
npm run env:start
|
||||
|
||||
# The memcached server needs to start after the Docker network has been set up with `npm run env:start`.
|
||||
- name: Start the Memcached server.
|
||||
if: ${{ matrix.memcached }}
|
||||
run: |
|
||||
cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
|
||||
docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
|
||||
|
||||
- name: General debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
curl --version
|
||||
git --version
|
||||
svn --version
|
||||
|
||||
- name: Log running Docker containers
|
||||
run: docker ps -a
|
||||
|
||||
- name: WordPress Docker container debug information
|
||||
run: |
|
||||
docker-compose run --rm mysql mysql --version
|
||||
docker-compose run --rm php php --version
|
||||
docker-compose run --rm php php -m
|
||||
docker-compose run --rm php php -i
|
||||
docker-compose run --rm php locale -a
|
||||
|
||||
- name: Install WordPress
|
||||
run: npm run env:install
|
||||
|
||||
- name: Run slow PHPUnit tests
|
||||
if: ${{ matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }}
|
||||
|
||||
- name: Run PHPUnit tests for single site excluding slow tests
|
||||
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required
|
||||
|
||||
- name: Run PHPUnit tests for Multisite excluding slow tests
|
||||
if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers
|
||||
|
||||
- name: Run PHPUnit tests
|
||||
if: ${{ matrix.php >= '7.0' }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }}
|
||||
|
||||
- name: Run AJAX tests
|
||||
if: ${{ ! matrix.split_slow && ! matrix.multisite }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax
|
||||
|
||||
- name: Run ms-files tests as a multisite install
|
||||
if: ${{ matrix.multisite && ! matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files
|
||||
|
||||
- name: Run external HTTP tests
|
||||
if: ${{ ! matrix.multisite && ! matrix.split_slow }}
|
||||
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http
|
||||
|
||||
# __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
|
||||
- name: Run (xDebug) tests
|
||||
if: ${{ ! matrix.split_slow }}
|
||||
run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
|
||||
|
||||
- name: Checkout the WordPress Test Reporter
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
repository: 'WordPress/phpunit-test-runner'
|
||||
path: 'test-runner'
|
||||
|
||||
- name: Submit test results to the WordPress.org host test results
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
|
||||
env:
|
||||
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
|
||||
run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
|
||||
split_slow: false
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
php: ${{ matrix.php }}
|
||||
multisite: ${{ matrix.multisite }}
|
||||
split_slow: ${{ matrix.split_slow }}
|
||||
test_ajax: ${{ ! matrix.multisite }}
|
||||
memcached: ${{ matrix.memcached }}
|
||||
phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }}
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
needs: [ test-php ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
@ -243,19 +98,22 @@ jobs:
|
||||
failed-workflow:
|
||||
name: Failed workflow tasks
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ test-php, slack-notifications ]
|
||||
permissions:
|
||||
actions: write
|
||||
needs: [ slack-notifications ]
|
||||
if: |
|
||||
always() &&
|
||||
github.repository == 'WordPress/wordpress-develop' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.run_attempt < 2 &&
|
||||
(
|
||||
needs.test-php.result == 'cancelled' || needs.test-php.result == 'failure'
|
||||
contains( needs.*.result, 'cancelled' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
)
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
retries: 2
|
||||
retry-exempt-status-codes: 418
|
||||
|
135
.github/workflows/test-build-processes.yml
vendored
Normal file
135
.github/workflows/test-build-processes.yml
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
name: Test Build Processes
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
tags:
|
||||
- '[0-9]+.[0-9]'
|
||||
- '[0-9]+.[0-9].[0-9]+'
|
||||
pull_request:
|
||||
branches:
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
paths:
|
||||
# These files configure npm. Changes could affect the outcome.
|
||||
- 'package*.json'
|
||||
# JavaScript files are built using npm.
|
||||
- '**.js'
|
||||
# CSS and SCSS files are built using npm.
|
||||
- '**.scss'
|
||||
- '**.css'
|
||||
# Changes to workflow files should always verify all workflows are successful.
|
||||
- '.github/workflows/**.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Disable permissions for all available scopes by default.
|
||||
# Any needed permissions should be configured at the job level.
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
# Tests the WordPress Core build process on multiple operating systems.
|
||||
test-core-build-process:
|
||||
name: Core running from ${{ matrix.directory }}
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest ]
|
||||
directory: [ 'src', 'build' ]
|
||||
include:
|
||||
# Only prepare artifacts once.
|
||||
- os: ubuntu-latest
|
||||
directory: 'build'
|
||||
prepare-playground: true
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
directory: ${{ matrix.directory }}
|
||||
prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }}
|
||||
test-emoji: false
|
||||
|
||||
# Tests the WordPress Core build process on MacOS.
|
||||
#
|
||||
# This is separate from the job above in order to use stricter conditions when determining when to run.
|
||||
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
|
||||
#
|
||||
# The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
|
||||
# currently no way to determine the OS being used on a given job.
|
||||
# See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
|
||||
test-core-build-process-macos:
|
||||
name: Core running from ${{ matrix.directory }}
|
||||
uses: WordPress/wordpress-develop/.github/workflows/reusable-test-core-build-process.yml@trunk
|
||||
permissions:
|
||||
contents: read
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ macos-13 ]
|
||||
directory: [ 'src', 'build' ]
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
directory: ${{ matrix.directory }}
|
||||
test-emoji: false
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
needs: [ test-core-build-process, test-core-build-process-macos ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
||||
failed-workflow:
|
||||
name: Failed workflow tasks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
needs: [ slack-notifications ]
|
||||
if: |
|
||||
always() &&
|
||||
github.repository == 'WordPress/wordpress-develop' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.run_attempt < 2 &&
|
||||
(
|
||||
contains( needs.*.result, 'cancelled' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
)
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
retries: 2
|
||||
retry-exempt-status-codes: 418
|
||||
script: |
|
||||
github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'failed-workflow.yml',
|
||||
ref: 'trunk',
|
||||
inputs: {
|
||||
run_id: '${{ github.run_id }}'
|
||||
}
|
||||
});
|
192
.github/workflows/test-npm.yml
vendored
192
.github/workflows/test-npm.yml
vendored
@ -1,192 +0,0 @@
|
||||
name: Test npm
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
tags:
|
||||
- '[0-9]+.[0-9]'
|
||||
- '[0-9]+.[0-9].[0-9]+'
|
||||
pull_request:
|
||||
branches:
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
paths:
|
||||
# These files configure npm. Changes could affect the outcome.
|
||||
- 'package*.json'
|
||||
# JavaScript files are built using npm.
|
||||
- '**.js'
|
||||
# CSS and SCSS files are built using npm.
|
||||
- '**.scss'
|
||||
- '**.css'
|
||||
# Changes to workflow files should always verify all workflows are successful.
|
||||
- '.github/workflows/**.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
|
||||
jobs:
|
||||
# Verifies that installing npm dependencies and building WordPress works as expected.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs Node.js.
|
||||
# _ Installs npm dependencies.
|
||||
# - Builds WordPress to run from the `build` directory.
|
||||
# - Cleans up after building WordPress to the `build` directory.
|
||||
# - Builds WordPress to run from the `src` directory.
|
||||
# - Cleans up after building WordPress to the `src` directory.
|
||||
test-npm:
|
||||
name: Test npm on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
curl --version
|
||||
git --version
|
||||
svn --version
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build WordPress
|
||||
run: npm run build
|
||||
|
||||
- name: Clean after building
|
||||
run: npm run grunt clean
|
||||
|
||||
- name: Build WordPress in /src
|
||||
run: npm run build:dev
|
||||
|
||||
- name: Clean after building in /src
|
||||
run: npm run grunt clean -- --dev
|
||||
|
||||
# Verifies that installing npm dependencies and building WordPress works as expected on MacOS.
|
||||
#
|
||||
# This is separate from the job above in order to use stricter conditions about when to run.
|
||||
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
|
||||
#
|
||||
# The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is
|
||||
# currently no way to determine the OS being used on a given job.
|
||||
# See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs Node.js.
|
||||
# _ Installs npm dependencies.
|
||||
# - Builds WordPress to run from the `build` directory.
|
||||
# - Cleans up after building WordPress to the `build` directory.
|
||||
# - Builds WordPress to run from the `src` directory.
|
||||
# - Cleans up after building WordPress to the `src` directory.
|
||||
test-npm-macos:
|
||||
name: Test npm on MacOS
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 30
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
npm --version
|
||||
node --version
|
||||
curl --version
|
||||
git --version
|
||||
svn --version
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build WordPress
|
||||
run: npm run build
|
||||
|
||||
- name: Clean after building
|
||||
run: npm run grunt clean
|
||||
|
||||
- name: Build WordPress in /src
|
||||
run: npm run build:dev
|
||||
|
||||
- name: Clean after building in /src
|
||||
run: npm run grunt clean -- --dev
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
needs: [ test-npm, test-npm-macos ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
||||
failed-workflow:
|
||||
name: Failed workflow tasks
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ test-npm, test-npm-macos, slack-notifications ]
|
||||
if: |
|
||||
always() &&
|
||||
github.repository == 'WordPress/wordpress-develop' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.run_attempt < 2 &&
|
||||
(
|
||||
needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
|
||||
needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
|
||||
)
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
|
||||
with:
|
||||
retries: 2
|
||||
retry-exempt-status-codes: 418
|
||||
script: |
|
||||
github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'failed-workflow.yml',
|
||||
ref: 'trunk',
|
||||
inputs: {
|
||||
run_id: '${{ github.run_id }}'
|
||||
}
|
||||
});
|
59
.github/workflows/welcome-new-contributors.yml
vendored
59
.github/workflows/welcome-new-contributors.yml
vendored
@ -1,59 +0,0 @@
|
||||
name: Welcome New Contributors
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
# Comments on a pull request when the author is a new contributor.
|
||||
post-welcome-message:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
|
||||
steps:
|
||||
- uses: wow-actions/welcome@72817eb31cda1de60f51893d80e2e82ce57f7e76 # v1.3.0
|
||||
with:
|
||||
FIRST_PR_COMMENT: >
|
||||
Hi @{{ author }}! 👋
|
||||
|
||||
|
||||
Thank you for your contribution to WordPress! 💖
|
||||
|
||||
|
||||
It looks like this is your first pull request to `wordpress-develop`. Here are a few things to be aware of that may help you out!
|
||||
|
||||
|
||||
**No one monitors this repository for new pull requests.** Pull requests **must** be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.
|
||||
|
||||
|
||||
**Pull requests are never merged on GitHub.** The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.
|
||||
|
||||
|
||||
More information about how GitHub pull requests can be used to contribute to WordPress can be found in [this blog post](https://make.wordpress.org/core/2020/02/21/working-on-trac-tickets-using-github-pull-requests/).
|
||||
|
||||
|
||||
**Please include automated tests.** Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the [Automated Testing](https://make.wordpress.org/core/handbook/testing/automated-testing/) page in the handbook.
|
||||
|
||||
|
||||
If you have not had a chance, please review the [Contribute with Code page](https://make.wordpress.org/core/handbook/contribute/) in the [WordPress Core Handbook](https://make.wordpress.org/core/handbook/).
|
||||
|
||||
|
||||
The [Developer Hub](https://developer.wordpress.org/) also documents the various [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) that are followed:
|
||||
|
||||
- [PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/)
|
||||
|
||||
- [CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/)
|
||||
|
||||
- [HTML Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/html/)
|
||||
|
||||
- [JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/)
|
||||
|
||||
- [Accessibility Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/)
|
||||
|
||||
- [Inline Documentation Standards](https://developer.wordpress.org/coding-standards/inline-documentation-standards/)
|
||||
|
||||
|
||||
Thank you,
|
||||
|
||||
The WordPress Project
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ wp-tests-config.php
|
||||
/phpunit.xml
|
||||
/.phpcs.xml
|
||||
/phpcs.xml
|
||||
.cache/*
|
||||
/tests/phpunit/data/plugins/wordpress-importer
|
||||
/tests/phpunit/data/.trac-ticket-cache*
|
||||
/tests/qunit/compiled.html
|
||||
|
@ -1,5 +1,3 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
|
||||
##
|
||||
@ -21,11 +19,14 @@ services:
|
||||
- ./tools/local-env/default.template:/etc/nginx/conf.d/default.template
|
||||
- ./:/var/www
|
||||
|
||||
# Load our config file, substituning environment variables into the config.
|
||||
# Load our config file, substituting environment variables into the config.
|
||||
command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
|
||||
|
||||
depends_on:
|
||||
- php
|
||||
php:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
##
|
||||
# The PHP container.
|
||||
@ -37,27 +38,40 @@ services:
|
||||
- wpdevnet
|
||||
|
||||
environment:
|
||||
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
||||
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
||||
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
||||
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
||||
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
||||
- XDEBUG_MODE=${LOCAL_PHP_XDEBUG_MODE-develop,debug}
|
||||
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
||||
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
||||
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
||||
- GITHUB_REF=${GITHUB_REF-false}
|
||||
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
|
||||
|
||||
volumes:
|
||||
- ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
|
||||
- ./:/var/www
|
||||
|
||||
depends_on:
|
||||
- mysql
|
||||
# Copy or delete the Memcached dropin plugin file as appropriate.
|
||||
command: /bin/sh -c "if [ $LOCAL_PHP_MEMCACHED = true ]; then cp -n /var/www/tests/phpunit/includes/object-cache.php /var/www/src/wp-content/object-cache.php; else rm -f /var/www/src/wp-content/object-cache.php; fi && exec php-fpm"
|
||||
|
||||
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
||||
init: true
|
||||
|
||||
extra_hosts:
|
||||
- localhost:host-gateway
|
||||
|
||||
##
|
||||
# The MySQL container.
|
||||
##
|
||||
mysql:
|
||||
image: amd64/${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
|
||||
image: ${LOCAL_DB_TYPE-mysql}:${LOCAL_DB_VERSION-latest}
|
||||
platform: linux/amd64
|
||||
|
||||
networks:
|
||||
- wpdevnet
|
||||
|
||||
ports:
|
||||
- "3306"
|
||||
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
|
||||
@ -68,6 +82,12 @@ services:
|
||||
# For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "if [ \"$LOCAL_DB_TYPE\" = \"mariadb\" ]; then mariadb-admin ping -h localhost; else mysqladmin ping -h localhost; fi" ]
|
||||
timeout: 5s
|
||||
interval: 5s
|
||||
retries: 10
|
||||
|
||||
##
|
||||
# The WP CLI container.
|
||||
##
|
||||
@ -78,10 +98,10 @@ services:
|
||||
- wpdevnet
|
||||
|
||||
environment:
|
||||
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
||||
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
||||
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
||||
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
||||
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
||||
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
||||
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
||||
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
||||
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
@ -89,6 +109,15 @@ services:
|
||||
# The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
|
||||
init: true
|
||||
|
||||
extra_hosts:
|
||||
- localhost:host-gateway
|
||||
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
##
|
||||
# The PHPUnit container.
|
||||
##
|
||||
@ -99,14 +128,14 @@ services:
|
||||
- wpdevnet
|
||||
|
||||
environment:
|
||||
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
|
||||
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
|
||||
LOCAL_DIR: ${LOCAL_DIR-src}
|
||||
WP_MULTISITE: ${WP_MULTISITE-false}
|
||||
PHP_FPM_UID: ${PHP_FPM_UID-1000}
|
||||
PHP_FPM_GID: ${PHP_FPM_GID-1000}
|
||||
TRAVIS_BRANCH: ${TRAVIS_BRANCH-false}
|
||||
TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST-false}
|
||||
- LOCAL_PHP_XDEBUG=${LOCAL_PHP_XDEBUG-false}
|
||||
- LOCAL_PHP_MEMCACHED=${LOCAL_PHP_MEMCACHED-false}
|
||||
- PHP_FPM_UID=${PHP_FPM_UID-1000}
|
||||
- PHP_FPM_GID=${PHP_FPM_GID-1000}
|
||||
- LOCAL_DIR=${LOCAL_DIR-src}
|
||||
- WP_MULTISITE=${WP_MULTISITE-false}
|
||||
- GITHUB_REF=${GITHUB_REF-false}
|
||||
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME-false}
|
||||
|
||||
volumes:
|
||||
- ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
|
||||
@ -117,7 +146,26 @@ services:
|
||||
init: true
|
||||
|
||||
depends_on:
|
||||
- mysql
|
||||
php:
|
||||
condition: service_started
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
|
||||
##
|
||||
# The Memcached container.
|
||||
##
|
||||
memcached:
|
||||
image: memcached
|
||||
|
||||
networks:
|
||||
- wpdevnet
|
||||
|
||||
ports:
|
||||
- 11211:11211
|
||||
|
||||
depends_on:
|
||||
php:
|
||||
condition: service_started
|
||||
|
||||
volumes:
|
||||
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
|
||||
|
@ -11,7 +11,7 @@
|
||||
<arg name="extensions" value="php"/>
|
||||
|
||||
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
|
||||
<arg name="cache"/>
|
||||
<arg name="cache" value=".cache/phpcompat.json"/>
|
||||
|
||||
<!-- Set the memory limit to 256M.
|
||||
For most standard PHP configurations, this means the memory limit will temporarily be raised.
|
||||
|
@ -6,7 +6,7 @@
|
||||
<arg name="extensions" value="php"/>
|
||||
|
||||
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
|
||||
<arg name="cache"/>
|
||||
<arg name="cache" value=".cache/phpcs.json"/>
|
||||
|
||||
<!-- Set the memory limit to 256M.
|
||||
For most standard PHP configurations, this means the memory limit will temporarily be raised.
|
||||
|
@ -180,22 +180,23 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow tests to be skipped on some automated runs.
|
||||
* Allows tests to be skipped on some automated runs.
|
||||
*
|
||||
* For test runs on Travis for something other than trunk/master
|
||||
* we want to skip tests that only need to run for master.
|
||||
* For test runs on GitHub Actions for something other than trunk,
|
||||
* we want to skip tests that only need to run for trunk.
|
||||
*/
|
||||
public function skipOnAutomatedBranches() {
|
||||
// https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
||||
$travis_branch = getenv( 'TRAVIS_BRANCH' );
|
||||
$travis_pull_request = getenv( 'TRAVIS_PULL_REQUEST' );
|
||||
// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||
$github_event_name = getenv( 'GITHUB_EVENT_NAME' );
|
||||
$github_ref = getenv( 'GITHUB_REF' );
|
||||
|
||||
if ( ! $travis_branch || ! $travis_pull_request ) {
|
||||
return;
|
||||
}
|
||||
if ( $github_event_name ) {
|
||||
// We're on GitHub Actions.
|
||||
$skipped = array( 'pull_request', 'pull_request_target' );
|
||||
|
||||
if ( 'master' !== $travis_branch || 'false' !== $travis_pull_request ) {
|
||||
$this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
|
||||
if ( in_array( $github_event_name, $skipped, true ) || 'refs/heads/trunk' !== $github_ref ) {
|
||||
$this->markTestSkipped( 'For automated test runs, this test is only run on trunk' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,5 @@ const { execSync } = require( 'child_process' );
|
||||
|
||||
dotenvExpand( dotenv.config() );
|
||||
|
||||
// Execute any docker-compose command passed to this script.
|
||||
execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
|
||||
// Execute any docker compose command passed to this script.
|
||||
execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
|
||||
|
@ -44,7 +44,7 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
|
||||
* @param {string} cmd The WP-CLI command to run.
|
||||
*/
|
||||
function wp_cli( cmd ) {
|
||||
execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
|
||||
execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,5 +53,5 @@ function wp_cli( cmd ) {
|
||||
function install_wp_importer() {
|
||||
const test_plugin_directory = 'tests/phpunit/data/plugins/wordpress-importer';
|
||||
|
||||
execSync( `docker-compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
|
||||
execSync( `docker compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
|
||||
}
|
||||
|
@ -5,7 +5,10 @@ const { execSync } = require( 'child_process' );
|
||||
dotenvExpand( dotenv.config() );
|
||||
|
||||
// Start the local-env containers.
|
||||
execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
|
||||
const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
|
||||
? 'wordpress-develop memcached'
|
||||
: 'wordpress-develop';
|
||||
execSync( `docker compose up -d ${containers}`, { stdio: 'inherit' } );
|
||||
|
||||
// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
|
||||
if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user