Skip to content
Open
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
51 changes: 51 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -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'
78 changes: 40 additions & 38 deletions publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=
Expand Down Expand Up @@ -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() }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) ===

Expand Down
27 changes: 27 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading