From c586c159ee0b9c2404480db42e688e48eca73d66 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Fri, 29 Nov 2024 18:48:20 +0100 Subject: [PATCH] Don't mask the deprecation failure Before the failure was overwritten when the unit tests passed, now we correctly fail instead of only having an visual indicator. --- gitlab/unit-tests.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitlab/unit-tests.sh b/gitlab/unit-tests.sh index eac624a8f8..337c533cd0 100755 --- a/gitlab/unit-tests.sh +++ b/gitlab/unit-tests.sh @@ -36,11 +36,12 @@ php $phpcov webapp/bin/phpunit -c webapp/phpunit.xml.dist webapp/tests/$unittest UNITSUCCESS=$? set -e CNT=0 +THRESHOLD=32 if [ $CODECOVERAGE -eq 1 ]; then CNT=$(sed -n '/Generating code coverage report/,$p' "$GITLABARTIFACTS"/phpunit.out | grep -v DoctrineTestBundle | grep -cv ^$) FILE=deprecation.txt sed -n '/Generating code coverage report/,$p' "$GITLABARTIFACTS"/phpunit.out > ${CI_PROJECT_DIR}/$FILE - if [ $CNT -le 32 ]; then + if [ $CNT -le $THRESHOLD ]; then STATE=success else STATE=failure @@ -66,7 +67,7 @@ curl https://api.github.com/repos/domjudge/domjudge/statuses/$CI_COMMIT_SHA \ -H "Authorization: token $GH_BOT_TOKEN_OBSCURED" \ -H "Accept: application/vnd.github.v3+json" \ -d "{\"state\": \"$STATE\", \"target_url\": \"${CI_PIPELINE_URL}/test_report\", \"description\":\"Unit tests\", \"context\": \"unit_tests ($version)\"}" -if [ $UNITSUCCESS -ne 0 ]; then +if [ $UNITSUCCESS -ne 0 ] || [ $CNT -le $THRESHOLD ]; then exit 1 fi