Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Unit tests for all branches again #2867

Merged
merged 5 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
configuration: webapp/phpstan.dist.neon
path: webapp/src webapp/tests
Expand Down
2 changes: 1 addition & 1 deletion gitlab/ci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
9 changes: 0 additions & 9 deletions gitlab/ci/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions gitlab/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/Jury/JuryMiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
Expand Down
Loading