From e3563d95af7352f9f4b8e8f7c0bd806f87a9e333 Mon Sep 17 00:00:00 2001 From: jakubbbbdev Date: Sat, 5 Jul 2025 02:13:14 +0200 Subject: [PATCH] Add Qodana configuration, CI workflows, and update build setup --- .github/workflows/qodana_code_quality.yml | 40 +++++++++++++++++++++ .github/workflows/test.yml | 32 +++++++++++++++++ .idea/misc.xml | 2 +- build.gradle.kts | 30 +++++++++++++--- qodana.yaml | 44 +++++++++++++++++++++++ settings.gradle.kts | 9 ++++- 6 files changed, 151 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/qodana_code_quality.yml create mode 100644 .github/workflows/test.yml create mode 100644 qodana.yaml diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml new file mode 100644 index 0000000..595edf4 --- /dev/null +++ b/.github/workflows/qodana_code_quality.yml @@ -0,0 +1,40 @@ +#-------------------------------------------------------------------------------# +# Discover all capabilities of Qodana in our documentation # +# https://www.jetbrains.com/help/qodana/about-qodana.html # +#-------------------------------------------------------------------------------# + +name: Qodana +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + - master + +jobs: + qodana: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + checks: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2025.2 + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + with: + # In pr-mode: 'true' Qodana checks only changed files + pr-mode: false + use-caches: true + post-pr-comment: true + use-annotations: true + # Upload Qodana results (SARIF, other artifacts, logs) as an artifact to the job + upload-result: false + # quick-fixes available in Ultimate and Ultimate Plus plans + push-fixes: 'none' \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..891b355 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: "Test" +on: + workflow_dispatch: + push: + branches: + - "main" + pull_request: +jobs: + build: + name: "Test" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@master" + + - uses: "graalvm/setup-graalvm@v1" + with: + java-version: "23" + distribution: "graalvm-community" + github-token: ${{ secrets.GITHUB_TOKEN }} + cache: "gradle" + + - uses: "actions/cache@master" + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - run: | + chmod +x gradlew + ./gradlew clean test build \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 756b302..2758df8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f886643..7c819ba 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,18 +3,40 @@ plugins { } group = "dev.jakubbb.ramora" -version = "1.0-SNAPSHOT" repositories { mavenCentral() + gradlePluginPortal() } dependencies { - testImplementation(platform("org.junit:junit-bom:5.10.0")) - testImplementation("org.junit.jupiter:junit-jupiter") - testRuntimeOnly("org.junit.platform:junit-platform-launcher") + compileOnly("org.projectlombok:lombok:1.18.38") + annotationProcessor("org.projectlombok:lombok:1.18.38") + + implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.7") + implementation("net.thebugmc.gradle.sonatype-central-portal-publisher:net.thebugmc.gradle.sonatype-central-portal-publisher.gradle.plugin:1.2.4") + implementation("org.cthing.build-constants:org.cthing.build-constants.gradle.plugin:2.0.0") + + compileOnly(gradleApi()) + testImplementation(gradleTestKit()) + + testImplementation("org.junit.jupiter:junit-jupiter-api:5.13.2") + testImplementation("org.junit.jupiter:junit-jupiter:5.13.2") + testImplementation("org.junit.jupiter:junit-jupiter-params:5.13.2") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.13.1") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.13.2") + + testImplementation("org.assertj:assertj-core:3.27.3") + testImplementation("org.cthing:assertj-gradle:3.0.0") } tasks.test { useJUnitPlatform() +} + + +java { + withSourcesJar() + withJavadocJar() + toolchain.languageVersion.set(JavaLanguageVersion.of(21)) } \ No newline at end of file diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..f6eb664 --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,44 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.starter + +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +projectJDK: "21" #(Applied in CI/CD pipeline) + +#Execute shell command before Qodana execution (Applied in CI/CD pipeline) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com) + +# Quality gate. Will fail the CI/CD pipeline if any condition is not met +# severityThresholds - configures maximum thresholds for different problem severities +# testCoverageThresholds - configures minimum code coverage on a whole project and newly added code +# Code Coverage is available in Ultimate and Ultimate Plus plans +#failureConditions: +# severityThresholds: +# any: 15 +# critical: 5 +# testCoverageThresholds: +# fresh: 70 +# total: 50 + +#Qodana supports other languages, for example, Python, JavaScript, TypeScript, Go, C#, PHP +#For all supported languages see https://www.jetbrains.com/help/qodana/linters.html +linter: jetbrains/qodana-jvm-community:2025.2 diff --git a/settings.gradle.kts b/settings.gradle.kts index 8b4f408..e5a1720 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,8 @@ -rootProject.name = "ramora" \ No newline at end of file +rootProject.name = "ramora" + +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} \ No newline at end of file