From 11de159efd9c0806c613eed47bd6fdaa05a5401b Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 24 Oct 2024 10:50:33 +0100 Subject: [PATCH 01/11] Fix TypeError in on SMTP error --- .../Component/Mailer/Transport/Smtp/Stream/AbstractStream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php index 2be8fce94c93a..d471cf98199ba 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php @@ -85,7 +85,7 @@ public function readLine(): string throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription())); } if (false === $line) { - throw new TransportException(sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).error_get_last()['message']); + throw new TransportException(sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).(error_get_last()['message'] ?? '')); } } From 08c9f21fea849bec81470a2aee8907fe1367d3a7 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Sat, 26 Oct 2024 20:50:08 +0100 Subject: [PATCH 02/11] wip --- .../Transport/Smtp/EsmtpTransportTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php index 6e69e19a2a277..89d3b9990ebc0 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php @@ -12,7 +12,9 @@ namespace Symfony\Component\Mailer\Tests\Transport\Smtp; use PHPUnit\Framework\TestCase; +use Symfony\Component\Mailer\Exception\TransportException; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; +use Symfony\Component\Mime\Email; class EsmtpTransportTest extends TestCase { @@ -40,4 +42,27 @@ public function testToString() $t = new EsmtpTransport('example.com', 466, true); $this->assertEquals('smtps://example.com:466', (string) $t); } + + public function testTypeErrorInMailer() + { + $transport = new EsmtpTransport( + 'smtp.mailtrap.io', + 587, + null + ); + $transport->setUsername('foo'); + $transport->setPassword('bar'); + + $message = new Email(); + $message->from('sender@example.org'); + $message->addTo('recipient@example.org'); + $message->text('.'); + + try { + $transport->send($message); + $this->fail('Symfony\Component\Mailer\Exception\TransportException to be thrown'); + } catch (TransportException $e) { + $this->assertStringStartsWith('Failed to authenticate on SMTP server with username "foo" using the following authenticators: "CRAM-MD5", "LOGIN", "PLAIN".', $e->getMessage()); + } + } } From 350cfd516af9e0c0d3d883e6eddc2a7ae1256862 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Sat, 26 Oct 2024 20:54:23 +0100 Subject: [PATCH 03/11] Revert "wip" This reverts commit 08c9f21fea849bec81470a2aee8907fe1367d3a7. --- .../Transport/Smtp/EsmtpTransportTest.php | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php index 89d3b9990ebc0..6e69e19a2a277 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php @@ -12,9 +12,7 @@ namespace Symfony\Component\Mailer\Tests\Transport\Smtp; use PHPUnit\Framework\TestCase; -use Symfony\Component\Mailer\Exception\TransportException; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; -use Symfony\Component\Mime\Email; class EsmtpTransportTest extends TestCase { @@ -42,27 +40,4 @@ public function testToString() $t = new EsmtpTransport('example.com', 466, true); $this->assertEquals('smtps://example.com:466', (string) $t); } - - public function testTypeErrorInMailer() - { - $transport = new EsmtpTransport( - 'smtp.mailtrap.io', - 587, - null - ); - $transport->setUsername('foo'); - $transport->setPassword('bar'); - - $message = new Email(); - $message->from('sender@example.org'); - $message->addTo('recipient@example.org'); - $message->text('.'); - - try { - $transport->send($message); - $this->fail('Symfony\Component\Mailer\Exception\TransportException to be thrown'); - } catch (TransportException $e) { - $this->assertStringStartsWith('Failed to authenticate on SMTP server with username "foo" using the following authenticators: "CRAM-MD5", "LOGIN", "PLAIN".', $e->getMessage()); - } - } } From dacf6d8bcc69d5bc3181c9a3f4e7dd4a207623fc Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Sat, 26 Oct 2024 20:50:08 +0100 Subject: [PATCH 04/11] wip --- .github/workflows/unit-tests.yml | 226 +++++++++++++++++- .../Transport/Smtp/EsmtpTransportTest.php | 25 ++ 2 files changed, 248 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 969835cccdde1..37de9e46a74a2 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -17,7 +17,9 @@ permissions: jobs: - tests: + linux-tests: + runs-on: ubuntu-20.04 + name: Unit Tests env: @@ -38,8 +40,6 @@ jobs: #mode: experimental fail-fast: false - runs-on: ubuntu-20.04 - steps: - name: Checkout uses: actions/checkout@v4 @@ -235,3 +235,223 @@ jobs: cd .. ./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process + + windows_tests: + + runs-on: windows-2022 + + name: PHP ${{ matrix.php }} - Windows + + env: + extensions: amqp,apcu,igbinary,intl,mbstring,memcached,redis-5.3.4 + + strategy: + matrix: + include: + - php: '7.2' + - php: '7.4' + - php: '8.2' + mode: high-deps + - php: '8.2' + mode: low-deps + - php: '8.3' + - php: '8.4' + extensions: amqp,apcu,igbinary,intl,mbstring,memcached,redis + #mode: experimental + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: "none" + ini-values: date.timezone=UTC,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 + php-version: "${{ matrix.php }}" + extensions: "${{ matrix.extensions || env.extensions }}" + tools: flex + + - name: Configure environment + run: | + git config --global user.email "" + git config --global user.name "Symfony" + git config --global init.defaultBranch main + git config --global advice.detachedHead false + + COMPOSER_HOME="$(composer config home)" + ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" + + echo COLUMNS=120 >> $GITHUB_ENV + echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration" >> $GITHUB_ENV + echo COMPOSER_UP='composer update --no-progress --ansi'$([[ "${{ matrix.mode }}" != low-deps ]] && echo ' --ignore-platform-req=php+') >> $GITHUB_ENV + echo SYMFONY_DEPRECATIONS_HELPER="baselineFile=$(pwd)/.github/deprecations-baseline.json" >> $GITHUB_ENV + + SYMFONY_VERSIONS=$(git ls-remote -q --heads | cut -f2 | grep -o '/[1-9][0-9]*\.[0-9].*' | sort -V) + SYMFONY_VERSION=$(grep ' VERSION = ' src/Symfony/Component/HttpKernel/Kernel.php | cut -d "'" -f2 | cut -d '.' -f 1-2) + SYMFONY_FEATURE_BRANCH=$(curl -s https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json | jq -r '.versions."dev-name"') + + # Install the phpunit-bridge from a PR if required + # + # To run a PR with a patched phpunit-bridge, first submit the patch for the + # phpunit-bridge as a separate PR against the next feature-branch then + # uncomment and update the following line with that PR number + #SYMFONY_PHPUNIT_BRIDGE_PR=32886 + + if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then + git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head + git rm -rq src/Symfony/Bridge/PhpUnit + git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit + SYMFONY_PHPUNIT_BRIDGE_REF=$(curl -s https://api.github.com/repos/symfony/symfony/pulls/$SYMFONY_PHPUNIT_BRIDGE_PR | jq -r .base.ref) + sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_PHPUNIT_BRIDGE_REF'.x@dev"/' composer.json + rm -rf .phpunit + fi + + # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components + if [[ ! "${{ matrix.mode }}" = *-deps ]]; then + php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit + else + echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV + cp composer.json composer.json.orig + echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json + php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n') + mv composer.json composer.json.phpunit + mv composer.json.orig composer.json + fi + if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then + git rm -fq -- src/Symfony/Bridge/PhpUnit/composer.json + git diff --staged -- src/Symfony/Bridge/PhpUnit/ | git apply -R --index + fi + + # For the highest branch, in high-deps mode, the version before it is checked out and tested with the locally patched components + if [[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = $(echo "$SYMFONY_VERSIONS" | tail -n 1 | sed s/.//) ]]; then + echo FLIP='^' >> $GITHUB_ENV + SYMFONY_VERSION=$(echo "$SYMFONY_VERSIONS" | grep -FB1 /$SYMFONY_VERSION | head -n 1 | sed s/.//) + git fetch --depth=2 origin $SYMFONY_VERSION + git checkout -m FETCH_HEAD + echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h ') >> $GITHUB_ENV + fi + + # Skip the phpunit-bridge on bugfix-branches when not in *-deps mode + if [[ ! "${{ matrix.mode }}" = *-deps && $SYMFONY_VERSION != $SYMFONY_FEATURE_BRANCH ]]; then + echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' | xargs -I{} dirname {}) >> $GITHUB_ENV + else + echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist | xargs -I{} dirname {}) >> $GITHUB_ENV + fi + + # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one + [[ "${{ matrix.mode }}" = high-deps && $SYMFONY_VERSION = *.4 ]] && echo LEGACY=,legacy >> $GITHUB_ENV || true + + echo SYMFONY_VERSION=$SYMFONY_VERSION >> $GITHUB_ENV + echo COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev >> $GITHUB_ENV + echo SYMFONY_REQUIRE=">=$([ '${{ matrix.mode }}' = low-deps ] && echo 4.4 || echo $SYMFONY_VERSION)" >> $GITHUB_ENV + [[ "${{ matrix.mode }}" = *-deps ]] && mv composer.json.phpunit composer.json || true + + - name: Install dependencies + run: | + echo "::group::composer update" + $COMPOSER_UP + echo "::endgroup::" + + echo "::group::install phpunit" + ./phpunit install + echo "::endgroup::" + + - name: Patch return types + if: "matrix.php == '8.1' && ! matrix.mode" + run: | + sed -i 's/"\*\*\/Tests\/"//' composer.json + git add . + composer install -q --optimize-autoloader + SYMFONY_PATCH_TYPE_DECLARATIONS='force=1&php=7.2' php .github/patch-types.php + SYMFONY_PATCH_TYPE_DECLARATIONS='force=1&php=7.2' php .github/patch-types.php # ensure the script is idempotent + git diff --exit-code + echo PHPUNIT="$PHPUNIT,legacy" >> $GITHUB_ENV + + - name: Run tests + run: | + _run_tests() { + local ok=0 + local title="$1$FLIP" + local start=$(date -u +%s) + OUTPUT=$(bash -xc "$2" 2>&1) || ok=$? + local end=$(date -u +%s) + + if [[ $ok -ne 0 ]]; then + printf "\n%-70s%10s\n" $title $(($end-$start))s + echo "$OUTPUT" + echo "Job exited with: $ok" + echo -e "\n::error::KO $title\\n" + else + printf "::group::%-68s%10s\n" $title $(($end-$start))s + echo "$OUTPUT" + echo -e "\n\\e[32mOK\\e[0m $title\\n\\n::endgroup::" + fi + + [[ "${{ matrix.mode }}" = experimental ]] || (exit $ok) + } + export -f _run_tests + + if [[ ! "${{ matrix.mode }}" = *-deps ]]; then + echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} '$PHPUNIT {}'" + + exit 0 + fi + + if [[ "${{ matrix.mode }}" = low-deps ]]; then + echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" + + exit 0 + fi + + (cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) + (cd src/Symfony/Component/Lock; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) + + # matrix.mode = high-deps + echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + + # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) + (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json) + (cd src/Symfony/Component/Lock; mv composer.bak composer.json) + PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true) + + # for 5.4 LTS, checkout and test previous major with the patched components (only for patched components) + if [[ $PATCHED_COMPONENTS && $SYMFONY_VERSION = 5.4 ]]; then + export FLIP='^' + SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}') + echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m" + export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev + export SYMFONY_REQUIRE=">=$SYMFONY_VERSION" + git fetch --depth=2 origin $SYMFONY_VERSION + git checkout -m FETCH_HEAD + PATCHED_COMPONENTS=$(echo "$PATCHED_COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort || true) + (cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb) + (cd src/Symfony/Component/Lock; composer require --dev --no-update mongodb/mongodb) + if [[ $PATCHED_COMPONENTS ]]; then + echo "::group::install phpunit" + ./phpunit install + echo "::endgroup::" + echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + fi + fi + + [[ ! $X ]] || (exit 1) + + - name: Run TTY tests + if: "! matrix.mode" + run: | + script -e -c './phpunit --group tty' /dev/null + + - name: Run tests with SIGCHLD enabled PHP + if: "matrix.php == '7.2' && ! matrix.mode" + run: | + mkdir build + cd build + wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.2.5-pcntl-sigchild.tar.bz2 + tar -xjf php-7.2.5-pcntl-sigchild.tar.bz2 + cd .. + + ./build/php/bin/php ./phpunit --colors=always src/Symfony/Component/Process diff --git a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php index 6e69e19a2a277..89d3b9990ebc0 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/Smtp/EsmtpTransportTest.php @@ -12,7 +12,9 @@ namespace Symfony\Component\Mailer\Tests\Transport\Smtp; use PHPUnit\Framework\TestCase; +use Symfony\Component\Mailer\Exception\TransportException; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; +use Symfony\Component\Mime\Email; class EsmtpTransportTest extends TestCase { @@ -40,4 +42,27 @@ public function testToString() $t = new EsmtpTransport('example.com', 466, true); $this->assertEquals('smtps://example.com:466', (string) $t); } + + public function testTypeErrorInMailer() + { + $transport = new EsmtpTransport( + 'smtp.mailtrap.io', + 587, + null + ); + $transport->setUsername('foo'); + $transport->setPassword('bar'); + + $message = new Email(); + $message->from('sender@example.org'); + $message->addTo('recipient@example.org'); + $message->text('.'); + + try { + $transport->send($message); + $this->fail('Symfony\Component\Mailer\Exception\TransportException to be thrown'); + } catch (TransportException $e) { + $this->assertStringStartsWith('Failed to authenticate on SMTP server with username "foo" using the following authenticators: "CRAM-MD5", "LOGIN", "PLAIN".', $e->getMessage()); + } + } } From 6043bb42f9c444615f2d9101677a7ac24561d7b2 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 09:42:26 +0000 Subject: [PATCH 05/11] add xsl --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 37de9e46a74a2..490d3b8c8a156 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -243,7 +243,7 @@ jobs: name: PHP ${{ matrix.php }} - Windows env: - extensions: amqp,apcu,igbinary,intl,mbstring,memcached,redis-5.3.4 + extensions: xsl,apcu,igbinary,intl,mbstring,memcached,redis-5.3.4 strategy: matrix: From ad453db5bba6cff31453855d54699557bb5ce342 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 09:55:04 +0000 Subject: [PATCH 06/11] remove parallel --- .github/workflows/unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 490d3b8c8a156..b33d9aaf1cec9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -396,13 +396,13 @@ jobs: export -f _run_tests if [[ ! "${{ matrix.mode }}" = *-deps ]]; then - echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} '$PHPUNIT {}'" + echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} '$PHPUNIT {}'" exit 0 fi if [[ "${{ matrix.mode }}" = low-deps ]]; then - echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" + echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" exit 0 fi @@ -411,7 +411,7 @@ jobs: (cd src/Symfony/Component/Lock; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) # matrix.mode = high-deps - echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json) @@ -434,7 +434,7 @@ jobs: echo "::group::install phpunit" ./phpunit install echo "::endgroup::" - echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + echo "$PATCHED_COMPONENTS" | bash -c "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 fi fi From 1d7648eb19714459eec335691cdd04cebbc3d069 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 09:56:25 +0000 Subject: [PATCH 07/11] update extensions --- .github/workflows/unit-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index b33d9aaf1cec9..6635f97c1fb58 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -243,7 +243,7 @@ jobs: name: PHP ${{ matrix.php }} - Windows env: - extensions: xsl,apcu,igbinary,intl,mbstring,memcached,redis-5.3.4 + extensions: mongodb,xsl,apcu,igbinary,intl,mbstring,memcached,redis-5.3.4 strategy: matrix: @@ -256,7 +256,7 @@ jobs: mode: low-deps - php: '8.3' - php: '8.4' - extensions: amqp,apcu,igbinary,intl,mbstring,memcached,redis + extensions: mongodb,xsl,amqp,apcu,igbinary,intl,mbstring,memcached,redis #mode: experimental fail-fast: false From 803d4d3747253cf2071d9328d114665425655fa5 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 10:16:51 +0000 Subject: [PATCH 08/11] wip --- .github/workflows/unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 6635f97c1fb58..5c6a149f44926 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -396,13 +396,13 @@ jobs: export -f _run_tests if [[ ! "${{ matrix.mode }}" = *-deps ]]; then - echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} '$PHPUNIT {}'" + echo "$COMPONENTS" | xargs -d' ' -I{} bash -c "_run_tests {} '$PHPUNIT {}'" exit 0 fi if [[ "${{ matrix.mode }}" = low-deps ]]; then - echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" + echo "$COMPONENTS" | xargs -d' ' -I{} bash -c "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" exit 0 fi @@ -411,7 +411,7 @@ jobs: (cd src/Symfony/Component/Lock; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) # matrix.mode = high-deps - echo "$COMPONENTS" | xargs -n1 bash -c "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + echo "$COMPONENTS" | xargs -d' ' -I{} "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json) @@ -434,7 +434,7 @@ jobs: echo "::group::install phpunit" ./phpunit install echo "::endgroup::" - echo "$PATCHED_COMPONENTS" | bash -c "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + echo "$PATCHED_COMPONENTS" | xargs -d' ' -I{} "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 fi fi From 88a488a14033d8c255d5a14f6d6377f3d232a283 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 10:23:38 +0000 Subject: [PATCH 09/11] wip --- .github/workflows/unit-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5c6a149f44926..1df2b92db6bc8 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -332,14 +332,14 @@ jobs: SYMFONY_VERSION=$(echo "$SYMFONY_VERSIONS" | grep -FB1 /$SYMFONY_VERSION | head -n 1 | sed s/.//) git fetch --depth=2 origin $SYMFONY_VERSION git checkout -m FETCH_HEAD - echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h ') >> $GITHUB_ENV + echo COMPONENTS="src/Symfony/Component/Mailer" >> $GITHUB_ENV fi # Skip the phpunit-bridge on bugfix-branches when not in *-deps mode if [[ ! "${{ matrix.mode }}" = *-deps && $SYMFONY_VERSION != $SYMFONY_FEATURE_BRANCH ]]; then - echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' | xargs -I{} dirname {}) >> $GITHUB_ENV + echo COMPONENTS="src/Symfony/Component/Mailer" >> $GITHUB_ENV else - echo COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist | xargs -I{} dirname {}) >> $GITHUB_ENV + echo COMPONENTS="src/Symfony/Component/Mailer" >> $GITHUB_ENV fi # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one From 54e674cd51cafd0c80eab445037fdbe5f971fa02 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 10:31:00 +0000 Subject: [PATCH 10/11] wip --- .github/workflows/unit-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1df2b92db6bc8..c426ff02e5f07 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -396,13 +396,13 @@ jobs: export -f _run_tests if [[ ! "${{ matrix.mode }}" = *-deps ]]; then - echo "$COMPONENTS" | xargs -d' ' -I{} bash -c "_run_tests {} '$PHPUNIT {}'" + bash -c "_run_tests src/Symfony/Component/Mailer '$PHPUNIT src/Symfony/Component/Mailer'" exit 0 fi if [[ "${{ matrix.mode }}" = low-deps ]]; then - echo "$COMPONENTS" | xargs -d' ' -I{} bash -c "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" + bash -c "_run_tests src/Symfony/Component/Mailer 'cd src/Symfony/Component/Mailer && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'" exit 0 fi @@ -411,7 +411,7 @@ jobs: (cd src/Symfony/Component/Lock; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb) # matrix.mode = high-deps - echo "$COMPONENTS" | xargs -d' ' -I{} "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + bash -c "_run_tests src/Symfony/Component/Mailer 'cd src/Symfony/Component/Mailer && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json) @@ -434,7 +434,7 @@ jobs: echo "::group::install phpunit" ./phpunit install echo "::endgroup::" - echo "$PATCHED_COMPONENTS" | xargs -d' ' -I{} "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + bash -c "_run_tests src/Symfony/Component/Mailer 'cd src/Symfony/Component/Mailer && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 fi fi From 3598f12a127be6831454a70ae1bbb9c3246c1ecf Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Mon, 28 Oct 2024 10:39:41 +0000 Subject: [PATCH 11/11] add testdox --- .github/workflows/unit-tests.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c426ff02e5f07..14ccd16ef69aa 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -248,16 +248,10 @@ jobs: strategy: matrix: include: - - php: '7.2' - - php: '7.4' - php: '8.2' mode: high-deps - php: '8.2' mode: low-deps - - php: '8.3' - - php: '8.4' - extensions: mongodb,xsl,amqp,apcu,igbinary,intl,mbstring,memcached,redis - #mode: experimental fail-fast: false steps: @@ -286,7 +280,7 @@ jobs: ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" echo COLUMNS=120 >> $GITHUB_ENV - echo PHPUNIT="$(pwd)/phpunit --exclude-group tty,benchmark,intl-data,integration" >> $GITHUB_ENV + echo PHPUNIT="$(pwd)/phpunit --testdox --exclude-group tty,benchmark,intl-data,integration" >> $GITHUB_ENV echo COMPOSER_UP='composer update --no-progress --ansi'$([[ "${{ matrix.mode }}" != low-deps ]] && echo ' --ignore-platform-req=php+') >> $GITHUB_ENV echo SYMFONY_DEPRECATIONS_HELPER="baselineFile=$(pwd)/.github/deprecations-baseline.json" >> $GITHUB_ENV