From 5d8ebd9bc5eb5530e440cffe42ae70c9e8f84753 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 1 Dec 2024 19:46:51 +0100 Subject: [PATCH] Run all unit tests coverage --- .github/jobs/unit-tests.sh | 8 ++++++-- .github/workflows/unit-tests.yml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/jobs/unit-tests.sh b/.github/jobs/unit-tests.sh index fe7bc31e6c..e363aca1a8 100755 --- a/.github/jobs/unit-tests.sh +++ b/.github/jobs/unit-tests.sh @@ -37,13 +37,17 @@ fi set +e php $phpcov webapp/bin/phpunit -c webapp/phpunit.xml.dist webapp/tests/$unittest --log-junit "$ARTIFACTS"/unit-tests.xml --colors=never $pcov > "$ARTIFACTS"/phpunit.out UNITSUCCESS=$? + +# Make sure the log exists before copy +touch ${DIR}/webapp/var/log/test.log +cp ${DIR}/webapp/var/log/test.log "$ARTIFACTS"/test.log + set -e CNT=0 THRESHOLD=32 if [ $CODECOVERAGE -eq 1 ]; then CNT=$(sed -n '/Generating code coverage report/,$p' "$ARTIFACTS"/phpunit.out | grep -v DoctrineTestBundle | grep -cv ^$) fi -cp webapp/var/log/test.log "$ARTIFACTS"/test.log if [ $UNITSUCCESS -ne 0 ] || [ $CNT -gt $THRESHOLD ]; then exit 1 @@ -54,6 +58,6 @@ if [ $CODECOVERAGE -eq 1 ]; then # Only upload when we got working unit-tests. set +u # Uses some variables which are not set # shellcheck disable=SC1090 - . $DIR/.github/jobs/uploadcodecov.sh 1>/dev/zero 2>/dev/zero + . $DIR/.github/jobs/uploadcodecov.sh &>> "$ARTIFACTS"/codecov.log section_end fi diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 93792dd12e..e06ebbd0eb 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -57,4 +57,4 @@ jobs: if: ${{ !cancelled() }} with: files: | - /tmp/artifacts/unit-tests.xml + unit-tests.xml