From 6ad23399b2418d683c9c4f4c0a315206cd26e055 Mon Sep 17 00:00:00 2001 From: Marijn Doeve Date: Fri, 10 Jul 2026 09:34:33 +0200 Subject: [PATCH] ci: fix coverage report paths and tolerate Code Quality not yet enabled - Write PHPUnit's JUnit and Cobertura reports to reports/ instead of var/, since var/ is a Docker volume (Dockerfile's VOLUME /app/var/) that isn't bind-mounted to the runner - reports written there never reached the host, which is also why the prior junit.xml publish step had nothing to read. reports/ is a plain path under the project's bind mount, so no extra copy-out step is needed - Set fail-on-error: false on the coverage upload step: it 404s until "Code Quality" is turned on for the repo under Settings > Code security > Code quality, a one-time manual step --- .github/workflows/ci.yml | 21 +++++++++------------ .gitignore | 1 + 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1ca3f0..8644fbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,29 +151,26 @@ jobs: - name: Load fixtures run: docker compose exec -T php bin/console -e test doctrine:fixtures:load --no-interaction --group=test - name: Run PHPUnit - run: docker compose exec -T -e MAILER_DSN=null://null php vendor/bin/phpunit --log-junit var/phpunit/junit.xml --coverage-cobertura var/coverage/cobertura.xml - - name: Copy test reports out of the container - # var/ is a Docker volume (see Dockerfile's VOLUME /app/var/), not bind-mounted to the - # runner, so reports written there by PHPUnit must be copied out explicitly. - if: always() - continue-on-error: true - run: | - mkdir -p var/phpunit var/coverage - docker compose cp php:/app/var/phpunit/junit.xml var/phpunit/junit.xml - docker compose cp php:/app/var/coverage/cobertura.xml var/coverage/cobertura.xml + # Reports are written outside var/ since var/ is a Docker volume (see the Dockerfile's + # VOLUME /app/var/) and isn't bind-mounted to the runner, unlike the rest of the project. + run: docker compose exec -T -e MAILER_DSN=null://null php vendor/bin/phpunit --log-junit reports/junit.xml --coverage-cobertura reports/coverage/cobertura.xml - name: Publish PHPUnit test results if: always() uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6 with: - report_paths: var/phpunit/junit.xml + report_paths: reports/junit.xml check_name: PHPUnit - name: Upload code coverage + # Requires "Code Quality" to be enabled for this repository under + # Settings > Code security > Code quality; fail-on-error is false so CI + # doesn't go red before that one-time, manual repository setting is turned on. if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository uses: actions/upload-code-coverage@82c7aee3fb2ad768e00b00a0a8d749c5815085b6 # v1 with: - file: var/coverage/cobertura.xml + file: reports/coverage/cobertura.xml language: PHP label: phpunit + fail-on-error: false - name: Doctrine Schema Validator run: docker compose exec -T php bin/console -e test doctrine:schema:validate diff --git a/.gitignore b/.gitignore index c3d49a6..60b7985 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /frankenphp/data +/reports/ ### Generated by gibo (https://github.com/simonwhitaker/gibo) ### https://raw.github.com/github/gitignore/6eeebe6f49678aacd8311ce079842c971b3ebe96/Symfony.gitignore