Skip to content
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
1 change: 1 addition & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ runs:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- uses: extractions/setup-just@v3
35 changes: 26 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,40 @@ on:
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: jvm
- runner: macos-latest
target: macosArm64
- runner: ubuntu-latest
target: linuxX64
- runner: windows-latest
target: mingwX64
runs-on: "${{ matrix.runner }}"
- target: jvm
os: ubuntu
- target: jsBrowser
os: ubuntu
- target: jsNode
os: ubuntu
# TODO: wasmJs times out on bulk tests
# - target: wasmJsBrowser
# os: ubuntu
- target: wasmJsNode
os: ubuntu
- target: linuxX64
os: ubuntu
- target: macosArm64
os: macos
- target: mingwX64
os: windows
- target: iosSimulatorArm64
os: macos
- target: tvosSimulatorArm64
os: macos
- target: watchosSimulatorArm64
os: macos
runs-on: "${{ matrix.os }}-latest"
name: "test (${{ matrix.target }})"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- uses: "./.github/actions/setup"
- run: "just test-server-background"
- run: "./gradlew ${{ matrix.target }}Test"

build-docs:
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ Maintainer: [@sargunv](https://github.com/sargunv)
This is a [Kotlin](https://kotlinlang.org/) client for
[PokeApi](https://github.com/PokeAPI/pokeapi).

| Platform | Status |
| -------- | ------------------ |
| JVM | :white_check_mark: |
| Native | :x: |
| JS | :x: |
| WASM | :x: |

## Installation

Since v2.5.0, the library is published to Maven Central.
Expand Down
38 changes: 32 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@file:OptIn(ExperimentalWasmDsl::class)

import com.vanniktech.maven.publish.SonatypeHost
import fr.brouillard.oss.jgitver.Strategies
import kotlin.time.Duration.Companion.seconds
import kotlin.time.toJavaDuration
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsSubTargetDsl

plugins {
alias(libs.plugins.kotlin.multiplatform)
Expand Down Expand Up @@ -28,6 +34,30 @@ kotlin {

jvm()

fun KotlinJsSubTargetDsl.configureWithKarma() {
testTask {
useKarma {
useChromeHeadless()
timeout = 60.seconds.toJavaDuration()
}
}
}

fun KotlinJsSubTargetDsl.configureWithMocha() {
testTask { useMocha { timeout = "60s" } }
}

js(IR) {
browser { configureWithMocha() }
nodejs { configureWithMocha() }
}

wasmJs {
browser { configureWithMocha() }
nodejs { configureWithMocha() }
d8 {}
}

// native tier 1
macosX64()
macosArm64()
Expand All @@ -50,12 +80,6 @@ kotlin {
mingwX64()
watchosDeviceArm64()

// native tier 3 - but no suitable Ktor engine available
// androidNativeArm32()
// androidNativeArm64()
// androidNativeX86()
// androidNativeX64()

applyDefaultHierarchyTemplate()

sourceSets {
Expand All @@ -71,6 +95,8 @@ kotlin {
appleMain.dependencies { implementation(libs.ktor.client.darwin) }
linuxMain.dependencies { implementation(libs.ktor.client.curl) }
mingwMain.dependencies { implementation(libs.ktor.client.winhttp) }
jsMain.dependencies { implementation(libs.ktor.client.js) }
wasmJsMain.dependencies { implementation(libs.ktor.client.js) }

commonTest.dependencies {
implementation(kotlin("test"))
Expand Down
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ktorfit = { module = "de.jensklingenberg.ktorfit:ktorfit-lib", version.ref = "gr
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
Expand Down
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set windows-shell := ["C:\\Program Files\\Git\\bin\\sh.exe", "-c"]

_default:
just --list

test-server:
npx -y http-server src/commonTest/resources/data -e json -p 8080 --cors

test-server-background:
npx -y http-server src/commonTest/resources/data -e json -p 8080 --cors &
Loading