27 Commits

Author SHA1 Message Date
Jonathan Desrosiers
2e71cf3081 Build/Test Tools: Add MySQL 8.4 support to the Docker environment.
Because `caching_sha2_password` is not supported on PHP 7.2 & 7.3, the local Docker environment has used the `--default-authentication-plugin` system variable to always make use of `mysql_native_password` despite MySQL 8.0 deprecating this auth plugin.

However in MySQL 8.4, the `--default-authentication-plugin` option was removed in favor of `--authentication-policy`, and `mysql_native_password` is now disabled by default. `mysql_native_password` has also been removed in MySQL 9.0.

This change adds support to the local Docker environment for MySQL 8.4 by adding some helper functions that determine which authentication plugin should be used based on the configured PHP/MySQL versions and automatically making the necessary configuration adjustments. 

Props ayeshrajans, johnbillion, aristath, jorbin.
See #61218.

git-svn-id: https://develop.svn.wordpress.org/trunk@59279 602fd350-edb4-49c9-b593-d223f7449a82
2024-10-23 00:05:55 +00:00
Jonathan Desrosiers
6f1423535a Build/Test Tools: Revert [59277] to add a proper commit message.
Unprops desrosj.

git-svn-id: https://develop.svn.wordpress.org/trunk@59278 602fd350-edb4-49c9-b593-d223f7449a82
2024-10-22 23:44:25 +00:00
Jonathan Desrosiers
170611ca02 Build/Test Tools: Add support for MySQL 8.4 to the Docker environment.
See #62221.

git-svn-id: https://develop.svn.wordpress.org/trunk@59277 602fd350-edb4-49c9-b593-d223f7449a82
2024-10-22 23:41:29 +00:00
Jonathan Desrosiers
3d0a228a34 Build/Test Tools: Remove version from docker-compose.yml.
The `version` property throws a warning when working with the local Docker environment. According to the Docker Compose spec, the property only remains for backward compatibility and should be removed.

Props narenin, mukesh27, swissspidy.
Fixes #61101.

git-svn-id: https://develop.svn.wordpress.org/trunk@58157 602fd350-edb4-49c9-b593-d223f7449a82
2024-05-15 15:33:19 +00:00
Jonathan Desrosiers
b4819647f2 Build/Test Tools: Fix bug pulling local environment containers on Apple silicone.
The MySQL Docker containers for versions 5.7 and below do not support recent Apple silicone chips. Previously this was fixed by including `amd64/` as a prefix to the image name in the `docker-compose.yml` file (see [54096]). However, this stopped working after recent updates to Docker Desktop.

This changeset removes the `amd64/` prefix for the image used as the database container and raises the default version of MySQL in the local development environment to the current LTS version (8.0). Because this version is still maintained, there are `arm64` containers available to use.

This also documents a new workaround for contributors looking to run the local Docker environment using MySQL 5.7 or earlier, which entails creating a small `docker-compose.override.yml`.

Props bernhard-reiter, johnbillion, afragen, huzaifaalmesbah.
Fixes #59930.

git-svn-id: https://develop.svn.wordpress.org/trunk@57568 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-08 19:10:10 +00:00
Jonathan Desrosiers
a8a0bf0cc8 Build/Test Tools: Ensure database containers are prepared for commands.
By default, Docker waits for a container to be started before considering it “ready”. But this does not necessarily mean that it’s ready to receive commands.

This adds a check that ensures the database container is ready to receive commands before proceeding with running commands.

Follow up to [56439], [56440], [56443].

Props rmccue, desrosj.
See #30462, #58867.

git-svn-id: https://develop.svn.wordpress.org/trunk@56464 602fd350-edb4-49c9-b593-d223f7449a82
2023-08-24 21:02:47 +00:00
John Blackbourn
d51e65b78f Build/Test Tools: Always use the amd64 images for MariaDB and MySQL on the local development environment.
The `amd64/mysql` and `amd64/mariadb` official images from Docker are also compatible with an x64 host machine which means they can be used by default instead of only when the host uses ARM64.

Props bernhard-reiter, czapla, gmovr, withinboredom

Fixes #56528


