From 71dbe470954c2a00a06f59e864240e5677c90741 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Fri, 29 Nov 2024 18:17:11 +0100 Subject: [PATCH 1/5] Use executeQuery over deprecated query() Removing 1 of the deprecations --- webapp/src/Controller/Jury/JuryMiscController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/Controller/Jury/JuryMiscController.php b/webapp/src/Controller/Jury/JuryMiscController.php index 13fbd55696..c2f6018de9 100644 --- a/webapp/src/Controller/Jury/JuryMiscController.php +++ b/webapp/src/Controller/Jury/JuryMiscController.php @@ -50,7 +50,7 @@ public function __construct( public function indexAction(ConfigurationService $config): Response { if ($this->isGranted('ROLE_ADMIN')) { - $innodbSnapshotIsolation = $this->em->getConnection()->query('SHOW VARIABLES LIKE "innodb_snapshot_isolation"')->fetchAssociative(); + $innodbSnapshotIsolation = $this->em->getConnection()->executeQuery('SHOW VARIABLES LIKE "innodb_snapshot_isolation"')->fetchAssociative(); if ($innodbSnapshotIsolation && $innodbSnapshotIsolation['Value'] === 'ON') { $this->addFlash('danger', 'InnoDB snapshot isolation is enabled. Set --innodb_snapshot_isolation=OFF in your MariaDB configuration. See https://github.com/DOMjudge/domjudge/issues/2848 for more information.'); } From 71d3fa5e22719ec90e43b639fb9f52b69005c873 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:23:31 +0100 Subject: [PATCH 2/5] Run Unit tests for all branches again We limited because of the number of minutes but as we're close to migrating away from GitLab this is the easier fix for the current deprecation issue. --- gitlab/ci/unit.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/gitlab/ci/unit.yml b/gitlab/ci/unit.yml index d9a91557b1..5bf7aab8c7 100644 --- a/gitlab/ci/unit.yml +++ b/gitlab/ci/unit.yml @@ -29,21 +29,12 @@ - unit-tests.xml run unit tests: - only: - - main - - /^[0-9].[0-9]$/ extends: [.mariadb_job,.phpsupported_job,.unit_job] run unit tests (PR): - except: - - main - - /^[0-9].[0-9]$/ extends: [.mariadb_job,.phpsupported_job_pr,.unit_job] run unit tests (MySQL): - only: - - main - - /^[0-9].[0-9]$/ extends: [.mysql_job,.unit_job] parallel: matrix: From 5080748b37fb16a69e4e35e9b2b27b5111c8db17 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 26 Nov 2024 22:05:40 +0100 Subject: [PATCH 3/5] 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. --- gitlab/unit-tests.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gitlab/unit-tests.sh b/gitlab/unit-tests.sh index 63ae58121e..b412a060cb 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 @@ -52,7 +53,7 @@ if [ $CODECOVERAGE -eq 1 ]; then -X POST \ -H "Authorization: token $GH_BOT_TOKEN_OBSCURED" \ -H "Accept: application/vnd.github.v3+json" \ - -d "{\"state\": \"$STATE\", \"target_url\": \"${CI_JOB_URL/$ORIGINAL/$REPLACETO}/artifacts/$FILE\", \"description\":\"Symfony deprecations\", \"context\": \"Symfony deprecation\"}" + -d "{\"state\": \"$STATE\", \"target_url\": \"${CI_JOB_URL/$ORIGINAL/$REPLACETO}/artifacts/$FILE\", \"description\":\"Symfony deprecations ($version)\", \"context\": \"Symfony deprecation ($version)\"}" fi if [ $UNITSUCCESS -eq 0 ]; then STATE=success @@ -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 -gt $THRESHOLD ]; then exit 1 fi From e772578e26b8677434b90d3fc979042de9c6c5e6 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Fri, 29 Nov 2024 19:10:02 +0100 Subject: [PATCH 4/5] Show the PHPStan version Also pin to the second to last released version for the GHA as the last one crashes. --- .github/workflows/phpstan.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3a2e5ac66c..3d7b4fd952 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -13,7 +13,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup composer dependencies run: .github/jobs/composer_setup.sh - - uses: php-actions/phpstan@v3 + - name: Show the phpstan version + run: webapp/vendor/phpstan/phpstan/phpstan --version + - uses: php-actions/phpstan@v3.0.2 with: configuration: webapp/phpstan.dist.neon path: webapp/src webapp/tests From 63c53db0bdd5d9ac1e2914f1ddbcbf0f77fe6f33 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Fri, 29 Nov 2024 19:43:57 +0100 Subject: [PATCH 5/5] Test with all supported PHP versions --- .github/workflows/codestyle.yml | 2 +- gitlab/ci/template.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index a4c8a49973..0dbddf8f72 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -46,7 +46,7 @@ jobs: image: pipelinecomponents/php-codesniffer:latest strategy: matrix: - PHPVERSION: ["8.1", "8.2", "8.3"] + PHPVERSION: ["8.1", "8.2", "8.3", "8.4"] steps: - run: apk add git - uses: actions/checkout@v4 diff --git a/gitlab/ci/template.yml b/gitlab/ci/template.yml index 86521a2f22..e810df854c 100644 --- a/gitlab/ci/template.yml +++ b/gitlab/ci/template.yml @@ -50,7 +50,7 @@ - /bin/true parallel: matrix: - - PHPVERSION: ["8.1","8.2","8.3"] + - PHPVERSION: ["8.1","8.2","8.3", "8.4"] TEST: ["E2E","Unit"] CRAWL_SHADOW_MODE: ["0","1"]