diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4bfb4f5..ebc1c65 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ jobs: build-and-publish: runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: "Set Up JDK" - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: corretto java-version: 17 @@ -26,13 +26,17 @@ jobs: shell: bash - name: "Decode GPG Key" + env: + RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} run: | - echo "${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}" > ~/.gradle/secring.gpg.b64 + echo "$RING_FILE" > ~/.gradle/secring.gpg.b64 base64 --decode -i ~/.gradle/secring.gpg.b64 -o ~/.gradle/secring.gpg shell: bash - name: "Publish" - run: ./gradlew publishAllPublicationsToMavenCentralRepository -Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) + run: ./gradlew publishToMavenCentral -Psigning.keyId=$KEY_ID -Psigning.password=$PASSWORD -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) env: - MAVEN_TOKEN_USERNAME: ${{ secrets.MAVEN_TOKEN_USERNAME }} - MAVEN_TOKEN_PASSWORD: ${{ secrets.MAVEN_TOKEN_PASSWORD }} \ No newline at end of file + KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_TOKEN_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_TOKEN_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 53a9213..949ac37 100755 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,10 +11,10 @@ jobs: checks: write pull-requests: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: "Set Up JDK" - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: corretto java-version: 17 @@ -32,7 +32,7 @@ jobs: shell: bash - name: "Tests Report" - uses: dorny/test-reporter@v2 + uses: dorny/test-reporter@ee446707ff3bdadb3c039ff1af4286a09acb79c6 if: success() || failure() with: name: jUnit Tests @@ -45,7 +45,7 @@ jobs: shell: bash - name: "Coverage Report" - uses: mi-kas/kover-report@v1 + uses: mi-kas/kover-report@624c610e0c054a270ce07a40972c643261c513bb if: ${{ github.event_name == 'pull_request' }} with: path: | diff --git a/build.gradle.kts b/build.gradle.kts index ea42c12..75125c2 100755 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,12 @@ tasks.wrapper { - gradleVersion = "8.14.2" + gradleVersion = "9.2.1" } allprojects { group = "com.ucasoft.ktor" - version = "0.55.3" + version = "0.57.7" repositories { mavenCentral() diff --git a/buildSrc/src/main/kotlin/Dependensies.kt b/buildSrc/src/main/kotlin/Dependensies.kt index 4227b7e..edb9315 100755 --- a/buildSrc/src/main/kotlin/Dependensies.kt +++ b/buildSrc/src/main/kotlin/Dependensies.kt @@ -1,7 +1,7 @@ import org.gradle.api.Project -const val ktorVersion = "3.2.0" -const val kotestVersion = "5.9.1" +const val ktorVersion = "3.3.3" +const val kotestVersion = "6.0.7" fun Project.ktor(module: String) = "io.ktor:ktor-$module:$ktorVersion" @@ -9,6 +9,4 @@ fun Project.ktorClient(module: String) = ktor("client-$module") fun Project.ktorServer(module: String) = ktor("server-$module") -fun Project.kotest(module: String, version: String = kotestVersion) = "io.kotest:kotest-$module:$version" - -fun Project.kotestEx(module: String, version: String) = "io.kotest.extensions:kotest-$module:$version" \ No newline at end of file +fun Project.kotest(module: String, version: String = kotestVersion) = "io.kotest:kotest-$module:$version" \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/PublishingExtension.kt b/buildSrc/src/main/kotlin/PublishingExtension.kt index 812c782..3be572a 100644 --- a/buildSrc/src/main/kotlin/PublishingExtension.kt +++ b/buildSrc/src/main/kotlin/PublishingExtension.kt @@ -1,7 +1,26 @@ -import org.gradle.api.model.ObjectFactory -import org.gradle.kotlin.dsl.property +import org.gradle.api.publish.maven.MavenPom -open class PublishingExtension(factory: ObjectFactory) { - val name = factory.property() - val description = factory.property() + +fun configurePom(name: String, description: String, pom: MavenPom) { + pom.name.set(name) + pom.description.set(description) + pom.url.set("https://github.com/Scogun/ktor-simple-cache") + pom.licenses { + license { + this.name.set("The Apache License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + pom.developers { + developer { + id.set("Scogun") + this.name.set("Sergey Antonov") + email.set("SAntonov@ucasoft.com") + } + } + pom.scm { + connection.set("scm:git:git://github.com/Scogun/ktor-simple-cache.git") + developerConnection.set("scm:git:ssh://github.com:Scogun/ktor-simple-cache.git") + url.set("https://github.com/Scogun/ktor-simple-cache") + } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/publish.gradle.kts b/buildSrc/src/main/kotlin/publish.gradle.kts deleted file mode 100644 index 6bb73c4..0000000 --- a/buildSrc/src/main/kotlin/publish.gradle.kts +++ /dev/null @@ -1,62 +0,0 @@ -plugins { - `maven-publish` - signing -} - -val libraryData = extensions.create("libraryData", PublishingExtension::class) - -val stubJavadoc by tasks.creating(Jar::class) { - archiveClassifier.set("javadoc") -} - -publishing { - publications.configureEach { - if (this is MavenPublication) { - if (name != "kotlinMultiplatform") { - artifact(stubJavadoc) - } - pom { - name.set(libraryData.name) - description.set(libraryData.description) - url.set("https://github.com/Scogun/ktor-simple-cache") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("Scogun") - name.set("Sergey Antonov") - email.set("SAntonov@ucasoft.com") - } - } - scm { - connection.set("scm:git:git://github.com/Scogun/ktor-simple-cache.git") - developerConnection.set("scm:git:ssh://github.com:Scogun/ktor-simple-cache.git") - url.set("https://github.com/Scogun/ktor-simple-cache") - } - } - } - } - repositories { - maven { - name = "MavenCentral" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = System.getenv("MAVEN_TOKEN_USERNAME") - password = System.getenv("MAVEN_TOKEN_PASSWORD") - } - } - } -} - -signing { - sign(publishing.publications) -} - -tasks.withType().configureEach { - val signingTasks = tasks.withType() - mustRunAfter(signingTasks) -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff23a68..23449a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f3b75f3..23d15a9 100644 --- a/gradlew +++ b/gradlew @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -205,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a21..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/ktor-simple-cache/README.md b/ktor-simple-cache/README.md index 59b731c..7e450fb 100755 --- a/ktor-simple-cache/README.md +++ b/ktor-simple-cache/README.md @@ -1,7 +1,7 @@ # Ktor Simple Cache Base solution which provides the plugin implementation and abstract class for cache providers. -[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-cache/0.55.3?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-cache/0.55.3/jar) +[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-cache/0.57.7?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-cache/0.57.7/jar) ## Setup ### Gradle ```kotlin @@ -9,7 +9,7 @@ repositories { mavenCentral() } -implementation("com.ucasoft.ktor:ktor-simple-cache:0.55.3") +implementation("com.ucasoft.ktor:ktor-simple-cache:0.57.7") ``` ## Usage ```kotlin diff --git a/ktor-simple-cache/build.gradle.kts b/ktor-simple-cache/build.gradle.kts index 2bc0af5..2c23c42 100755 --- a/ktor-simple-cache/build.gradle.kts +++ b/ktor-simple-cache/build.gradle.kts @@ -2,7 +2,7 @@ plugins { kotlin("multiplatform") kotlin("plugin.serialization") apply false id("org.jetbrains.kotlinx.kover") - id("publish") + id("com.vanniktech.maven.publish") } kotlin { @@ -26,15 +26,19 @@ kotlin { implementation(kotlin("test")) implementation(ktorServer("test-host")) implementation(kotest("assertions-core")) - implementation(kotestEx("assertions-ktor", "2.0.0")) - implementation("org.mockito.kotlin:mockito-kotlin:5.4.0") + implementation(kotest("assertions-ktor")) + implementation("org.mockito.kotlin:mockito-kotlin:6.1.0") } kotlin.srcDir("src/test/kotlin") } } } -libraryData { - name.set("Ktor Simple Cache") - description.set("Base realization of simple output cache for Ktor server") +mavenPublishing { + publishToMavenCentral() + signAllPublications() + + pom { + configurePom("Ktor Simple Cache", "Base realization of simple output cache for Ktor server", this) + } } \ No newline at end of file diff --git a/ktor-simple-memory-cache/README.md b/ktor-simple-memory-cache/README.md index 529022f..8b422b9 100755 --- a/ktor-simple-memory-cache/README.md +++ b/ktor-simple-memory-cache/README.md @@ -1,7 +1,7 @@ # Ktor Simple Memory Cache Memory cache provider for Ktor Simple Cache plugin -[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-memory-cache/0.55.3?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-memory-cache/0.55.3/jar) +[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-memory-cache/0.57.7?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-memory-cache/0.57.7/jar) ## Setup ### Gradle ```kotlin @@ -9,7 +9,7 @@ repositories { mavenCentral() } -implementation("com.ucasoft.ktor:ktor-simple-memory-cache:0.55.3") +implementation("com.ucasoft.ktor:ktor-simple-memory-cache:0.57.7") ``` ## Usage ```kotlin diff --git a/ktor-simple-memory-cache/build.gradle.kts b/ktor-simple-memory-cache/build.gradle.kts index bdfeba7..cd087e4 100755 --- a/ktor-simple-memory-cache/build.gradle.kts +++ b/ktor-simple-memory-cache/build.gradle.kts @@ -2,7 +2,7 @@ plugins { kotlin("multiplatform") kotlin("plugin.serialization") id("org.jetbrains.kotlinx.kover") - id("publish") + id("com.vanniktech.maven.publish") } kotlin { @@ -14,11 +14,10 @@ kotlin { val commonMain by getting { dependencies { implementation(project(":ktor-simple-cache")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2") } kotlin.srcDir("src/main/kotlin") } - val commonTest by getting { + val jvmTest by getting { dependencies { implementation(kotlin("test")) implementation(ktorServer("test-host")) @@ -26,14 +25,18 @@ kotlin { implementation(ktorServer("content-negotiation")) implementation(ktor("serialization-kotlinx-json")) implementation(kotest("assertions-core")) - implementation(kotestEx("assertions-ktor", "2.0.0")) + implementation(kotest("assertions-ktor")) } kotlin.srcDir("src/test/kotlin") } } } -libraryData { - name.set("Ktor Simple Memory Cache") - description.set("Memory cache provider for Simple Cache plugin") +mavenPublishing { + publishToMavenCentral() + signAllPublications() + + pom { + configurePom("Ktor Simple Memory Cache", "Memory cache provider for Simple Cache plugin", this) + } } \ No newline at end of file diff --git a/ktor-simple-memory-cache/src/main/kotlin/com/ucasoft/ktor/simpleMemoryCache/SimpleMemoryCacheProvider.kt b/ktor-simple-memory-cache/src/main/kotlin/com/ucasoft/ktor/simpleMemoryCache/SimpleMemoryCacheProvider.kt index cf2eb4d..2fbfb00 100755 --- a/ktor-simple-memory-cache/src/main/kotlin/com/ucasoft/ktor/simpleMemoryCache/SimpleMemoryCacheProvider.kt +++ b/ktor-simple-memory-cache/src/main/kotlin/com/ucasoft/ktor/simpleMemoryCache/SimpleMemoryCacheProvider.kt @@ -2,9 +2,9 @@ package com.ucasoft.ktor.simpleMemoryCache import com.ucasoft.ktor.simpleCache.SimpleCacheConfig import com.ucasoft.ktor.simpleCache.SimpleCacheProvider -import kotlinx.datetime.Clock -import kotlinx.datetime.Instant +import kotlin.time.Clock import kotlin.time.Duration +import kotlin.time.Instant class SimpleMemoryCacheProvider(config: Config) : SimpleCacheProvider(config) { diff --git a/ktor-simple-redis-cache/README.md b/ktor-simple-redis-cache/README.md index 6709316..f062e9d 100755 --- a/ktor-simple-redis-cache/README.md +++ b/ktor-simple-redis-cache/README.md @@ -1,7 +1,7 @@ # Ktor Simple Redis Cache Redis cache provider for Ktor Simple Cache plugin -[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-redis-cache/0.55.3?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-redis-cache/0.55.3/jar) +[![Maven Central with version prefix filter](https://img.shields.io/maven-central/v/com.ucasoft.ktor/ktor-simple-redis-cache/0.57.7?color=blue)](https://search.maven.org/artifact/com.ucasoft.ktor/ktor-simple-redis-cache/0.57.7/jar) ## Setup ### Gradle ```kotlin @@ -9,7 +9,7 @@ repositories { mavenCentral() } -implementation("com.ucasoft.ktor:ktor-simple-redis-cache:0.55.3") +implementation("com.ucasoft.ktor:ktor-simple-redis-cache:0.57.7") ``` ## Usage ```kotlin diff --git a/ktor-simple-redis-cache/build.gradle.kts b/ktor-simple-redis-cache/build.gradle.kts index f490c06..b900744 100755 --- a/ktor-simple-redis-cache/build.gradle.kts +++ b/ktor-simple-redis-cache/build.gradle.kts @@ -2,7 +2,7 @@ plugins { kotlin("multiplatform") kotlin("plugin.serialization") id("org.jetbrains.kotlinx.kover") - id("publish") + id("com.vanniktech.maven.publish") } kotlin { @@ -16,28 +16,33 @@ kotlin { val jvmMain by getting { dependencies { implementation(project(":ktor-simple-cache")) - implementation("redis.clients:jedis:6.0.0") - implementation("com.google.code.gson:gson:2.13.1") + implementation("redis.clients:jedis:7.2.0") + implementation("com.google.code.gson:gson:2.13.2") } kotlin.srcDir("src/main/kotlin") } val jvmTest by getting { dependencies { - implementation("com.redis.testcontainers:testcontainers-redis-junit:1.6.4") + implementation("com.redis:testcontainers-redis:1.7.0") + implementation("org.testcontainers:junit-jupiter:1.21.4") implementation(kotlin("test")) implementation(ktorServer("test-host")) implementation(ktorClient("content-negotiation")) implementation(ktorServer("content-negotiation")) implementation(ktor("serialization-kotlinx-json")) implementation(kotest("assertions-core")) - implementation(kotestEx("assertions-ktor", "2.0.0")) + implementation(kotest("assertions-ktor")) } kotlin.srcDir("src/test/kotlin") } } } -libraryData { - name.set("Ktor Simple Redis Cache") - description.set("Redis cache provider for Simple Cache plugin") +mavenPublishing { + publishToMavenCentral() + signAllPublications() + + pom { + configurePom("Ktor Simple Redis Cache", "Redis cache provider for Simple Cache plugin", this) + } } \ No newline at end of file diff --git a/ktor-simple-redis-cache/src/test/kotlin/com/ucasoft/ktor/simpleRedisCache/RedisCacheTests.kt b/ktor-simple-redis-cache/src/test/kotlin/com/ucasoft/ktor/simpleRedisCache/RedisCacheTests.kt index 5e839e7..aa98874 100644 --- a/ktor-simple-redis-cache/src/test/kotlin/com/ucasoft/ktor/simpleRedisCache/RedisCacheTests.kt +++ b/ktor-simple-redis-cache/src/test/kotlin/com/ucasoft/ktor/simpleRedisCache/RedisCacheTests.kt @@ -17,12 +17,12 @@ import io.ktor.server.testing.* import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.runBlocking -import org.junit.jupiter.api.AfterAll -import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import org.testcontainers.junit.jupiter.Container +import org.testcontainers.junit.jupiter.Testcontainers import kotlin.time.Duration.Companion.seconds +@Testcontainers internal class RedisCacheTests { @Test @@ -104,19 +104,5 @@ internal class RedisCacheTests { @Container val redisContainer = RedisContainer(DEFAULT_IMAGE_NAME) - - @JvmStatic - @BeforeAll - fun setup() { - redisContainer.start() - } - - @JvmStatic - @AfterAll - fun tearDown() { - if (redisContainer.isRunning) { - redisContainer.stop() - } - } } } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 12ffefa..a6d226f 100755 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,10 +1,11 @@ pluginManagement { resolutionStrategy { plugins { - val kotlinVersion = "2.1.21" + val kotlinVersion = "2.3.0" kotlin("multiplatform") version kotlinVersion apply false kotlin("plugin.serialization") version kotlinVersion apply false - id("org.jetbrains.kotlinx.kover") version "0.9.1" apply false + id("org.jetbrains.kotlinx.kover") version "0.9.4" apply false + id("com.vanniktech.maven.publish") version "0.35.0" apply false } } }