git-svn-id: https://develop.svn.wordpress.org/trunk@54096 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-07 17:13:43 +00:00
John Blackbourn
0e04c0a621 Build/Test Tools: Move the Memcached container into the Docker Compose config.
This allows a developer to use the persistent Memcached object cache on their local development environment via the `LOCAL_PHP_MEMCACHED` environment variable.

Enable the memcached config via `LOCAL_PHP_MEMCACHED=true` in the `.env` file and then restart the environment with `npm run env:restart`.

Fixes #55700


git-svn-id: https://develop.svn.wordpress.org/trunk@53895 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-13 23:23:26 +00:00
John Blackbourn
a629d1cc6c Build/Test Tools: Enable loopback requests to work on the local development environment.
This maps `localhost` to the host machine so the requests get routed to the web server container.

Props sandrasanzdev, hasanuzzamanshamim

Fixes #52708


git-svn-id: https://develop.svn.wordpress.org/trunk@53636 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-02 22:52:38 +00:00
John Blackbourn
ddfc8e9f2e Build/Test Tools: Run the PHP container with PID > 1 so Ctrl+C works correctly.
This allows for cancellation of operations in the PHP container, such as a PHPUnit test suite run.

Fixes #55702


git-svn-id: https://develop.svn.wordpress.org/trunk@53628 602fd350-edb4-49c9-b593-d223f7449a82
2022-07-01 19:35:47 +00:00
Jonathan Desrosiers
c40b46525c Build/Test Tools: Configure Xdebug modes in the local Docker environment.
One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.

When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.

This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.

The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.

By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.

Props afragen, johnbillion, desrosj.
Fixes #56022.

git-svn-id: https://develop.svn.wordpress.org/trunk@53552 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-21 23:45:19 +00:00
Sergey Biryukov
04e9728701 Build/Test Tools: Pass GitHub Actions environment variables to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to the `GITHUB_REF` and `GITHUB_EVENT_NAME` variables, so that some tests can be skipped when appropriate.

Additionally, account for renaming the `master` branch to `trunk` in November 2021.

Follow-up to [40241], [46999], [49264], [49267], [51868].

Fixes #55668.

git-svn-id: https://develop.svn.wordpress.org/trunk@53349 602fd350-edb4-49c9-b593-d223f7449a82
2022-05-04 00:38:18 +00:00
Tonya Mork
284764c658 Build/Test Tools: Remove the PHPUnit container from local Docker environment.
This commit:

* Removes the PHPUnit `wordpressdevelop/phpunit` container as a service to the Docker environment.
* Updates `test:php` (the default way to run tests) to run the Composer PHPUnit package  default.
* Removes the `test:php-composer` script.

There is no longer a need for core to keep the `wordpressdevelop/phpunit` container as a service in `docker-compose.yml`. Removing it will reduce the overhead and bandwidth needed to set up WordPress locally and remove confusion about its use.

Follow-up to [45783-45784], [49099], [49362], [51545], [51736], [51685].

Props johnbillion, hellofromTonya.
Fixes #54112.

git-svn-id: https://develop.svn.wordpress.org/trunk@51868 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 16:54:42 +00:00
Jonathan Desrosiers
62e8d8f115 Build/Test Tools: Use list format when defining environment variables in Docker compose file.
This is the correct formatting detailed in the Docker `compose` documentation examples and helps to avoid ambiguities in the yaml parser when values that may cause warnings.

Props pbrearne, ocean90, johnbillion, desrosj.
Fixes #53820.

git-svn-id: https://develop.svn.wordpress.org/trunk@51673 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-26 18:40:15 +00:00
Dominik Schilling
87fc38e588 Build/Test Tools: Remove remaining Travis CI references.
* Remove `travis:` tasks in Gruntfile.js.
* Remove status badge in README.md that comes from Travis CI via shields.io.
* Remove Travis CI related skipping in the `WP_UnitTestCase_Base::skipOnAutomatedBranches()` test method and related Docker environment variables.

Props johnbillion, SergeyBiryukov, ocean90.
See #52161.
Fixes #52666.

git-svn-id: https://develop.svn.wordpress.org/trunk@50697 602fd350-edb4-49c9-b593-d223f7449a82
2021-04-10 12:05:50 +00:00
Jonathan Desrosiers
3109b32fc9 Build/Test Tools: Support the use of MariaDB in the local Docker environment.
In addition to MySQL, WordPress also supports MariaDB for databases. This makes changes to the local Docker environment to allow MariaDB to be used instead, if desired.

