diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml new file mode 100644 index 000000000..f057276a2 --- /dev/null +++ b/.github/workflows/qodana_code_quality.yml @@ -0,0 +1,51 @@ +# "Commons Clause" License Condition v1.0 +# +# The Software is provided to you by the Licensor under the License, as defined +# below, subject to the following condition. +# +# Without limiting other conditions in the License, the grant of rights under the +# License will not include, and the License does not grant to you, the right to +# Sell the Software. +# +# For purposes of the foregoing, “Sell” means practicing any or all of the rights +# granted to you under the License to provide to third parties, for a fee or +# other consideration (including without limitation fees for hosting or +# consulting/ support services related to the Software), a product or service +# whose value derives, entirely or substantially, from the functionality of the +# Software. Any license notice or attribution required by the License must also +# include this Commons Clause License Condition notice. +# +# Software: Infinitic +# +# License: MIT License (https://opensource.org/licenses/MIT) +# +# Licensor: infinitic.io + +name: Qodana +on: + workflow_dispatch: + pull_request: + push: + branches: # Specify your branches here + - main # The 'main' branch + - 'releases/*' # The release branches + +jobs: + qodana: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + checks: write + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit + fetch-depth: 0 # a full history is required for pull request analysis + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2025.1 + with: + pr-mode: false + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_14297613 }} + QODANA_ENDPOINT: 'https://qodana.cloud' diff --git a/publish.gradle.kts b/publish.gradle.kts index a2e1b853f..2d075fd9d 100644 --- a/publish.gradle.kts +++ b/publish.gradle.kts @@ -20,7 +20,6 @@ * * Licensor: infinitic.io */ - import okhttp3.RequestBody.Companion.toRequestBody // https://proandroiddev.com/publishing-a-maven-artifact-3-3-step-by-step-instructions-to-mavencentral-publishing-bd661081645d @@ -31,7 +30,8 @@ import okhttp3.RequestBody.Companion.toRequestBody // * login to https://central.sonatype.com/publishing/deployments // * once the new version is uploaded then publish it // -// curl -u ossSonatypeOrgUsername:ossSonatypeOrgPassword -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.infinitic +// curl -u ossSonatypeOrgUsername:ossSonatypeOrgPassword -X POST +// https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.infinitic // // You must have a gradle.properties file with // ossSonatypeOrgUsername= @@ -60,9 +60,7 @@ buildscript { maven(url = uri("https://central.sonatype.com/repository/maven-snapshots/")) maven(url = uri("https://plugins.gradle.org/m2/")) } - dependencies { - classpath("com.squareup.okhttp3:okhttp:4.12.0") - } + dependencies { classpath("com.squareup.okhttp3:okhttp:4.12.0") } } repositories { mavenCentral() } @@ -93,8 +91,7 @@ publishing { repositories { val releasesRepoUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") - val snapshotsRepoUrl = - uri("https://central.sonatype.com/repository/maven-snapshots/") + val snapshotsRepoUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") maven { name = "ossrh-staging-api" url = if (Ci.isRelease) releasesRepoUrl else snapshotsRepoUrl @@ -139,39 +136,44 @@ publishing { } // === Notify Central Portal === -val notifyCentralPortal = if (rootProject.tasks.findByName("notifyCentralPortal") == null) { - rootProject.tasks.register("notifyCentralPortal") { - group = "publishing" - description = "Notify Central Portal after Maven publish" - - doLast { - val groupId = "io.infinitic" - val username = System.getenv("OSSRH_USERNAME") ?: ossSonatypeOrgUsername - val password = System.getenv("OSSRH_PASSWORD") ?: ossSonatypeOrgPassword - - if (username == null || password == null) throw GradleException("Missing OSSRH credentials.") - - val auth = okhttp3.Credentials.basic(username, password) - val client = okhttp3.OkHttpClient() - - val request = okhttp3.Request.Builder() - .url("https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$groupId") - .post(ByteArray(0).toRequestBody(null)) - .header("Authorization", auth) - .build() - - val response = client.newCall(request).execute() - - if (!response.isSuccessful) { - throw GradleException("Failed to notify Central Portal: ${response.code} - ${response.body?.string()}") - } else { - println("✅ Successfully notified Central Portal for groupId: $groupId") +val notifyCentralPortal = + if (rootProject.tasks.findByName("notifyCentralPortal") == null) { + rootProject.tasks.register("notifyCentralPortal") { + group = "publishing" + description = "Notify Central Portal after Maven publish" + + doLast { + val groupId = "io.infinitic" + val username = System.getenv("OSSRH_USERNAME") ?: ossSonatypeOrgUsername + val password = System.getenv("OSSRH_PASSWORD") ?: ossSonatypeOrgPassword + + if (username == null || password == null) + throw GradleException("Missing OSSRH credentials.") + + val auth = okhttp3.Credentials.basic(username, password) + val client = okhttp3.OkHttpClient() + + val request = + okhttp3.Request.Builder() + .url( + "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$groupId") + .post(ByteArray(0).toRequestBody(null)) + .header("Authorization", auth) + .build() + + val response = client.newCall(request).execute() + + if (!response.isSuccessful) { + throw GradleException( + "Failed to notify Central Portal: ${response.code} - ${response.body?.string()}") + } else { + println("✅ Successfully notified Central Portal for groupId: $groupId") + } + } } + } else { + rootProject.tasks.named("notifyCentralPortal") } - } -} else { - rootProject.tasks.named("notifyCentralPortal") -} // === Hook into publishing (runs only once after all publishing is done) === diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 000000000..38c2cda81 --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,27 @@ +# "Commons Clause" License Condition v1.0 +# +# The Software is provided to you by the Licensor under the License, as defined below, subject to +# the following condition. +# +# Without limiting other conditions in the License, the grant of rights under the License will not +# include, and the License does not grant to you, the right to Sell the Software. +# +# For purposes of the foregoing, "Sell" means practicing any or all of the rights granted to you +# under the License to provide to third parties, for a fee or other consideration (including +# without limitation fees for hosting or consulting/ support services related to the Software), a +# product or service whose value derives, entirely or substantially, from the functionality of the +# Software. Any license notice or attribution required by the License must also include this +# Commons Clause License Condition notice. +# +# Software: Infinitic +# +# License: MIT License (https://opensource.org/licenses/MIT) +# +# Licensor: infinitic.io + +version: "1.0" +linter: jetbrains/qodana-jvm:2025.1 +profile: + name: qodana.recommended +include: + - name: CheckDependencyLicenses \ No newline at end of file