Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run PHPUnit jobs across multiple PHP versions #46510

Merged
merged 79 commits into from
Jan 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b555d9d
Add a small change to create a PR.
anton-vlasenko Dec 13, 2022
6547f78
Add multiple php versions.
anton-vlasenko Dec 13, 2022
4bf84bb
Add multiple php versions.
anton-vlasenko Dec 13, 2022
1285d42
Define phpVersion as environment variable.
anton-vlasenko Dec 13, 2022
cd74382
Add phpunit tags for PHP 8.1 and 8.2.
anton-vlasenko Dec 13, 2022
20e6d53
Remove hyphen.
anton-vlasenko Dec 13, 2022
f192e2e
Nove PHPUnit tests to a separate file.
anton-vlasenko Dec 13, 2022
0da70ae
Disable `fail-fast`.
anton-vlasenko Dec 13, 2022
c3bbb6a
Update matrix.os.
anton-vlasenko Dec 13, 2022
9b6cd40
Install composer dependencies.
anton-vlasenko Dec 13, 2022
53180a4
Revert "Install composer dependencies."
anton-vlasenko Dec 13, 2022
b60db3d
Revert "Revert "Install composer dependencies.""
anton-vlasenko Dec 13, 2022
2a687ae
Fixing "no phpunit found" error.
aaroncampbell Dec 13, 2022
c161a74
Revert "Fixing "no phpunit found" error."
anton-vlasenko Dec 13, 2022
4381998
Add phpunit tags for PHP 8.1 and 8.2.
anton-vlasenko Dec 13, 2022
f340a41
Debug the phpunitImage.
anton-vlasenko Dec 14, 2022
aa50d13
Use correct composer version.
anton-vlasenko Dec 14, 2022
c67c5b6
Fix container name.
anton-vlasenko Dec 14, 2022
9575fc7
Don't modify package.json.
anton-vlasenko Dec 14, 2022
4d6bdd4
Don't install composer dependencies twice.
anton-vlasenko Dec 14, 2022
461200f
Need to prefix commands with npm run.
anton-vlasenko Dec 14, 2022
b299003
Add double dashes to pass flags to wp-env.
anton-vlasenko Dec 14, 2022
d722186
Fix name of the environment.
anton-vlasenko Dec 14, 2022
8c774d0
Add additional debug information.
anton-vlasenko Dec 14, 2022
4319bac
Composer dependencies should be installed after wp-env is intialised.
anton-vlasenko Dec 14, 2022
b245bc6
Fix wrong command.
anton-vlasenko Dec 14, 2022
6057268
Since the tests are currently run within the Docker containers where …
anton-vlasenko Dec 14, 2022
f8173c6
Fix path to the multisite.xml.
anton-vlasenko Dec 14, 2022
0b8dff9
Fix the test class to be compatible with PHP < 7.3.
anton-vlasenko Dec 14, 2022
2fbdcc4
Fix bug in WP_REST_Block_Pattern_Categories_Controller_Test::wpTearDo…
anton-vlasenko Dec 14, 2022
76fcd32
Remove incompatible PHP packages.
anton-vlasenko Dec 15, 2022
82745d8
Remove incompatible PHP packages.
anton-vlasenko Dec 15, 2022
db2044e
Update description.
anton-vlasenko Dec 15, 2022
460da7c
Remove incompatible PHP packages.
anton-vlasenko Dec 15, 2022
1f607b5
Remove incompatible PHP packages.
anton-vlasenko Dec 15, 2022
d90b2fc
Fix wrong matrix value.
anton-vlasenko Dec 15, 2022
61a096f
Remove incompatible PHP packages.
anton-vlasenko Dec 15, 2022
8232cd1
Don't remove polyfills.
anton-vlasenko Dec 15, 2022
5dfa520
Don't remove spathie package on PHP 7.2.
anton-vlasenko Dec 15, 2022
bc9af74
// strpos() doesn't support negative offset values on PHP prior to ve…
anton-vlasenko Dec 15, 2022
185f26a
Add cliPhpVersion config parameter.
anton-vlasenko Dec 15, 2022
118286f
Don't use custom commands to run the tests.
anton-vlasenko Dec 15, 2022
7abd2c3
Revert "Add cliPhpVersion config parameter."
anton-vlasenko Dec 15, 2022
a6d2aee
Don't use the phpunit docker-compose service.
anton-vlasenko Dec 15, 2022
5890fb6
Fix dynamic properties. PHP 8.2 doesn't support dynamic properties.
anton-vlasenko Dec 15, 2022
be706c6
Fix dynamic properties. PHP 8.2 doesn't support dynamic properties.
anton-vlasenko Dec 15, 2022
d44e9fa
Fix dynamic properties. PHP 8.2 doesn't support dynamic properties.
anton-vlasenko Dec 15, 2022
780e12e
Allow /.cache/.gitkeep files.
anton-vlasenko Dec 16, 2022
1cbe0ee
Add the .gitkeep file.
anton-vlasenko Dec 16, 2022
f1cb171
Add PHP Coding Stadnards.
anton-vlasenko Dec 16, 2022
2d5e7f0
Fix the if condition.
anton-vlasenko Dec 16, 2022
1636e2d
Fix path.
anton-vlasenko Dec 16, 2022
f9dfc91
Rename Core to Gutenberg.
anton-vlasenko Dec 20, 2022
10e5d0f
Add job's description.
anton-vlasenko Dec 20, 2022
31d5f22
Add a comment to explain why we need the /.cache folder.
anton-vlasenko Dec 20, 2022
5c92300
Add a comment to explain why we need complicated .gitignore rules.
anton-vlasenko Dec 20, 2022
c16e8e5
Fix grammar.
anton-vlasenko Dec 20, 2022
9ac9073
Revert accidental changes.
anton-vlasenko Dec 20, 2022
1b0d068
Revert accidental changes.
anton-vlasenko Dec 20, 2022
bb0f4b7
Allow manually triggering the workflows.
anton-vlasenko Dec 22, 2022
3c90728
Remove description.
anton-vlasenko Dec 22, 2022
220bf63
Let's not limit the job by path.
anton-vlasenko Dec 22, 2022
6f158a7
PHP 7.3 and 7.4 should use PHPUnit 9.
anton-vlasenko Dec 22, 2022
76a5d0e
Update the changelog.
anton-vlasenko Jan 12, 2023
c1bf302
1. Fix yaml synthax.
anton-vlasenko Dec 22, 2022
9c91766
In most repos, the convention is to have the if: above the run:.
anton-vlasenko Dec 22, 2022
571f5ee
Don't log the PHP version; this information is available in the "Set …
anton-vlasenko Dec 22, 2022
a4c17e4
Don't log the Composer version; this information is available in the …
anton-vlasenko Dec 22, 2022
8b7348b
1. Don't scan the unit tests twice.
anton-vlasenko Dec 22, 2022
c46a898
Fix the cs2pr report location.
anton-vlasenko Dec 22, 2022
2be51c6
Update the .gitignore rule description.
anton-vlasenko Dec 22, 2022
ac99768
Enable fast failing to save Github resources as proposed here: https:…
anton-vlasenko Jan 4, 2023
22bffeb
As the separate PHPCS run for the tests has been removed, this step s…
anton-vlasenko Jan 12, 2023
7cfdaae
Use the development php.ini file (to make any errors more obvious).
anton-vlasenko Jan 12, 2023
8546c9c
Use the development php.ini file (to make any errors more obvious).
anton-vlasenko Jan 12, 2023
9d0a477
Revert "Use the development php.ini file (to make any errors more obv…
anton-vlasenko Jan 12, 2023
2a371d8
Move the unit tests to unit-test.yml.
anton-vlasenko Jan 12, 2023
8eb3280
Change the description.
anton-vlasenko Jan 16, 2023
017ce16
Rename the job.
anton-vlasenko Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Composer dependencies should be installed after wp-env is intialised.
  • Loading branch information
