mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-11 20:38:21 +02:00
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
This commit is contained in:
@@ -151,29 +151,26 @@ jobs:
|
|||||||
- name: Load fixtures
|
- name: Load fixtures
|
||||||
run: docker compose exec -T php bin/console -e test doctrine:fixtures:load --no-interaction --group=test
|
run: docker compose exec -T php bin/console -e test doctrine:fixtures:load --no-interaction --group=test
|
||||||
- name: Run PHPUnit
|
- 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
|
# Reports are written outside var/ since var/ is a Docker volume (see the Dockerfile's
|
||||||
- name: Copy test reports out of the container
|
# VOLUME /app/var/) and isn't bind-mounted to the runner, unlike the rest of the project.
|
||||||
# var/ is a Docker volume (see Dockerfile's VOLUME /app/var/), not bind-mounted to the
|
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
|
||||||
# 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
|
|
||||||
- name: Publish PHPUnit test results
|
- name: Publish PHPUnit test results
|
||||||
if: always()
|
if: always()
|
||||||
uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6
|
uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6
|
||||||
with:
|
with:
|
||||||
report_paths: var/phpunit/junit.xml
|
report_paths: reports/junit.xml
|
||||||
check_name: PHPUnit
|
check_name: PHPUnit
|
||||||
- name: Upload code coverage
|
- 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
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
||||||
uses: actions/upload-code-coverage@82c7aee3fb2ad768e00b00a0a8d749c5815085b6 # v1
|
uses: actions/upload-code-coverage@82c7aee3fb2ad768e00b00a0a8d749c5815085b6 # v1
|
||||||
with:
|
with:
|
||||||
file: var/coverage/cobertura.xml
|
file: reports/coverage/cobertura.xml
|
||||||
language: PHP
|
language: PHP
|
||||||
label: phpunit
|
label: phpunit
|
||||||
|
fail-on-error: false
|
||||||
- name: Doctrine Schema Validator
|
- name: Doctrine Schema Validator
|
||||||
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
|
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/frankenphp/data
|
/frankenphp/data
|
||||||
|
/reports/
|
||||||
|
|
||||||
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
||||||
### https://raw.github.com/github/gitignore/6eeebe6f49678aacd8311ce079842c971b3ebe96/Symfony.gitignore
|
### https://raw.github.com/github/gitignore/6eeebe6f49678aacd8311ce079842c971b3ebe96/Symfony.gitignore
|
||||||
|
|||||||
Reference in New Issue
Block a user