Skip to content

Commit f928058

Browse files
committed
Archive the PHPUnit related containers.
The need for the `phpunit` containers was removed in WordPress 5.9 and only exist for running tests in old branches. The highest version of PHP that these versions of WordPress support is PHP 8.0 required a modified version of PHPUnit 7 (see [Core-50902](https://core.trac.wordpress.org/ticket/50902)). PHPUnit 7.x is no longer supported upstream, so there will be no new releases. With all this in mind, this removes the PHPUnit related containers from the workflow files to avoid needlessly building and publishing them. The images are being left in tact within the `images` directory in case they need to be regenerated at some point in the future.
1 parent e23d5b0 commit f928058

File tree

4 files changed

+5
-240
lines changed

4 files changed

+5
-240
lines changed

.github/workflows/docker-hub.yml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -73,69 +73,6 @@ jobs:
7373
docker images
7474
docker push $PACKAGE_REGISTRY/php:latest$PR_TAG
7575
76-
build-phpunit-images:
77-
name: PHPUnit on PHP ${{ matrix.php }}
78-
runs-on: ubuntu-latest
79-
needs: build-php-images
80-
strategy:
81-
matrix:
82-
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
83-
84-
env:
85-
PHP_VERSION: ${{ matrix.php }}
86-
PHP_LATEST: '8.2'
87-
88-
steps:
89-
- name: Checkout repository
90-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
91-
92-
- name: Login to the package registry
93-
run: |
94-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
95-
96-
- name: Build Docker image
97-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/phpunit
98-
99-
- name: Log Docker images
100-
run: docker images
101-
102-
- name: Push Docker image
103-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG
104-
105-
- name: Tag and push image as latest
106-
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
107-
run: |
108-
docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
109-
docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
110-
111-
build-specific-phpunit-images:
112-
name: PHPUnit ${{ matrix.phpunit }}
113-
runs-on: ubuntu-latest
114-
needs: build-php-images
115-
strategy:
116-
matrix:
117-
phpunit: [ '8-php-7.2', '7-php-7.2', '6-php-7.2', '9-php-7.3', '8-php-7.3', '7-php-7.3', '6-php-7.3', '9-php-7.4', '8-php-7.4', '7-php-7.4', '9-php-8.0', '8-php-8.0', '9-php-8.1', '8-php-8.1', '9-php-8.2', '8-php-8.2', '9-php-8.3' ]
118-
119-
env:
120-
PHPUNIT_VERSION: ${{ matrix.phpunit }}
121-
122-
steps:
123-
- name: Checkout repository
124-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
125-
126-
- name: Login to the package registry
127-
run: |
128-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
129-
130-
- name: Build Docker image
131-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG images/phpunit/$PHPUNIT_VERSION
132-
133-
- name: Log Docker images
134-
run: docker images
135-
136-
- name: Push Docker image
137-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG
138-
13976
build-cli-images:
14077
name: CLI on PHP ${{ matrix.php }}
14178
runs-on: ubuntu-latest

.github/workflows/github-container-registry.yml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -82,69 +82,6 @@ jobs:
8282
docker images
8383
docker push $PACKAGE_REGISTRY/php:latest$PR_TAG
8484
85-
build-phpunit-images:
86-
name: PHPUnit on PHP ${{ matrix.php }}
87-
runs-on: ubuntu-latest
88-
needs: build-php-images
89-
strategy:
90-
matrix:
91-
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
92-
93-
env:
94-
PHP_VERSION: ${{ matrix.php }}
95-
PHP_LATEST: '8.2'
96-
97-
steps:
98-
- name: Checkout repository
99-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
100-
101-
- name: Login to the package registry
102-
run: |
103-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
104-
105-
- name: Build Docker image
106-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/phpunit
107-
108-
- name: Log Docker images
109-
run: docker images
110-
111-
- name: Push Docker image
112-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG
113-
114-
- name: Tag and push image as latest
115-
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
116-
run: |
117-
docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
118-
docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
119-
120-
build-specific-phpunit-images:
121-
name: PHPUnit ${{ matrix.phpunit }}
122-
runs-on: ubuntu-latest
123-
needs: build-php-images
124-
strategy:
125-
matrix:
126-
phpunit: [ '8-php-7.2', '7-php-7.2', '6-php-7.2', '9-php-7.3', '8-php-7.3', '7-php-7.3', '6-php-7.3', '9-php-7.4', '8-php-7.4', '7-php-7.4', '9-php-8.0', '8-php-8.0', '9-php-8.1', '8-php-8.1', '9-php-8.2', '8-php-8.2', '9-php-8.3' ]
127-
128-
env:
129-
PHPUNIT_VERSION: ${{ matrix.phpunit }}
130-
131-
steps:
132-
- name: Checkout repository
133-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
134-
135-
- name: Login to the package registry
136-
run: |
137-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
138-
139-
- name: Build Docker image
140-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG images/phpunit/$PHPUNIT_VERSION
141-
142-
- name: Log Docker images
143-
run: docker images
144-
145-
- name: Push Docker image
146-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG
147-
14885
build-cli-images:
14986
name: CLI on PHP ${{ matrix.php }}
15087
runs-on: ubuntu-latest

templates/workflow.yml-template

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -100,69 +100,6 @@ jobs:
100100
docker images
101101
docker push $PACKAGE_REGISTRY/php:latest$PR_TAG
102102

103-
build-phpunit-images:
104-
name: PHPUnit on PHP ${{ matrix.php }}
105-
runs-on: ubuntu-latest
106-
needs: build-php-images
107-
strategy:
108-
matrix:
109-
php: [ %%PHP_VERSION_LIST%% ]
110-
111-
env:
112-
PHP_VERSION: ${{ matrix.php }}
113-
PHP_LATEST: '%%PHP_LATEST%%'
114-
115-
steps:
116-
- name: Checkout repository
117-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
118-
119-
- name: Login to the package registry
120-
run: |
121-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
122-
123-
- name: Build Docker image
124-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG images/$PHP_VERSION/phpunit
125-
126-
- name: Log Docker images
127-
run: docker images
128-
129-
- name: Push Docker image
130-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG
131-
132-
- name: Tag and push image as latest
133-
if: ${{ env.PHP_LATEST == env.PHP_VERSION }}
134-
run: |
135-
docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
136-
docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG
137-
138-
build-specific-phpunit-images:
139-
name: PHPUnit ${{ matrix.phpunit }}
140-
runs-on: ubuntu-latest
141-
needs: build-php-images
142-
strategy:
143-
matrix:
144-
phpunit: [ %%PHPUNIT_COMBINATIONS%% ]
145-
146-
env:
147-
PHPUNIT_VERSION: ${{ matrix.phpunit }}
148-
149-
steps:
150-
- name: Checkout repository
151-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
152-
153-
- name: Login to the package registry
154-
run: |
155-
echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin
156-
157-
- name: Build Docker image
158-
run: docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG images/phpunit/$PHPUNIT_VERSION
159-
160-
- name: Log Docker images
161-
run: docker images
162-
163-
- name: Push Docker image
164-
run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG
165-
166103
build-cli-images:
167104
name: CLI on PHP ${{ matrix.php }}
168105
runs-on: ubuntu-latest

update.php

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,12 @@
282282
* Different WordPress versions support different versions of PHP and different versions of PHPUnit.
283283
* This creates a need to run multiple versions of PHPUnit on each version of PHP.
284284
*
285-
* @param array $phpunit_version A list of PHP versions for each PHPUnit version.
285+
* These versions of PHPUnit are no longer supported and do not receive updates.
286+
* Regenerating these containers should very rarely be required.
287+
*
288+
* @param array $legacy_phpunit_versions A list of PHP versions for each PHPUnit version.
286289
*/
287-
$phpunit_versions = array(
290+
$legacy_phpunit_versions = array(
288291
'9' => array(
289292
'8.3',
290293
'8.2',
@@ -342,8 +345,6 @@
342345
'cli' => file_get_contents( 'templates/Dockerfile-cli.template' ),
343346
);
344347

345-
$phpunit_combinations = array();
346-
347348
// Loop through each PHP version, and generate the Dockerfiles.
348349
foreach ( array_merge( $legacy_php_versions, $php_versions ) as $version => $images ) {
349350
$title = "| PHP $version |";
@@ -500,50 +501,6 @@
500501
echo "\n";
501502
}
502503

503-
foreach ( $phpunit_versions as $phpunit_version => $supported_php_versions ) {
504-
if ( in_array( $version, $supported_php_versions, true ) ) {
505-
echo str_pad( "phpunit $phpunit_version", 15, '.' );
506-
507-
$php_version = $version;
508-
509-
if ( ! isset( $legacy_php_versions[ $php_version ] ) ) {
510-
$phpunit_combinations[] = "{$phpunit_version}-php-{$php_version}";
511-
}
512-
echo shell_exec( "mkdir -p images/phpunit/{$phpunit_version}-php-{$php_version}" );
513-
514-
$dockerfile = $templates['phpunit'];
515-
516-
// Ensure PHPUnit can be successfully downloaded in older containers.
517-
if ( '7.1' > $version ) {
518-
$dockerfile = str_replace( 'RUN curl -sL', 'RUN curl -sLk', $dockerfile );
519-
}
520-
521-
$dockerfile = str_replace( '%%GENERATED_WARNING%%', $generated_warning, $dockerfile );
522-
523-
if ( 'latest' === $php_version ) {
524-
$version_tag = 'latest';
525-
} else {
526-
$version_tag = "$php_version-fpm";
527-
}
528-
$dockerfile = str_replace( '%%VERSION_TAG%%', $version_tag, $dockerfile );
529-
530-
$dockerfile = str_replace( '%%PHPUNIT_VERSION%%', $phpunit_version, $dockerfile );
531-
532-
// Cleanup any leftover tags.
533-
$dockerfile = preg_replace( '/%%[^%]+%%/', '', $dockerfile );
534-
535-
// Write the real Dockerfile.
536-
write_file( "images/phpunit/{$phpunit_version}-php-{$php_version}/Dockerfile", $dockerfile );
537-
538-
// Copy the entrypoint script, if it exists.
539-
if ( file_exists( "entrypoint/entrypoint-phpunit.sh" ) ) {
540-
copy( "entrypoint/entrypoint-phpunit.sh", "images/phpunit/{$phpunit_version}-php-{$php_version}/entrypoint.sh" );
541-
}
542-
543-
echo "\n";
544-
}
545-
}
546-
547504
$workflow_templates = array(
548505
'docker-hub.yml' => 'GITHUB',
549506
'github-container-registry.yml' => 'DOCKER_HUB',
@@ -556,9 +513,6 @@
556513
$php_version_list = "'" . implode( "', '", array_keys( $php_versions ) ) . "'";
557514
$workflow_template = str_replace( '%%PHP_VERSION_LIST%%', $php_version_list, $workflow_template );
558515

559-
$phpunit_version_list = "'" . implode( "', '", array_values( $phpunit_combinations ) ) . "'";
560-
$workflow_template = str_replace( '%%PHPUNIT_COMBINATIONS%%', $phpunit_version_list, $workflow_template );
561-
562516
$workflow_template = str_replace( '%%PHP_LATEST%%', $latest, $workflow_template );
563517

564518
foreach ( $workflow_templates as $name => $remove_pattern ) {

0 commit comments

Comments
 (0)