Skip to content

Commit dae2bde

Browse files
committed
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. Also display the PHP version used for the deprecations, this makes debugging easier.
1 parent d2a1b62 commit dae2bde

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

gitlab/unit-tests.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ php $phpcov webapp/bin/phpunit -c webapp/phpunit.xml.dist webapp/tests/$unittest
3636
UNITSUCCESS=$?
3737
set -e
3838
CNT=0
39+
THRESHOLD=32
3940
if [ $CODECOVERAGE -eq 1 ]; then
4041
CNT=$(sed -n '/Generating code coverage report/,$p' "$GITLABARTIFACTS"/phpunit.out | grep -v DoctrineTestBundle | grep -cv ^$)
4142
FILE=deprecation.txt
4243
sed -n '/Generating code coverage report/,$p' "$GITLABARTIFACTS"/phpunit.out > ${CI_PROJECT_DIR}/$FILE
43-
if [ $CNT -le 32 ]; then
44+
if [ $CNT -le $THRESHOLD ]; then
4445
STATE=success
4546
else
4647
STATE=failure
@@ -52,7 +53,7 @@ if [ $CODECOVERAGE -eq 1 ]; then
5253
-X POST \
5354
-H "Authorization: token $GH_BOT_TOKEN_OBSCURED" \
5455
-H "Accept: application/vnd.github.v3+json" \
55-
-d "{\"state\": \"$STATE\", \"target_url\": \"${CI_JOB_URL/$ORIGINAL/$REPLACETO}/artifacts/$FILE\", \"description\":\"Symfony deprecations\", \"context\": \"Symfony deprecation\"}"
56+
-d "{\"state\": \"$STATE\", \"target_url\": \"${CI_JOB_URL/$ORIGINAL/$REPLACETO}/artifacts/$FILE\", \"description\":\"Symfony deprecations ($version)\", \"context\": \"Symfony deprecation ($version)\"}"
5657
fi
5758
if [ $UNITSUCCESS -eq 0 ]; then
5859
STATE=success
@@ -66,7 +67,7 @@ curl https://api.github.com/repos/domjudge/domjudge/statuses/$CI_COMMIT_SHA \
6667
-H "Authorization: token $GH_BOT_TOKEN_OBSCURED" \
6768
-H "Accept: application/vnd.github.v3+json" \
6869
-d "{\"state\": \"$STATE\", \"target_url\": \"${CI_PIPELINE_URL}/test_report\", \"description\":\"Unit tests\", \"context\": \"unit_tests ($version)\"}"
69-
if [ $UNITSUCCESS -ne 0 ]; then
70+
if [ $UNITSUCCESS -ne 0 ] || [ $CNT -gt $THRESHOLD ]; then
7071
exit 1
7172
fi
7273

0 commit comments

Comments
 (0)