Skip to content

Commit

Permalink
Setup check for published artifacts on release
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Nov 6, 2020
1 parent a98e0c2 commit 3e6ab7b
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 17 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,35 @@ jobs:
uses: eskatos/gradle-command-action@v1
with:
arguments: bintrayUpload -PbintrayUser=${{ secrets.bintrayUser }} -PbintrayKey=${{ secrets.bintrayKey }} -PsonatypeUsername=${{ secrets.sonatypeUsername }} -PsonatypePassword=${{ secrets.sonatypePassword }} -Pversion=${{ env.TAG_NAME }} -PbuildNumber=${{ github.run_number }} --stacktrace --no-daemon

check:
needs: publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-latest, windows-latest ]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-2
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.*') }} #hash based on *.gradle.kts and *.gradle.properties
restore-keys: ${{ runner.os }}-gradle
- if: ${{ matrix.os == 'windows-latest' }}
run: echo ("::set-env name=TAG_NAME::" + $env:GITHUB_REF.replace('refs/tags/', ''))
- if: ${{ matrix.os != 'windows-latest' }}
run: echo "##[set-env name=TAG_NAME;]$(echo ${GITHUB_REF#refs/tags/})"
- name: Publish Packages to Bintray
uses: eskatos/gradle-command-action@v1
with:
arguments: publish-check:build -PpublishCheckVersion=${{ env.TAG_NAME }} --info --no-daemon

11 changes: 7 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ subprojects {

//disable compilation of part of mac targets
if (HostManager.hostIsMac) when (macTargetsCompilation) {
"macos" -> iosTargets + tvosTargets + watchosTargets
"macos" -> iosTargets + tvosTargets + watchosTargets
"ios", "watchos", "tvos" -> {
//disable test compilation for macos, but leave main to compile examples and playground
macosX64 {
Expand All @@ -169,7 +169,7 @@ subprojects {
else -> emptyList()
}
}
else -> emptyList()
else -> emptyList()
}.forEach(KotlinNativeTarget::disableCompilation)

//run tests on release + mimalloc to reduce tests execution time
Expand All @@ -195,6 +195,9 @@ subprojects {

//common configuration
extensions.configure<KotlinMultiplatformExtension> {
val isTestProject = project.name == "rsocket-test"
val isLibProject = project.name.startsWith("rsocket")

sourceSets.all {
languageSettings.apply {
progressiveMode = true
Expand All @@ -203,7 +206,7 @@ subprojects {

useExperimentalAnnotation("kotlin.RequiresOptIn")

if (name.contains("test", ignoreCase = true) || project.name == "rsocket-test") {
if (name.contains("test", ignoreCase = true) || isTestProject) {
useExperimentalAnnotation("kotlin.time.ExperimentalTime")
useExperimentalAnnotation("kotlin.ExperimentalStdlibApi")

Expand All @@ -222,7 +225,7 @@ subprojects {
}
}

if (project.name != "rsocket-test") {
if (isLibProject && !isTestProject) {
explicitApiWarning() //TODO change to strict before release
sourceSets["commonTest"].dependencies {
implementation(project(":rsocket-test"))
Expand Down
5 changes: 2 additions & 3 deletions examples/interactions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.rsocket.kotlin:rsocket-core:0.11.5")
implementation("io.rsocket.kotlin:rsocket-transport-local:0.11.5")
implementation(project(":rsocket-core"))
implementation(project(":rsocket-transport-local"))
}
}
}
}

6 changes: 3 additions & 3 deletions examples/multiplatform-chat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.rsocket.kotlin:rsocket-core:0.11.5")
implementation(project(":rsocket-core"))

implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.0.0-RC")
}
Expand All @@ -56,13 +56,13 @@ kotlin {
val clientMain by creating {
dependsOn(commonMain)
dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor-client:0.11.5")
implementation(project(":rsocket-transport-ktor-client"))
}
}

val serverJvmMain by getting {
dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor-server:0.11.5")
implementation(project(":rsocket-transport-ktor-server"))
implementation("io.ktor:ktor-server-cio:1.4.1")
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs-tcp-transport/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kotlin {
sourceSets {
val jsMain by getting {
dependencies {
implementation("io.rsocket.kotlin:rsocket-core:0.11.5")
implementation(project(":rsocket-core"))
implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7")
}
}
Expand Down
88 changes: 88 additions & 0 deletions publish-check/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright 2015-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
kotlin("multiplatform")
}

val publishCheckVersion: String by project

kotlin {
//all targets depends on core and local transport

jvm() //depends on ktor client and server
js { //depends on ktor client
browser()
nodejs()
}

mingwX64() //depends only on common
val hostTargets = listOf(linuxX64(), macosX64())
val iosTargets = listOf(iosArm32(), iosArm64(), iosX64())
val tvosTargets = listOf(tvosArm64(), tvosX64())
val watchosTargets = listOf(watchosArm32(), watchosArm64(), watchosX86())
val nativeTargets = hostTargets + iosTargets + tvosTargets + watchosTargets //depends on ktor client

sourceSets {
val commonMain by getting {
dependencies {
implementation("io.rsocket.kotlin:rsocket-core:$publishCheckVersion")
implementation("io.rsocket.kotlin:rsocket-transport-local:$publishCheckVersion")

api(kotlin("test-common"))
api(kotlin("test-annotations-common"))
}
}

val nonWinCommonMain by creating {
dependsOn(commonMain)
dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor:$publishCheckVersion")
}
}

val clientMain by creating {
dependsOn(nonWinCommonMain)
dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor-client:$publishCheckVersion")
}
}

val jsMain by getting {
dependsOn(clientMain)
dependencies {
api(kotlin("test-js"))
}
}

val jvmMain by getting {
dependsOn(clientMain)
dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor-server:$publishCheckVersion")

api(kotlin("test-junit"))
}
}

val nativeMain by creating {
dependsOn(clientMain)
}

nativeTargets.forEach {
sourceSets["${it.name}Main"].dependsOn(nativeMain)
}
}
}
22 changes: 22 additions & 0 deletions publish-check/src/commonMain/kotlin/Stub.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2015-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import io.rsocket.kotlin.*
import io.rsocket.kotlin.payload.*

val rSocket = RSocketRequestHandler {
requestResponse { payload: Payload -> payload }
}
26 changes: 26 additions & 0 deletions publish-check/src/commonTest/kotlin/StubTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2015-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import io.rsocket.kotlin.payload.*
import io.rsocket.kotlin.*
import kotlin.test.*

class StubTest {
@Test
fun test() {
assertTrue(rSocket.isActive)
}
}
15 changes: 9 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ plugins {
id("com.gradle.enterprise") version "3.4.1"
}

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}

rootProject.name = "rsocket-kotlin"

include("benchmarks")
Expand All @@ -56,9 +63,5 @@ includeExample("nodejs-tcp-transport")
includeExample("interactions")
includeExample("multiplatform-chat")

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
val publishCheckVersion: String? by settings
if (publishCheckVersion != null) include("publish-check")

0 comments on commit 3e6ab7b

Please sign in to comment.