The `LOCAL_DB_TYPE` environment variable will now be used to determine which type of database container to use. This will default to `mysql`, but will also accept `mariadb`.

The `LOCAL_MYSQL` environment variable (which previously held the version of MySQL to use) has been replaced with the new, more generic `LOCAL_DB_VERSION` environment variable.

This change will make it possible to perform automated testing on a wider array of supported database types and versions.

Props davidbaumwald.
Fixes #51744. See #30462.

git-svn-id: https://develop.svn.wordpress.org/trunk@49836 602fd350-edb4-49c9-b593-d223f7449a82
2020-12-18 15:27:33 +00:00
Jonathan Desrosiers
c812f63015 Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.
This reintroduces [49358] with a modification to the `.travis.yml` file to avoid an issue with `dotenv-expand` being unable to expand variables into `process.env` only on Travis.

The `LOCAL_PHPUNIT` environment variabl allows the desired version of PHPUnit to be specified when running the PHP tests within the local Docker environment.

Because support for newer versions of PHPUnit is not backported, some versions of PHP need the ability to run multiple versions of PHPUnit for different branches. This adds the flexibility needed to use the Docker environment within those older branches to run the PHP tests.

Props johnbillion, SergeyBiryukov.
See #50042.

git-svn-id: https://develop.svn.wordpress.org/trunk@49362 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-28 23:15:07 +00:00
Jonathan Desrosiers
26278f14bf Build/Test Tools: Revert [49358] to investigate failures.
Unprops desrosj.
See #50042.

git-svn-id: https://develop.svn.wordpress.org/trunk@49360 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-28 19:42:29 +00:00
Jonathan Desrosiers
a3bd11826a Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.
This change introduces the `LOCAL_PHPUNIT` environment variable that allows the desired version of PHPUnit to be specified when running the PHP tests within the local Docker environment.

Because support for newer versions of PHPUnit is not backported, some versions of PHP need the ability to run multiple versions of PHPUnit for different branches. This adds the flexibility needed to use the Docker environment within those older branches to run the PHP tests.

Props johnbillion.
Fixes #50042.

git-svn-id: https://develop.svn.wordpress.org/trunk@49358 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-28 19:01:19 +00:00
Jonathan Desrosiers
91b5e5255e Build/Test Tools: Pass GitHub Action related environment variables to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to these variables so that time sensitive tests can be skipped when appropriate.

This also updates that logic to be more clear.

Follow up to [49264].

Props ocean90, johnbillion.
See #50401, #49050, #47767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49267 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-21 19:55:17 +00:00
Jonathan Desrosiers
05e1cb8b0b Docs: Fix a typo in the Docker compose file.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@47912 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-04 16:51:32 +00:00
Sergey Biryukov
89dfd4052a Build/Test Tools: Expose port 3306 of MySQL container.
This only defines the container port to allow `docker-compose` to choose an ephemeral host port.

Props ocean90, peterwilsoncc.
Fixes #48281.

git-svn-id: https://develop.svn.wordpress.org/trunk@47225 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-09 21:20:25 +00:00
Sergey Biryukov
2915793376 Build/Test Tools: Pass the TRAVIS_BRANCH and TRAVIS_PULL_REQUEST environment variables along to the Docker container.
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to these variables.

See #49050, #47767.

git-svn-id: https://develop.svn.wordpress.org/trunk@46999 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 00:01:33 +00:00
Gary Pendergast
da43c14a5d Build Tools: Pass the current uid/gid to Docker containers.
This prepares for an upcoming change to the Docker images, which improves file permission handling.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@46320 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 04:57:38 +00:00
Gary Pendergast
ece257ffd0 Build Tools: Pass the LOCAL_DIR environment variable through to the phpunit Docker container.
This allows code running inside the container to know whether it's supposed to be running in `build` or `src`.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45885 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-23 01:55:28 +00:00
Gary Pendergast
f756d801d8 Build Tools: Change the PHPUnit Docker image's working directory to match the other images.
Also, pass the `WP_MULTISITE` environment variable along to the container.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45800 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-15 00:33:32 +00:00
Gary Pendergast
4311bac7e4 Build Tools: Add the docker-compose.yml file, missed in [45783].
See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45784 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-12 09:20:06 +00:00