From e8d90ac4d0589ce587506b84069012e58e162ac0 Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Wed, 9 Sep 2026 22:54:24 +0300 Subject: [PATCH 1/3] fix(tests): exit non-zero when the TestBootstrapper cannot be found exit('message') terminates the process with status 0, so a failure to locate the platform TestBootstrapper left the PHPUnit job green with not a single test executed. The three fallback paths exist because the platform layout already moved twice (shopware/platform monorepo, shopware/core split, in-tree), so a third move would have silently greened this job. CompletionGuard cannot cover this: it is registered inside TestBootstrapper::bootstrap(), which is never reached here. Refs https://github.com/shopware/shopware/issues/18667 --- tests/TestBootstrap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/TestBootstrap.php b/tests/TestBootstrap.php index fbe4d5ca..b312d5e6 100644 --- a/tests/TestBootstrap.php +++ b/tests/TestBootstrap.php @@ -14,7 +14,8 @@ } elseif (is_readable(__DIR__ . '/../../../../src/Core/TestBootstrapper.php')) { require __DIR__ . '/../../../../src/Core/TestBootstrapper.php'; } else { - exit('Could not find TestBootstrapper.php'); + fwrite(\STDERR, 'Could not find TestBootstrapper.php' . \PHP_EOL); + exit(1); } return (new TestBootstrapper()) From 0d59e2358c203ca30662e6a603d160f062ddfabb Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Wed, 9 Sep 2026 23:35:17 +0300 Subject: [PATCH 2/3] feat(ci): report PHPUnit coverage to Codecov MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The job already ran with pcov enabled but passed no --coverage flag and phpunit.xml.dist configures no report, so every leg paid for line instrumentation and produced nothing. Coverage is now generated and uploaded once — from the mysql:8.0 / PHP 8.3 leg, since all four legs cover the same lines — and pcov is switched off on the other three, which no longer pay for it. Only the Integration workflow opts in: it runs on pull requests and on push to trunk, so Codecov gets the trunk baseline its project status compares against. Nightly and compat-check run against other platform and assistant branches, so their coverage would not be comparable and stays off. .github/codecov.yml sets the project and patch thresholds. Neither status is a required check in this repository, so a coverage drop reports red without blocking a merge. Refs https://github.com/shopware/shopware/issues/18667 --- .github/codecov.yml | 10 ++++++++++ .github/workflows/action-phpunit.yml | 20 +++++++++++++++++++- .github/workflows/integration.yml | 3 +++ .gitignore | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..f1594699 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + threshold: 0.01% + patch: + default: + target: auto + threshold: 5% + base: auto diff --git a/.github/workflows/action-phpunit.yml b/.github/workflows/action-phpunit.yml index d63e0508..5dc7434c 100644 --- a/.github/workflows/action-phpunit.yml +++ b/.github/workflows/action-phpunit.yml @@ -14,6 +14,13 @@ on: required: false type: string default: "" + coverage: + required: false + type: boolean + default: false + secrets: + CODECOV_TOKEN: + required: false jobs: phpunit: @@ -25,6 +32,8 @@ jobs: matrix: mysql_image: ["mysql:8.0", "mariadb:10.11"] php_version: ["8.2", "8.3"] + env: + COVERAGE: ${{ inputs.coverage && matrix.mysql_image == 'mysql:8.0' && matrix.php_version == '8.3' }} steps: - name: Checkout SwagMigrationMagento uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -43,4 +52,13 @@ jobs: working-directory: custom/plugins/${{ inputs.extension_name }} run: | composer dump-autoload --dev - php -d pcov.enabled=1 -d pcov.directory=${PWD}/src -d pcov.exclude='~(vendor|tests|node_modules)~' ${GITHUB_WORKSPACE}/vendor/bin/phpunit --configuration phpunit.xml.dist + php -d pcov.enabled=${{ env.COVERAGE == 'true' && '1' || '0' }} -d pcov.directory=${PWD}/src -d pcov.exclude='~(vendor|tests|node_modules)~' ${GITHUB_WORKSPACE}/vendor/bin/phpunit --configuration phpunit.xml.dist ${{ env.COVERAGE == 'true' && '--coverage-cobertura coverage.xml' || '' }} + + - name: Upload coverage to Codecov + if: env.COVERAGE == 'true' + uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + working-directory: custom/plugins/${{ inputs.extension_name }} + files: coverage.xml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 6ced428f..ecd908c3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -35,3 +35,6 @@ jobs: with: extension_name: ${{ github.event.repository.name }} platform_branch: trunk + coverage: true + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 75fbc6d7..647c0137 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ src/Resources/public/administration/ src/Resources/public/static/ composer.lock php-cs-fixer.migration-magento.cache +coverage.xml From a5d8e1d0a6a01b04849e1e9175f10dc5d13fafbb Mon Sep 17 00:00:00 2001 From: Jozsef Damokos Date: Thu, 10 Sep 2026 00:06:09 +0300 Subject: [PATCH 3/3] fix(ci): align the Codecov upload with the other plugin repositories SwagCmsExtensions, SwagSocialShopping and SwagPublisher all upload clover from an absolute working directory with root_dir set, and so does shopware/github-actions/phpunit. Matching that keeps the four migration repositories from being a fifth dialect, and clover is the format the PHPUnit shipped with Shopware 5 also understands, so every repository can use one. Drops .github/codecov.yml: no other plugin ships one, Codecov posts both statuses from its own defaults without it, and the file only replaced those defaults with the platform's tolerances. --- .github/codecov.yml | 10 ---------- .github/workflows/action-phpunit.yml | 7 ++++--- .gitignore | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) delete mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml deleted file mode 100644 index f1594699..00000000 --- a/.github/codecov.yml +++ /dev/null @@ -1,10 +0,0 @@ -coverage: - status: - project: - default: - threshold: 0.01% - patch: - default: - target: auto - threshold: 5% - base: auto diff --git a/.github/workflows/action-phpunit.yml b/.github/workflows/action-phpunit.yml index 5dc7434c..d7eef84f 100644 --- a/.github/workflows/action-phpunit.yml +++ b/.github/workflows/action-phpunit.yml @@ -52,7 +52,7 @@ jobs: working-directory: custom/plugins/${{ inputs.extension_name }} run: | composer dump-autoload --dev - php -d pcov.enabled=${{ env.COVERAGE == 'true' && '1' || '0' }} -d pcov.directory=${PWD}/src -d pcov.exclude='~(vendor|tests|node_modules)~' ${GITHUB_WORKSPACE}/vendor/bin/phpunit --configuration phpunit.xml.dist ${{ env.COVERAGE == 'true' && '--coverage-cobertura coverage.xml' || '' }} + php -d pcov.enabled=${{ env.COVERAGE == 'true' && '1' || '0' }} -d pcov.directory=${PWD}/src -d pcov.exclude='~(vendor|tests|node_modules)~' ${GITHUB_WORKSPACE}/vendor/bin/phpunit --configuration phpunit.xml.dist ${{ env.COVERAGE == 'true' && '--coverage-clover clover.xml' || '' }} - name: Upload coverage to Codecov if: env.COVERAGE == 'true' @@ -60,5 +60,6 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - working-directory: custom/plugins/${{ inputs.extension_name }} - files: coverage.xml + root_dir: ${{ github.workspace }}/custom/plugins/${{ inputs.extension_name }} + working-directory: ${{ github.workspace }}/custom/plugins/${{ inputs.extension_name }} + files: ./clover.xml diff --git a/.gitignore b/.gitignore index 647c0137..d0889535 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ src/Resources/public/administration/ src/Resources/public/static/ composer.lock php-cs-fixer.migration-magento.cache -coverage.xml +clover.xml