Add Linux, Windows and MacOS targets

This commit is contained in:
Avently 2021-03-25 15:22:53 +03:00 committed by Michael Bull
parent 52bc1a5c0f
commit c4c70b4d98
7 changed files with 82 additions and 10 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest, macos-latest ] os: [ ubuntu-latest, macos-latest, windows-latest ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -31,42 +31,57 @@ jobs:
with: with:
java-version: 1.8 java-version: 1.8
- run: ./gradlew check - run: ./gradlew linuxX64Test
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
- run: ./gradlew iosX64Test - run: ./gradlew mingwX64Test
if: matrix.os == 'windows-latest'
- run: ./gradlew check
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
publish: publish:
needs: check needs: check
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && needs.check.result == 'success' if: github.ref == 'refs/heads/master' && github.event_name == 'push' && needs.check.result == 'success'
runs-on: macos-latest runs-on: ${{ matrix.os }}
steps: strategy:
- uses: actions/checkout@v2 matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
- uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: ./gradlew publish
env: env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
restore-keys: |
${{ runner.os }}-gradle-wrapper-
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- uses: actions/setup-java@v1
with:
java-version: 1.8
- run: ./gradlew publishLinuxX64PublicationToMavenRepository
if: matrix.os == 'ubuntu-latest'
- run: ./gradlew publishMingwX64PublicationToMavenRepository
if: matrix.os == 'windows-latest'
- run: ./gradlew publish
if: matrix.os == 'macos-latest'

View File

@ -73,6 +73,9 @@ subprojects {
} }
ios() ios()
linuxX64()
mingwX64()
macosX64()
} }
} }

View File

@ -2,3 +2,5 @@ kotlin.code.style=official
group=com.michael-bull.kotlin-result group=com.michael-bull.kotlin-result
version=1.1.12-SNAPSHOT version=1.1.12-SNAPSHOT
kotlin.native.ignoreDisabledTargets=true

View File

@ -39,6 +39,30 @@ kotlin {
implementation(kotlin("test-js")) 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)
}
} }
} }

View File

@ -21,6 +21,10 @@ kotlin {
} }
} }
val commonMain by getting {
}
val commonTest by getting { val commonTest by getting {
dependencies { dependencies {
implementation(kotlin("test-common")) implementation(kotlin("test-common"))
@ -40,6 +44,30 @@ kotlin {
implementation(kotlin("test-js")) 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)
}
} }
} }