Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#50042 closed task (blessed) (fixed)

Update Docker environment to allow specific versions of PHPUnit to be loaded

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

To help with tackling #48301, new PHPUnit images now being created for all combinations of supported PHPUnit versions on each PHP version.

To make loading specific versions of PHPUnit possible, Core's Docker file needs to be updated.

See the GitHub PR and PHPUnit version compatibility page in the handbook.

Related: #47767.

Attachments (5)

50042.diff (1.1 KB) - added by desrosj 4 years ago.
50042.2.diff (3.9 KB) - added by desrosj 4 years ago.
50042.2.2.diff (4.3 KB) - added by desrosj 4 years ago.
50042.3.diff (6.4 KB) - added by desrosj 4 years ago.
50042.4.diff (8.7 KB) - added by desrosj 4 years ago.

Download all attachments as: .zip

Change History (22)

@desrosj
4 years ago

#1 @desrosj
4 years ago

Besides using this and changing the version of PHPUnit locally in the .env file, Travis jobs can be updated as such:

- env: LOCAL_PHP=7.0-fpm LOCAL_PHPUNIT=6-php-7.0-fpm WP_TRAVISCI=test:php

For older branches (4.7-5.0), PHPUnit 6 is required for PHP 7.0. This would ensure the required version is installed.

#2 @desrosj
4 years ago

  • Owner set to desrosj
  • Status changed from new to assigned

#3 @desrosj
4 years ago

  • Keywords 2nd-opinion added

This implementation has one issue though.

Currently, the LOCAL_PHP value is used to load PHPUnit. However, now that it has it's own independent variable, committing 50042.diff would cause all PHP 5.6 jobs using trunk would fail unless LOCAL_PHPUNIT is set correctly because PHPUnit 5 is required. In 50042.diff, latest would be used, which would load 7.

#4 @desrosj
4 years ago

  • Milestone changed from 5.5 to Future Release

I'm going to punt this for now with beta 1 tomorrow. It's a build tooling ticket, so it can be committed later if someone has a chance to work on it.

@desrosj
4 years ago

@desrosj
4 years ago

#5 @desrosj
4 years ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Future Release to 5.6

50042.2.2.diff makes use of dotenv-expand to allow LOCAL_PHP to be referenced as a default within the .env file.

#6 @johnbillion
4 years ago

Chatted a bit with Jonathan about this. I'm in favour of using these Docker images to serve an appropriate PHPUnit version for any given PHP+WP combo, but I'd like the docblock in .env to be a bit clearer about the supported versions because the images for PHP<=5.5 use a different naming pattern. A link to https://hub.docker.com/r/wordpressdevelop/phpunit/tags would be helpful.

@desrosj
4 years ago

#7 @desrosj
4 years ago

  • Keywords commit added

50042.3.diff updates the documentation in the .env file based on the discussions @johnbillion and I had.

#8 @desrosj
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 49358:

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.

#9 @desrosj
4 years ago

In 49360:

Build/Test Tools: Revert [49358] to investigate failures.

Unprops desrosj.
See #50042.

#10 @desrosj
4 years ago

  • Keywords commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I tested this pretty thoroughly locally, but for some reason it does not work as expected within Travis. Going to investigate further.

This ticket was mentioned in Slack in #core by sergey. View the logs.


4 years ago

@desrosj
4 years ago

#12 @desrosj
4 years ago

Did some investigating into the reasons why [49358] works locally but fails on Travis.

It seems that using dotenv-expand to change the value assigned to the LOCAL_PHPUNIT environment variable is only a problem for Travis as the GitHub Action workflow for PHPUnit testing also ran successfully.

Defining the variable within the matrix for the jobs that utilize the Docker environment fixes the issue.

#13 @SergeyBiryukov
4 years ago

  • Keywords commit added

50042.4.diff looks good to me.

#14 @desrosj
4 years ago

In 49362:

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.

#15 @desrosj
4 years ago

In 49363:

Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.

This introduces the LOCAL_PHPUNIT environment variable, which 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.
Merges [49362] to the 5.5 branch.
See #50042.

#16 @desrosj
4 years ago

In 49364:

Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.

This introduces the LOCAL_PHPUNIT environment variable, which 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.
Merges [49362] to the 5.4 branch.
See #50042.

#17 @desrosj
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 49366:

Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.

This introduces the LOCAL_PHPUNIT environment variable, which 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.
Merges [49362] to the 5.3 branch.
Fixes #50042.

Note: See TracTickets for help on using tickets.