Skip to content

Commit

Permalink
add github workflow for kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderwiederin committed Nov 8, 2023
1 parent a4d0f55 commit f887082
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 5 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Continuous Integration Checks - Kotlin

on: [push, pull_request]

jobs:
check-kotlin:
runs-on: ubuntu-latest

env:
LDK_NODE_JVM_DIR: bindings/kotlin/ldk-node-jvm
LDK_NODE_ANDROID_DIR: bindings/kotlin/ldk-node-android

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Run ktlintCheck on ldk-node-jvm
run: |
cd $LDK_NODE_JVM_DIR
./gradlew ktlintCheck
- name: Run ktlintCheck on ldk-node-android
run: |
cd $LDK_NODE_ANDROID_DIR
./gradlew ktlintCheck
- name: Generate Kotlin JVM
run: ./scripts/uniffi_bindgen_generate_kotlin.sh

- name: Start bitcoin and electrs
run: docker compose up -d

- name: Run ldk-node-jvm tests
run: |
cd $LDK_NODE_JVM_DIR
./gradlew test -Penv=ci
- name: Run ldk-node-android tests
run: |
cd $LDK_NODE_ANDROID_DIR
./gradlew test
4 changes: 4 additions & 0 deletions bindings/kotlin/ldk-node-jvm/lib/.env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BITCOIN_CLI_BIN=docker exec ldk-node-bitcoin-1 bitcoin-cli
BITCOIND_RPC_USER=user
BITCOIND_RPC_PASSWORD=pass
ESPLORA_ENDPOINT=http://127.0.0.1:3002
4 changes: 4 additions & 0 deletions bindings/kotlin/ldk-node-jvm/lib/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BITCOIN_CLI_BIN=bitcoin-cli
BITCOIND_RPC_USER=
BITCOIND_RPC_PASSWORD=
ESPLORA_ENDPOINT=http://127.0.0.1:3002
22 changes: 17 additions & 5 deletions bindings/kotlin/ldk-node-jvm/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,24 @@ tasks.named<Test>("test") {
showStackTraces = true
showStandardStreams = true
}
}

tasks.test {
doFirst {
val envFile = if (project.hasProperty("env") && project.property("env") == "ci") {
file(".env.ci")
} else {
file(".env.local")
}

// Adapt the variables to run the tests in your local environment
environment("BITCOIN_CLI_BIN", "bitcoin-cli")
environment("BITCOIND_RPC_USER", "user")
environment("BITCOIND_RPC_PASSWORD", "pass")
environment("ESPLORA_ENDPOINT", "http://127.0.0.1:3002")
if (envFile.exists()) {
envFile.forEachLine { line ->
val (key, value) = line.split("=")
println("Setting environment variable: $key=$value")
environment(key, value)
}
}
}
}

afterEvaluate {
Expand Down

0 comments on commit f887082

Please sign in to comment.