From 0a67b50582c0a8b12d332cd8d5ccc5259be5bd52 Mon Sep 17 00:00:00 2001 From: StefMa Date: Sat, 9 Sep 2023 12:51:43 +0200 Subject: [PATCH 1/2] Add GitHub Action to test library --- .github/workflows/tests.yml | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3373b85 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,75 @@ +name: 'Tests' + +on: + pull_request: + push: + branches: + - main + +jobs: + test-jvm: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run tests + run: ./gradlew jvmTest + + - name: Test Report + uses: mikepenz/action-junit-report@v4 + if: success() || failure() + with: + check_name: 'JVM Test Reports' + report_paths: '**/build/test-results/jvmTest/TEST-*.xml' + + test-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install libcurl + run: sudo apt-get install -y libcurl4-gnutls-dev + + - name: Run tests + run: ./gradlew nativeTest + + - name: Test Report + uses: mikepenz/action-junit-report@v4 + if: success() || failure() + with: + check_name: 'Linux Test Reports' + report_paths: '**/build/test-results/nativeTest/TEST-*.xml' + + test-darwin: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run tests + run: ./gradlew nativeTest + + - name: Test Report + uses: mikepenz/action-junit-report@v4 + if: success() || failure() + with: + check_name: 'Darwin Test Reports' + report_paths: '**/build/test-results/nativeTest/TEST-*.xml' + + test-mingw: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run tests + run: ./gradlew nativeTest + + - name: Test Report + uses: mikepenz/action-junit-report@v4 + if: success() || failure() + with: + check_name: 'Mingw Test Reports' + report_paths: '**/build/test-results/nativeTest/TEST-*.xml' From 485b7bca52d449ec5954bf7a447380ca24b361c6 Mon Sep 17 00:00:00 2001 From: StefMa Date: Sat, 9 Sep 2023 13:01:11 +0200 Subject: [PATCH 2/2] Add correct ktor client dependencies to native platforms --- build.gradle.kts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f6d9d5b..d93f10f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,7 +27,6 @@ kotlin { when { hostOs == "Mac OS X" && isArm64 -> macosArm64("native") hostOs == "Mac OS X" && !isArm64 -> macosX64("native") - hostOs == "Linux" && isArm64 -> linuxArm64("native") hostOs == "Linux" && !isArm64 -> linuxX64("native") isMingwX64 -> mingwX64("native") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") @@ -58,7 +57,13 @@ kotlin { val jvmTest by getting val nativeMain by getting { dependencies { - implementation("io.ktor:ktor-client-darwin:$ktorVersion") + when { + hostOs == "Mac OS X" -> implementation("io.ktor:ktor-client-darwin:$ktorVersion") + hostOs == "Linux"-> implementation("io.ktor:ktor-client-curl:$ktorVersion") + isMingwX64 -> implementation("io.ktor:ktor-client-winhttp:$ktorVersion") + else -> throw GradleException("Host OS is not supported in Kotlin/Native.") + } + } } val nativeTest by getting