diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml index 20a40a6..47e5cc2 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker-hub.yml @@ -73,69 +73,6 @@ jobs: docker images docker push $PACKAGE_REGISTRY/php:latest$PR_TAG - build-phpunit-images: - name: PHPUnit on PHP ${{ matrix.php }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] - - env: - PHP_VERSION: ${{ matrix.php }} - PHP_LATEST: '8.2' - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG - - - name: Tag and push image as latest - if: ${{ env.PHP_LATEST == env.PHP_VERSION }} - run: | - docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - - build-specific-phpunit-images: - name: PHPUnit ${{ matrix.phpunit }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - 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' ] - - env: - PHPUNIT_VERSION: ${{ matrix.phpunit }} - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG - build-cli-images: name: CLI on PHP ${{ matrix.php }} runs-on: ubuntu-latest diff --git a/.github/workflows/github-container-registry.yml b/.github/workflows/github-container-registry.yml index 335264b..7f5c6f6 100644 --- a/.github/workflows/github-container-registry.yml +++ b/.github/workflows/github-container-registry.yml @@ -82,69 +82,6 @@ jobs: docker images docker push $PACKAGE_REGISTRY/php:latest$PR_TAG - build-phpunit-images: - name: PHPUnit on PHP ${{ matrix.php }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] - - env: - PHP_VERSION: ${{ matrix.php }} - PHP_LATEST: '8.2' - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG - - - name: Tag and push image as latest - if: ${{ env.PHP_LATEST == env.PHP_VERSION }} - run: | - docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - - build-specific-phpunit-images: - name: PHPUnit ${{ matrix.phpunit }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - 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' ] - - env: - PHPUNIT_VERSION: ${{ matrix.phpunit }} - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG - build-cli-images: name: CLI on PHP ${{ matrix.php }} runs-on: ubuntu-latest diff --git a/templates/workflow.yml-template b/templates/workflow.yml-template index f67ddb1..f0592e1 100644 --- a/templates/workflow.yml-template +++ b/templates/workflow.yml-template @@ -100,69 +100,6 @@ jobs: docker images docker push $PACKAGE_REGISTRY/php:latest$PR_TAG - build-phpunit-images: - name: PHPUnit on PHP ${{ matrix.php }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - php: [ %%PHP_VERSION_LIST%% ] - - env: - PHP_VERSION: ${{ matrix.php }} - PHP_LATEST: '%%PHP_LATEST%%' - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG - - - name: Tag and push image as latest - if: ${{ env.PHP_LATEST == env.PHP_VERSION }} - run: | - docker image tag $PACKAGE_REGISTRY/phpunit:$PHP_VERSION-fpm$PR_TAG $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - - build-specific-phpunit-images: - name: PHPUnit ${{ matrix.phpunit }} - runs-on: ubuntu-latest - needs: build-php-images - strategy: - matrix: - phpunit: [ %%PHPUNIT_COMBINATIONS%% ] - - env: - PHPUNIT_VERSION: ${{ matrix.phpunit }} - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Login to the package registry - run: | - echo "$REGISTRY_PASSWORD" | docker login $PACKAGE_REGISTRY_HOST -u "$REGISTRY_USERNAME" --password-stdin - - - name: Build Docker image - 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 - - - name: Log Docker images - run: docker images - - - name: Push Docker image - run: docker push $PACKAGE_REGISTRY/phpunit:$PHPUNIT_VERSION-fpm$PR_TAG - build-cli-images: name: CLI on PHP ${{ matrix.php }} runs-on: ubuntu-latest diff --git a/update.php b/update.php index c3515f6..d6c2a97 100644 --- a/update.php +++ b/update.php @@ -282,9 +282,12 @@ * Different WordPress versions support different versions of PHP and different versions of PHPUnit. * This creates a need to run multiple versions of PHPUnit on each version of PHP. * - * @param array $phpunit_version A list of PHP versions for each PHPUnit version. + * These versions of PHPUnit are no longer supported and do not receive updates. + * Regenerating these containers should very rarely be required. + * + * @param array $legacy_phpunit_versions A list of PHP versions for each PHPUnit version. */ -$phpunit_versions = array( +$legacy_phpunit_versions = array( '9' => array( '8.3', '8.2', @@ -342,8 +345,6 @@ 'cli' => file_get_contents( 'templates/Dockerfile-cli.template' ), ); -$phpunit_combinations = array(); - // Loop through each PHP version, and generate the Dockerfiles. foreach ( array_merge( $legacy_php_versions, $php_versions ) as $version => $images ) { $title = "| PHP $version |"; @@ -500,50 +501,6 @@ echo "✅\n"; } - foreach ( $phpunit_versions as $phpunit_version => $supported_php_versions ) { - if ( in_array( $version, $supported_php_versions, true ) ) { - echo str_pad( "phpunit $phpunit_version", 15, '.' ); - - $php_version = $version; - - if ( ! isset( $legacy_php_versions[ $php_version ] ) ) { - $phpunit_combinations[] = "{$phpunit_version}-php-{$php_version}"; - } - echo shell_exec( "mkdir -p images/phpunit/{$phpunit_version}-php-{$php_version}" ); - - $dockerfile = $templates['phpunit']; - - // Ensure PHPUnit can be successfully downloaded in older containers. - if ( '7.1' > $version ) { - $dockerfile = str_replace( 'RUN curl -sL', 'RUN curl -sLk', $dockerfile ); - } - - $dockerfile = str_replace( '%%GENERATED_WARNING%%', $generated_warning, $dockerfile ); - - if ( 'latest' === $php_version ) { - $version_tag = 'latest'; - } else { - $version_tag = "$php_version-fpm"; - } - $dockerfile = str_replace( '%%VERSION_TAG%%', $version_tag, $dockerfile ); - - $dockerfile = str_replace( '%%PHPUNIT_VERSION%%', $phpunit_version, $dockerfile ); - - // Cleanup any leftover tags. - $dockerfile = preg_replace( '/%%[^%]+%%/', '', $dockerfile ); - - // Write the real Dockerfile. - write_file( "images/phpunit/{$phpunit_version}-php-{$php_version}/Dockerfile", $dockerfile ); - - // Copy the entrypoint script, if it exists. - if ( file_exists( "entrypoint/entrypoint-phpunit.sh" ) ) { - copy( "entrypoint/entrypoint-phpunit.sh", "images/phpunit/{$phpunit_version}-php-{$php_version}/entrypoint.sh" ); - } - - echo "✅\n"; - } - } - $workflow_templates = array( 'docker-hub.yml' => 'GITHUB', 'github-container-registry.yml' => 'DOCKER_HUB', @@ -556,9 +513,6 @@ $php_version_list = "'" . implode( "', '", array_keys( $php_versions ) ) . "'"; $workflow_template = str_replace( '%%PHP_VERSION_LIST%%', $php_version_list, $workflow_template ); - $phpunit_version_list = "'" . implode( "', '", array_values( $phpunit_combinations ) ) . "'"; - $workflow_template = str_replace( '%%PHPUNIT_COMBINATIONS%%', $phpunit_version_list, $workflow_template ); - $workflow_template = str_replace( '%%PHP_LATEST%%', $latest, $workflow_template ); foreach ( $workflow_templates as $name => $remove_pattern ) {