Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template: codecov + kover + binary compatibility #2

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows/APICHECK.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/CODECOV.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/DEPLOY.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
- { os: ubuntu-latest, publishTask: "publishAndroidDebugPublicationToMavenLocal publishAndroidReleasePublicationToMavenLocal" }
- { os: ubuntu-latest, publishTask: "publishKotlinMultiplatformPublicationToMavenLocal publishJvmPublicationToMavenLocal" }
- { os: ubuntu-latest, publishTask: "publishJsPublicationToMavenLocal publishWasmJsPublicationToMavenLocal" }
- { os: macos-latest, publishTask: "publishMacosX64PublicationToMavenLocal publishMacosArm64PublicationToMavenLocal" }
- { os: macos-latest, publishTask: "publishTvosArm64PublicationToMavenLocal publishTvosSimulatorArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal" }
- { os: macos-latest, publishTask: "publishIosArm64PublicationToMavenLocal publishIosSimulatorArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal" }
- { os: macos-latest, publishTask: "publishWatchosArm64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosDeviceArm64PublicationToMavenLocal publishWatchosSimulatorArm64PublicationToMavenLocal" }
- { os: macos-13, publishTask: "publishMacosX64PublicationToMavenLocal publishMacosArm64PublicationToMavenLocal" }
- { os: macos-13, publishTask: "publishTvosArm64PublicationToMavenLocal publishTvosSimulatorArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal" }
- { os: macos-13, publishTask: "publishIosArm64PublicationToMavenLocal publishIosSimulatorArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal" }
- { os: macos-13, publishTask: "publishWatchosArm64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosDeviceArm64PublicationToMavenLocal publishWatchosSimulatorArm64PublicationToMavenLocal" }
timeout-minutes: 300
runs-on: ${{ matrix.os }}
##needs: [start]
Expand Down
40 changes: 24 additions & 16 deletions .github/workflows/TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ name: TEST
on:
push:
branches: [ main, 'release/**' ]
paths:
- '**'
- '!**.gitignore'
- '!**.md'
- '!**.github/workflows/*'
- '**.github/workflows/TEST.yml'
pull_request:
branches: [ main, 'release/**' ]
paths:
- '**'
- '!**.gitignore'
- '!**.md'
- '!**.github/workflows/*'
- '**.github/workflows/TEST.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -20,19 +32,13 @@ env:
jobs:
test:
strategy:
fail-fast: true # Once working, comment this
#fail-fast: true # Once working, comment this
matrix:
include:
- { outputKey: testWindows, os: windows-latest, testTask: mingwX64Test, enableKotlinNative: true }
- { outputKey: testLinux, os: ubuntu-latest, testTask: linuxX64Test, buildTasks: publishLinuxArm64PublicationToMavenLocal, enableKotlinNative: true }
- { outputKey: testMacos, os: macos-latest, testTask: macosX64Test, buildTasks: publishMacosArm64PublicationToMavenLocal, enableKotlinNative: true }
- { outputKey: testIos, os: macos-latest, testTask: iosX64Test, enableKotlinNative: true }
#- { 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: testJvmLinux, os: ubuntu-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm, enableKotlinNative: true, enableSandbox: true, e2e: true }
- { outputKey: testJvmWindows, os: windows-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm }
- { outputKey: testMacosIos, os: macos-13, testTask: jvmTest macosX64Test iosX64Test, buildTasks: publishMacosArm64PublicationToMavenLocal }
- { outputKey: testJsAndroid, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsBrowserTest jsDenoTest", enableAndroid: true }
- { outputKey: testLinux, os: ubuntu-latest, testTask: apiCheck jvmTest linuxX64Test, precompileTask: compileTestKotlinJvm, e2e: true }
- { outputKey: testWindows, os: windows-latest, testTask: jvmTest mingwX64Test jsDenoTest, precompileTask: compileTestKotlinJvm, enableCodecov: true }
#if: ${{ needs.changes.outputs[matrix.outputKey] == 'true' }}
timeout-minutes: 30
runs-on: ${{ matrix.os }}
Expand All @@ -44,15 +50,17 @@ jobs:
- { 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 }
- { if: "${{ matrix.precompileTask }}", name: "Building ${{ matrix.precompileTask }} classes", run: "./gradlew --no-configuration-cache --stacktrace ${{ matrix.precompileTask }}" }
- { if: "${{ matrix.testTask }}", name: "Run ${{ matrix.testTask }} tests", run: "./gradlew --no-configuration-cache ${{ matrix.testTask }}" }
- { if: "${{ matrix.buildTasks }}", name: "Run ${{ matrix.buildTasks }}", run: "./gradlew --no-configuration-cache ${{ matrix.buildTasks }}" }
- { if: "${{ matrix.precompileTask }}", name: "Building ${{ matrix.precompileTask }} classes", run: "./gradlew --no-configuration-cache --stacktrace --build-cache ${{ matrix.precompileTask }}" }
- { if: "${{ matrix.enableCodecov }}", name: "Upload coverage reports to Codecov", uses: "codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673", with: { token: "${{ secrets.CODECOV_TOKEN }}" } } # https://github.com/codecov/codecov-action/releases/tag/v4.5.0
- { if: "${{ matrix.testTask }}", name: "Run ${{ matrix.testTask }} tests", run: "./gradlew --no-configuration-cache --build-cache ${{ matrix.testTask }}" }
- { if: "${{ matrix.buildTasks }}", name: "Run ${{ matrix.buildTasks }}", run: "./gradlew --no-configuration-cache --build-cache ${{ matrix.buildTasks }}" }
- name: Enable KVM
if: "${{ matrix.enableAndroid }}"
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- { name: "Run Android Tests", if: "${{ matrix.enableAndroid }}", uses: reactivecircus/android-emulator-runner@v2, with: { "api-level": 21, "script": "./gradlew --no-configuration-cache connectedCheck lintDebug" } }
- { name: "Run Android Tests", if: "${{ matrix.enableAndroid }}", uses: reactivecircus/android-emulator-runner@v2, with: { "api-level": 21, "script": "./gradlew --no-configuration-cache --build-cache connectedCheck lintDebug" } }
- { name: Archive Test Results, if: failure(), uses: actions/upload-artifact@v4, with: { name: "test-results-${{ matrix.outputKey }}", retention-days: 21, path: "**/build/reports", if-no-files-found: ignore } }
- { if: "${{ matrix.e2e }}", name: Publish to maven local, run: ./gradlew --no-configuration-cache publishJvmLocal publishKotlinMultiplatformPublicationToMavenLocal }
- { if: "${{ matrix.e2e }}", name: Publish to maven local, run: ./gradlew --no-configuration-cache --build-cache publishJvmLocal publishKotlinMultiplatformPublicationToMavenLocal }
- { name: Code coverage, run: ./gradlew --build-cache koverXmlReport }
60 changes: 40 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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" // apiDump / apiCheck
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.2"
id("org.jetbrains.dokka") version "1.9.20"
`maven-publish`
signing
Expand All @@ -35,6 +35,9 @@ 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_11
//val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_11
val GROUP = "com.soywiz"

kotlin {
Expand All @@ -57,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 @@ -166,6 +191,7 @@ open class DenoTestTask : AbstractTestTask() {
val process = ProcessBuilder(buildList<String> {
add("deno")
add("test")
add("--trace-ops")
add("--unstable-ffi")
add("--unstable-webgpu")
add("-A")
Expand Down Expand Up @@ -345,19 +371,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 @@ -973,10 +986,12 @@ class MicroAmper(val project: Project) {
main = maybeCreate("${name}Main").also {
it.kotlin.srcDirIfExists("src$atName")
it.resources.srcDirIfExists("resources$atName")
it.kotlin.srcDir("build/generated/ksp/$name/${name}Main/kotlin")
},
test = maybeCreate("${name}Test").also {
it.kotlin.srcDirIfExists("test$atName")
it.resources.srcDirIfExists("testResources$atName")
it.kotlin.srcDir("build/generated/ksp/$name/${name}Test/kotlin")
}
)
}
Expand All @@ -990,6 +1005,8 @@ class MicroAmper(val project: Project) {
ssDependsOn("appleNonWatchos", "apple")
ssDependsOn("appleIosTvos", "apple")

maybeCreate("commonMain").kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")

for (platform in kotlinPlatforms) {
val isMacos = platform.startsWith("macos")
val isIos = platform.startsWith("ios")
Expand Down Expand Up @@ -1111,11 +1128,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 @@ -1136,4 +1156,4 @@ allprojects {

apiValidation {
ignoredProjects.addAll(listOf(rootProject.name))
}
}
1 change: 1 addition & 0 deletions korlibs-image/api/android/korlibs-image.api
Original file line number Diff line number Diff line change
Expand Up @@ -4817,6 +4817,7 @@ public class korlibs/image/format/BaseNativeImageFormatProvider : korlibs/image/
public fun getFormats ()Lkorlibs/image/format/ImageFormat;
public fun mipmap (Lkorlibs/image/bitmap/Bitmap;)Lkorlibs/image/bitmap/NativeImage;
public fun mipmap (Lkorlibs/image/bitmap/Bitmap;I)Lkorlibs/image/bitmap/NativeImage;
protected fun toNativeImageSure (Lkorlibs/image/bitmap/Bitmap;)Lkorlibs/image/bitmap/NativeImage;
protected fun wrapNative (Lkorlibs/image/bitmap/Bitmap;Lkorlibs/image/format/ImageDecodingProps;)Lkorlibs/image/format/NativeImageResult;
protected final fun wrapNativeExt (Lkorlibs/image/bitmap/Bitmap;Lkorlibs/image/format/ImageDecodingProps;)Lkorlibs/image/format/NativeImageResult;
public static synthetic fun wrapNativeExt$default (Lkorlibs/image/format/BaseNativeImageFormatProvider;Lkorlibs/image/bitmap/Bitmap;Lkorlibs/image/format/ImageDecodingProps;ILjava/lang/Object;)Lkorlibs/image/format/NativeImageResult;
Expand Down
Loading
Loading