Skip to content

Commit

Permalink
Update template: codecov + kover + binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Aug 6, 2024
1 parent 0217732 commit 885ee34
Show file tree
Hide file tree
Showing 10 changed files with 2,268 additions and 25 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/CODECOV.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CODECOV
# https://docs.github.com/en/actions/learn-github-actions/expressions

on:
push:
branches: [ main, 'release/**' ]
pull_request:
branches: [ main, 'release/**' ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CI: true

JAVA_VERSION: 17
JAVA_DISTRIBUTION: zulu

jobs:
test:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- { uses: actions/checkout@v4 }
- { name: Use Node.js 20.x, uses: actions/setup-node@v4, with: { node-version: 20.x } }
- { name: Setup Deno, uses: denoland/setup-deno@v1, with: { deno-version: "1.44.4" } }
- { name: Replace gradle wrapper, run: "sed 's/-all/-bin/g' gradle/wrapper/gradle-wrapper.properties > gradle/wrapper/gradle-wrapper.properties.bak; cp gradle/wrapper/gradle-wrapper.properties.bak gradle/wrapper/gradle-wrapper.properties" }
- { name: Set up JDK, uses: actions/setup-java@v4, with: { distribution: "${{ env.JAVA_DISTRIBUTION }}", java-version: "${{ env.JAVA_VERSION }}" } }
- { name: Prepare Gradle, uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 } # https://github.com/gradle/actions/releases/tag/v3.5.0
- { name: Start gradle, run: ./gradlew }
- { name: Code coverage, run: ./gradlew koverXmlReport }
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
#- { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsNodeTest jsBrowserTest" }
- { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsBrowserTest jsDenoTest" }
- { outputKey: testAndroid, os: ubuntu-latest, enableAndroid: true }
- { outputKey: testJvmMacos, os: macos-latest, testTask: jvmTest }
- { outputKey: testJvmMacos, os: macos-latest, testTask: jvmTest apiCheck }
- { outputKey: testJvmLinux, os: ubuntu-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm, enableKotlinNative: true, enableSandbox: true, e2e: true }
- { outputKey: testJvmWindows, os: windows-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm }
#if: ${{ needs.changes.outputs[matrix.outputKey] == 'true' }}
Expand Down
58 changes: 40 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import java.util.concurrent.*
plugins {
kotlin("multiplatform") version "2.0.0"
id("com.android.library") version "8.2.2"
id("org.jetbrains.kotlinx.kover") version "0.8.3" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.2"
id("org.jetbrains.dokka") version "1.9.20"
`maven-publish`
signing
Expand All @@ -32,7 +34,10 @@ var REAL_VERSION = System.getenv("FORCED_VERSION")

//val REAL_VERSION = System.getenv("FORCED_VERSION") ?: "999.0.0.999"

//val JVM_TARGET = JvmTarget.JVM_1_8
//val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8
val JVM_TARGET = JvmTarget.JVM_1_8
val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8
val GROUP = "com.soywiz"

kotlin {
Expand All @@ -55,7 +60,29 @@ allprojects {
project.apply(plugin = "kotlin-multiplatform")
project.apply(plugin = "android-library")

java.toolchain.languageVersion = JavaLanguageVersion.of(JDK_VERSION.majorVersion)
kotlin.jvmToolchain(JDK_VERSION.majorVersion.toInt())
afterEvaluate {
tasks.withType(Test::class) {
//this.javaLauncher.set()
this.javaLauncher.set(javaToolchains.launcherFor {
// 17 is latest at the current moment
languageVersion.set(JavaLanguageVersion.of(JDK_VERSION.majorVersion))
})
}
}

kotlin {
androidTarget {
this.compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}
}

android {
compileOptions {
sourceCompatibility = JDK_VERSION
targetCompatibility = JDK_VERSION
}
//signingConfigs {
// debug {
// […]
Expand Down Expand Up @@ -343,19 +370,6 @@ subprojects {
apply(plugin = "maven-publish")
apply(plugin = "signing")

//val JDK_VERSION = 8
//java.toolchain.languageVersion = JavaLanguageVersion.of(JDK_VERSION)
//kotlin.jvmToolchain(JDK_VERSION)
//afterEvaluate {
// tasks.withType(Test::class) {
// //this.javaLauncher.set()
// this.javaLauncher.set(javaToolchains.launcherFor {
// // 17 is latest at the current moment
// languageVersion.set(JavaLanguageVersion.of(JDK_VERSION))
// })
// }
//}

kotlin {
js {
//nodejs()
Expand Down Expand Up @@ -1113,11 +1127,14 @@ allprojects {
afterEvaluate {
tasks.withType(org.gradle.api.tasks.testing.Test::class) {
//println("TEST-TASK: $this")
jvmArgs(
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
//"--add-opens", "java.base/jdk.incubator.foreign=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
)
if (JDK_VERSION.majorVersion.toInt() >= 9) {
jvmArgs(
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
//"--add-opens", "java.base/jdk.incubator.foreign=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
)
}
}
}
}
Expand All @@ -1126,6 +1143,7 @@ allprojects {

subprojects {
plugins.apply("org.jetbrains.dokka")
plugins.apply("org.jetbrains.kotlinx.kover")
}

allprojects {
Expand All @@ -1134,3 +1152,7 @@ allprojects {
offlineMode.set(true)
}
}

apiValidation {
ignoredProjects.addAll(listOf(rootProject.name))
}
Empty file.
5 changes: 5 additions & 0 deletions korlibs-ffi-ksp/api/jvm/korlibs-ffi-ksp.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public final class korlibs/ffi/ksp/FFIBuilderProcessorProvider : com/google/devtools/ksp/processing/SymbolProcessorProvider {
public fun <init> ()V
public fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lcom/google/devtools/ksp/processing/SymbolProcessor;
}

Loading

0 comments on commit 885ee34

Please sign in to comment.