diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..f9dcf3b --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,60 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: KMP CI with Gradle + +on: +# push: +# branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + workflow_call: + +permissions: + contents: read + +jobs: + build: + strategy: + matrix: + include: + - target: iosSimulatorArm64Test + os: macos-latest + - target: commonJvmTest + os: ubuntu-latest + - target: linuxTest + os: ubuntu-latest + - target: testDebugUnitTest + os: ubuntu-latest + - target: testReleaseUnitTest + os: ubuntu-latest + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.konan + key: ${{ runner.os }}-${{ hashFiles('**/.lock') }} + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@ce999babab2de1c4b649dc15f0ee67e6246c994f + with: + arguments: ${{ matrix.target }} + - name: Maven Local Publishing + run: ./gradlew publishToMavenLocal --no-configuration-cache + env: + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }} \ No newline at end of file diff --git a/README.md b/README.md index aff4e23..aedd43f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can include the library from either Maven Central or Jitpack. You can include the library in the common source set like this: ```kotlin dependencies { - implementation("io.github.kotlingeekdev:rhodium:1.0-beta-16") + implementation("io.github.kotlingeekdev:rhodium:1.0-beta-17") } ``` @@ -74,7 +74,7 @@ then, in your module's `build.gradle(.kts)`, you need to add: // build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-16") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium:1.0-beta-17") } @@ -85,7 +85,7 @@ If you're including it in an Android app, you can just add: // app/build.gradle.kts dependencies { //... - implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-16") + implementation("com.github.KotlinGeekDev.Rhodium:rhodium-android:1.0-beta-17") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index c0cf1b9..c98b228 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { plugins { kotlin("multiplatform") version "2.0.20" apply false id("com.android.library") version "8.2.2" apply false - id("org.jetbrains.kotlinx.atomicfu") version "0.25.0" + id("org.jetbrains.kotlinx.atomicfu") version "0.26.1" id("com.vanniktech.maven.publish") version "0.30.0" //id("org.jetbrains.kotlin.android") version "2.0.0" apply false //id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" apply false @@ -31,7 +31,7 @@ allprojects { val isJitpack = System.getenv("JITPACK") == "true" group = "io.github.kotlingeekdev" - version = "1.0-beta-16" + version = "1.0-beta-17" // val javadocJar = tasks.register("javadocJar") { @@ -55,7 +55,7 @@ allprojects { pom { name = "Rhodium" description = " A Kotlin Multiplatform library for Nostr" - url = "https://github.com/KotlinGeekDev/Ballast" + url = "https://github.com/KotlinGeekDev/Rhodium" licenses { license { diff --git a/rhodium-core/build.gradle.kts b/rhodium-core/build.gradle.kts index 603514e..8736873 100644 --- a/rhodium-core/build.gradle.kts +++ b/rhodium-core/build.gradle.kts @@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile val kotlinVersion = "2.0.20" -val ktorVersion = "3.0.1" +val ktorVersion = "2.3.13" val kotlinCryptoVersion = "0.4.0" val junitJupiterVersion = "5.10.1" @@ -93,11 +93,26 @@ kotlin { } //Apple targets - macosX64() - macosArm64() - iosX64() - iosArm64() - iosSimulatorArm64() + val macosX64 = macosX64() + val macosArm64 = macosArm64() + val iosArm64 = iosArm64() + val iosX64 = iosX64() + val iosSimulatorArm64 = iosSimulatorArm64() + val appleTargets = listOf( + macosX64, macosArm64, + iosArm64, iosX64, iosSimulatorArm64, + ) + + appleTargets.forEach { target -> + with(target) { + binaries { + framework { + baseName = "Rhodium" + } + } + } + } + applyDefaultHierarchyTemplate() @@ -122,7 +137,7 @@ kotlin { //Coroutines implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") //Atomics - implementation("org.jetbrains.kotlinx:atomicfu:0.25.0") + implementation("org.jetbrains.kotlinx:atomicfu:0.26.1") //Date-time implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1") //UUID @@ -179,12 +194,14 @@ kotlin { } androidUnitTest.configure { + dependsOn(commonJvmTest) dependencies { implementation("junit:junit:4.13.2") } } androidInstrumentedTest.configure { + dependsOn(commonJvmTest) dependencies { implementation("androidx.test.ext:junit:1.2.1") implementation("androidx.test.espresso:espresso-core:3.6.1") @@ -213,8 +230,14 @@ kotlin { implementation("dev.whyoleg.cryptography:cryptography-provider-apple:$kotlinCryptoVersion") } } - macosMain.get().dependsOn(appleMain.get()) - iosMain.get().dependsOn(appleMain.get()) + appleTest.configure { + dependsOn(commonTest.get()) + } + + appleTargets.forEach { target -> + getByName("${target.targetName}Main") { dependsOn(appleMain.get()) } + getByName("${target.targetName}Test") { dependsOn(appleTest.get()) } + } } } diff --git a/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt b/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt index 51cd22d..3936d77 100644 --- a/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt +++ b/rhodium-core/src/commonTest/kotlin/rhodium/nostr/NostrTests.kt @@ -93,6 +93,6 @@ class NostrTests { println(event) println("Correct Event:") println(correctlyParsedEvent) - assertEquals(correctlyParsedEvent, event) + assertEquals(correctlyParsedEvent.toString(), event.toString()) } } \ No newline at end of file