Skip to content

Commit

Permalink
Run all unit tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Dec 1, 2024
1 parent 848d9da commit 5d8ebd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/jobs/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
if: ${{ !cancelled() }}
with:
files: |
/tmp/artifacts/unit-tests.xml
unit-tests.xml

0 comments on commit 5d8ebd9

Please sign in to comment.