From 4a4bbbc68353ebd4844d8fbaf90e42a4ba34c297 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:40:34 +0100 Subject: [PATCH 01/11] ci: add checkstyle job to CI workflow --- .gitea/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b1eaab8..561e170 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -4,6 +4,29 @@ on: pull_request: jobs: + checkstyle: + name: "Checkstyle Main" + runs-on: "ubuntu-latest" + container: + image: "cimg/openjdk:21.0-node" + steps: + - name: "Checkout" + uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: "Prepare Gradle" + run: gradle clean + - name: "Check" + run: gradle check + - name: "Stop Gradle" + run: gradle --stop + eslint: name: eslint runs-on: vps-4 From 582f8b1a6c004c638b660f09d6ad84740dab830c Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:41:18 +0100 Subject: [PATCH 02/11] ci: add step to navigate to backend directory --- .gitea/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 561e170..f781dda 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -12,6 +12,8 @@ jobs: steps: - name: "Checkout" uses: actions/checkout@v3 + - name: "Go to backend" + run: cd backend - uses: actions/cache@v3 with: path: | From 7b824452303cb77a68f185ef6ccb9acd851113bc Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:42:05 +0100 Subject: [PATCH 03/11] ci: change CI runner to vps-4 for checkstyle job --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f781dda..9cb54b6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -6,7 +6,7 @@ on: jobs: checkstyle: name: "Checkstyle Main" - runs-on: "ubuntu-latest" + runs-on: "vps-4" container: image: "cimg/openjdk:21.0-node" steps: From c49f7ca55d700825bc7cda6395e2efa48628cfbf Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:45:40 +0100 Subject: [PATCH 04/11] ci: update working directory for backend steps --- .gitea/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9cb54b6..a056aa9 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -12,9 +12,8 @@ jobs: steps: - name: "Checkout" uses: actions/checkout@v3 - - name: "Go to backend" - run: cd backend - uses: actions/cache@v3 + working-directory: ./backend with: path: | ~/.gradle/caches @@ -23,10 +22,13 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: "Prepare Gradle" + working-directory: ./backend run: gradle clean - name: "Check" + working-directory: ./backend run: gradle check - name: "Stop Gradle" + working-directory: ./backend run: gradle --stop eslint: From 193f444f4fd658bee8521429723acee8b201eb6d Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:49:42 +0100 Subject: [PATCH 05/11] build: add checkstyle plugin and update reports settings --- backend/build.gradle.kts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index 565e524..0f99e7f 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -2,6 +2,17 @@ plugins { java id("org.springframework.boot") version "3.3.3" id("io.spring.dependency-management") version "1.1.6" + id("checkstyle") +} + +tasks.withType { + reports { + // Disable HTML report + html.required.set(false) + + // Disable XML report + xml.required.set(false) + } } group = "de.szut" From 966d99f43cb87b390e94d71511b65c1f419fba7e Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 11:57:00 +0100 Subject: [PATCH 06/11] build: add Java 22 setup to CI workflow --- .gitea/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a056aa9..e8a5c92 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -12,6 +12,12 @@ jobs: steps: - name: "Checkout" uses: actions/checkout@v3 + - name: Setup Java 22 + uses: actions/setup-java@v3 + with: + distribution: "temurin" + java-version: "22" + - uses: actions/cache@v3 working-directory: ./backend with: From d117f5912ab2ffe7de03a2cc2934fafba495654e Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 12:00:38 +0100 Subject: [PATCH 07/11] build: update Checkstyle container image version --- .gitea/workflows/ci.yml | 2 +- backend/config/checkstyle/checkstyle.xml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 backend/config/checkstyle/checkstyle.xml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e8a5c92..c8b172c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: name: "Checkstyle Main" runs-on: "vps-4" container: - image: "cimg/openjdk:21.0-node" + image: "cimg/openjdk:22.0-node" steps: - name: "Checkout" uses: actions/checkout@v3 diff --git a/backend/config/checkstyle/checkstyle.xml b/backend/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..eb45038 --- /dev/null +++ b/backend/config/checkstyle/checkstyle.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4a9c769bbcf1f7b90f5e00b2ccf30e3b8e3207e4 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 12:14:52 +0100 Subject: [PATCH 08/11] build: add checkstyle configuration file path --- backend/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index 0f99e7f..aa375f2 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -5,6 +5,10 @@ plugins { id("checkstyle") } +checkstyle { + configFile = file("$rootDir/config/checkstyle.xml") +} + tasks.withType { reports { // Disable HTML report From 5e24e3d020f88c2ee9cc4b3e03e86678d70ca25f Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 12:18:13 +0100 Subject: [PATCH 09/11] style(checkstyle): remove unused SuppressionFilter module --- backend/config/checkstyle/checkstyle.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backend/config/checkstyle/checkstyle.xml b/backend/config/checkstyle/checkstyle.xml index eb45038..bdcefb8 100644 --- a/backend/config/checkstyle/checkstyle.xml +++ b/backend/config/checkstyle/checkstyle.xml @@ -4,10 +4,6 @@ "https://checkstyle.org/dtds/configuration_1_3.dtd" > - - - - @@ -19,5 +15,4 @@ - \ No newline at end of file From 96bd5ac704781a1c034db44279ff55a823e1df2f Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 12:26:43 +0100 Subject: [PATCH 10/11] chore: fix file paths and add missing newlines --- backend/build.gradle.kts | 2 +- .../main/java/de/szut/casino/config/OpenAPIConfiguration.java | 2 +- .../java/de/szut/casino/security/KeycloakLogoutHandler.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index aa375f2..76efd27 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } checkstyle { - configFile = file("$rootDir/config/checkstyle.xml") + configFile = file("$rootDir/config/checkstyle/checkstyle.xml") } tasks.withType { diff --git a/backend/src/main/java/de/szut/casino/config/OpenAPIConfiguration.java b/backend/src/main/java/de/szut/casino/config/OpenAPIConfiguration.java index f102caf..7af90b9 100644 --- a/backend/src/main/java/de/szut/casino/config/OpenAPIConfiguration.java +++ b/backend/src/main/java/de/szut/casino/config/OpenAPIConfiguration.java @@ -58,4 +58,4 @@ public class OpenAPIConfiguration { } -} \ No newline at end of file +} diff --git a/backend/src/main/java/de/szut/casino/security/KeycloakLogoutHandler.java b/backend/src/main/java/de/szut/casino/security/KeycloakLogoutHandler.java index 2403c82..5e08794 100644 --- a/backend/src/main/java/de/szut/casino/security/KeycloakLogoutHandler.java +++ b/backend/src/main/java/de/szut/casino/security/KeycloakLogoutHandler.java @@ -45,4 +45,4 @@ public class KeycloakLogoutHandler implements LogoutHandler { } } -} \ No newline at end of file +} From dc07ad5b0dd02270b0201a0e4188e150918685dc Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Thu, 13 Feb 2025 12:26:52 +0100 Subject: [PATCH 11/11] ci: update Gradle check to use checkstyleMain --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c8b172c..366770a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: run: gradle clean - name: "Check" working-directory: ./backend - run: gradle check + run: gradle checkstyleMain - name: "Stop Gradle" working-directory: ./backend run: gradle --stop