From c4c70b4d984c96693fe49ad5fa25035a6d99c965 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Thu, 25 Mar 2021 15:22:53 +0300 Subject: [PATCH] Add Linux, Windows and MacOS targets --- .github/workflows/ci.yaml | 35 +++++++++++++------ build.gradle.kts | 3 ++ gradle.properties | 2 ++ kotlin-result-coroutines/build.gradle.kts | 24 +++++++++++++ .../result/coroutines/RunBlockingTest.kt | 0 kotlin-result/build.gradle.kts | 28 +++++++++++++++ .../michaelbull/result/BindException.kt | 0 7 files changed, 82 insertions(+), 10 deletions(-) rename kotlin-result-coroutines/src/{iosTest => nativeTest}/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt (100%) rename kotlin-result/src/{iosMain => nativeMain}/kotlin/com/github/michaelbull/result/BindException.kt (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a2a7608..5c48aaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-latest, macos-latest, windows-latest ] steps: - uses: actions/checkout@v2 @@ -31,16 +31,30 @@ jobs: with: java-version: 1.8 - - run: ./gradlew check + - run: ./gradlew linuxX64Test if: matrix.os == 'ubuntu-latest' - - run: ./gradlew iosX64Test + - run: ./gradlew mingwX64Test + if: matrix.os == 'windows-latest' + + - run: ./gradlew check if: matrix.os == 'macos-latest' publish: needs: check if: github.ref == 'refs/heads/master' && github.event_name == 'push' && needs.check.result == 'success' - runs-on: macos-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + + env: + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} steps: - uses: actions/checkout@v2 @@ -63,10 +77,11 @@ jobs: with: java-version: 1.8 + - run: ./gradlew publishLinuxX64PublicationToMavenRepository + if: matrix.os == 'ubuntu-latest' + + - run: ./gradlew publishMingwX64PublicationToMavenRepository + if: matrix.os == 'windows-latest' + - run: ./gradlew publish - env: - ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} - ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} - ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + if: matrix.os == 'macos-latest' diff --git a/build.gradle.kts b/build.gradle.kts index 92d03c9..83c6d6b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,6 +73,9 @@ subprojects { } ios() + linuxX64() + mingwX64() + macosX64() } } diff --git a/gradle.properties b/gradle.properties index 40a8d5c..8483753 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,3 +2,5 @@ kotlin.code.style=official group=com.michael-bull.kotlin-result version=1.1.12-SNAPSHOT + +kotlin.native.ignoreDisabledTargets=true diff --git a/kotlin-result-coroutines/build.gradle.kts b/kotlin-result-coroutines/build.gradle.kts index d1b7999..51065df 100644 --- a/kotlin-result-coroutines/build.gradle.kts +++ b/kotlin-result-coroutines/build.gradle.kts @@ -39,6 +39,30 @@ kotlin { implementation(kotlin("test-js")) } } + + val nativeTest by creating { + dependsOn(commonTest) + } + + val linuxX64Test by getting { + dependsOn(nativeTest) + } + + val mingwX64Test by getting { + dependsOn(nativeTest) + } + + val macosX64Test by getting { + dependsOn(nativeTest) + } + + val iosX64Test by getting { + dependsOn(nativeTest) + } + + val iosArm64Test by getting { + dependsOn(nativeTest) + } } } diff --git a/kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt b/kotlin-result-coroutines/src/nativeTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt similarity index 100% rename from kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt rename to kotlin-result-coroutines/src/nativeTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt diff --git a/kotlin-result/build.gradle.kts b/kotlin-result/build.gradle.kts index 453338e..8433f0a 100644 --- a/kotlin-result/build.gradle.kts +++ b/kotlin-result/build.gradle.kts @@ -21,6 +21,10 @@ kotlin { } } + val commonMain by getting { + + } + val commonTest by getting { dependencies { implementation(kotlin("test-common")) @@ -40,6 +44,30 @@ kotlin { implementation(kotlin("test-js")) } } + + val nativeMain by creating { + dependsOn(commonMain) + } + + val linuxX64Main by getting { + dependsOn(nativeMain) + } + + val mingwX64Main by getting { + dependsOn(nativeMain) + } + + val macosX64Main by getting { + dependsOn(nativeMain) + } + + val iosX64Main by getting { + dependsOn(nativeMain) + } + + val iosArm64Main by getting { + dependsOn(nativeMain) + } } } diff --git a/kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt b/kotlin-result/src/nativeMain/kotlin/com/github/michaelbull/result/BindException.kt similarity index 100% rename from kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt rename to kotlin-result/src/nativeMain/kotlin/com/github/michaelbull/result/BindException.kt