anton-vlasenko committed Jan 12, 2023
commit 4319bac88bc7f31cc3dc6018cf017482738471c8
7 changes: 4 additions & 3 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ jobs:
composer --version
locale -a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is all this necessary or mostly useful while developing this branch? Same question for the Docker debug info step below.

Copy link
Contributor Author

@anton-vlasenko anton-vlasenko Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary, but it's worthwhile.
E.g., it helps to confirm which version of Composer and/or PHP are used when installing Composer packages and running PHPUnit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking because we don't currently do this for our other workflows, and it's a fair amount of noise, and some duplication (e.g. PHP and composer versions are already available through the matrix and through the PHP install step).

It's not problematic, per se, just curious why it's here as it seems like a step (to remove this debug logging) that might have been overlooked before prepping for final merge into trunk.

Copy link
Contributor Author

@anton-vlasenko anton-vlasenko Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we don't currently do this for our other workflows

We actually do this.

PHP and composer versions are already available through the matrix and through the PHP install step

Yes, they are through the matrix, but we cannot be sure that the CI jobs use these specific versions (until we log them).
Also, in the matrix, we only specify major and minor PHP versions (the same way it's implemented in Core).
The logging allows us to know the exact PHP version (including the point release) used when running particular CI jobs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to know the exact PHP version (including the point release) used when running particular CI jobs.

That information is already available via the setup-php step.

Jonathan and me actually discussed removing a lot of this kind of debug noise from the WP Core workflows recently as the information is already available within the workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That information is already available via the setup-php step.

I've removed logging Composer and PHP versions.
cb3ee089ee66b68af28305833e5868f7d517454d
2dfb8452e972553650ac309e497cb0fee252be15


- name: Install Composer dependencies
run: npm run wp-env run composer "install --no-interaction"

- name: Start Docker environment
run: |
npm run wp-env start

- name: Install Composer dependencies
run: npm run wp-env run composer "install --no-interaction"

- name: Log running Docker containers
run: docker ps -a

Expand All @@ -89,6 +89,7 @@ jobs:
npm run wp-env run phpunit "php --version"
npm run wp-env run phpunit "php -m"
npm run wp-env run phpunit "php -i"
npm run wp-env run composer "install --no-interaction"
npm run wp-env run phpunit "/usr/local/bin/phpunit --version"
npm run wp-env run phpunit "locale -a"

Expand Down