Skip to content

Fix Kotlin test calling removed openWithIdleTimeout #13

Fix Kotlin test calling removed openWithIdleTimeout

Fix Kotlin test calling removed openWithIdleTimeout #13

name: Build & Test Bindings
on:
workflow_dispatch:
push:
paths:
- "java/**"
- "src/chrondb/lib/**"
- "bindings/**"
- "dev/chrondb/shared_library.clj"
pull_request:
paths:
- "java/**"
- "src/chrondb/lib/**"
- "bindings/**"
- "dev/chrondb/shared_library.clj"
concurrency:
group: build-test-${{ github.ref }}
cancel-in-progress: true
jobs:
build-native-lib:
runs-on: ${{ matrix.os }}
name: "Build libchrondb on ${{ matrix.os }}"
strategy:
matrix:
os: ["macos-14", "ubuntu-22.04"]
steps:
- uses: actions/checkout@v4
- uses: DeLaGuardo/setup-clojure@13.4
with:
cli: 1.12.3.1577
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: graalvm/setup-graalvm@v1
with:
java-version: "21"
distribution: "graalvm"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Clojure dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
key: clj-deps-${{ runner.os }}-${{ hashFiles('deps.edn') }}
restore-keys: clj-deps-${{ runner.os }}-
- name: Build shared library
run: |
clojure -M:shared-lib
native-image @target/shared-image-args
- uses: actions/upload-artifact@v4
with:
name: libchrondb-${{ runner.os }}
path: |
target/libchrondb.*
target/graal_isolate.h
target/graal_isolate_dynamic.h
target/libchrondb.h
target/libchrondb_dynamic.h
test-rust-sdk:
needs: build-native-lib
runs-on: ubuntu-22.04
name: "Test Rust SDK"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
bindings/rust/target
key: cargo-rust-${{ hashFiles('bindings/rust/Cargo.lock', 'bindings/rust/Cargo.toml') }}
restore-keys: cargo-rust-
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Run Rust SDK tests
working-directory: bindings/rust
env:
CHRONDB_LIB_DIR: ${{ github.workspace }}/target
RUST_MIN_STACK: "67108864"
run: cargo test
build-uniffi:
needs: test-rust-sdk
runs-on: ubuntu-22.04
name: "Build UniFFI bindings"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
bindings/uniffi/target
key: cargo-uniffi-${{ hashFiles('bindings/uniffi/Cargo.lock', 'bindings/uniffi/Cargo.toml') }}
restore-keys: cargo-uniffi-
- name: Build UniFFI cdylib
working-directory: bindings/uniffi
env:
CHRONDB_LIB_DIR: ${{ github.workspace }}/target
run: cargo build --release
- name: Generate bindings for all languages
working-directory: bindings/uniffi
run: |
mkdir -p generated
cargo run --release --bin uniffi-bindgen generate \
--library target/release/libchrondb_uniffi.so \
--language python \
--language ruby \
--language kotlin \
--language swift \
--out-dir generated/
- uses: actions/upload-artifact@v4
with:
name: uniffi-bindings
path: |
bindings/uniffi/generated/
bindings/uniffi/target/release/libchrondb_uniffi.so
test-python:
needs: [build-native-lib, build-uniffi]
runs-on: ubuntu-22.04
name: "Test Python (UniFFI)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: actions/download-artifact@v4
with:
name: uniffi-bindings
path: bindings/uniffi/
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('bindings/python/requirements*.txt', 'bindings/python/pyproject.toml') }}
restore-keys: pip-
- name: Install dependencies
run: pip install pytest
- name: Setup Python package
working-directory: bindings/python
run: |
cp ../uniffi/generated/chrondb.py chrondb/_generated/
cp ../uniffi/target/release/libchrondb_uniffi.so chrondb/_generated/
mkdir -p chrondb/lib
cp ${{ github.workspace }}/target/libchrondb.so chrondb/lib/
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Run Python tests
working-directory: bindings/python
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target:${{ github.workspace }}/bindings/python/chrondb/_generated:${{ github.workspace }}/bindings/python/chrondb/lib
CHRONDB_LIB_DIR: ${{ github.workspace }}/bindings/python/chrondb/lib
run: pytest tests/ -v
test-ruby:
needs: [build-native-lib, build-uniffi]
runs-on: ubuntu-22.04
name: "Test Ruby (UniFFI)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: actions/download-artifact@v4
with:
name: uniffi-bindings
path: bindings/uniffi/
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install Ruby dependencies
run: gem install ffi
- name: Setup Ruby package
working-directory: bindings/ruby
run: |
cp ../uniffi/generated/chrondb.rb lib/chrondb_generated.rb
cp ../uniffi/target/release/libchrondb_uniffi.so lib/
cp ${{ github.workspace }}/target/libchrondb.so lib/
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Run Ruby tests
working-directory: bindings/ruby
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target:${{ github.workspace }}/bindings/ruby/lib
CHRONDB_LIB_DIR: ${{ github.workspace }}/bindings/ruby/lib
run: ruby test/test_chrondb.rb
test-node:
needs: build-native-lib
runs-on: ubuntu-22.04
name: "Test Node.js (NAPI-RS)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache Cargo and npm
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
bindings/node/target
bindings/node/node_modules
key: node-${{ hashFiles('bindings/node/Cargo.lock', 'bindings/node/package.json') }}
restore-keys: node-
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Build Node.js binding
working-directory: bindings/node
env:
CHRONDB_LIB_DIR: ${{ github.workspace }}/target
run: |
npm install
npx napi build --release
- name: Run Node.js tests
working-directory: bindings/node
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target
run: npm test
test-swift:
needs: [build-native-lib, build-uniffi]
runs-on: ubuntu-22.04
name: "Test Swift (UniFFI)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: actions/download-artifact@v4
with:
name: uniffi-bindings
path: bindings/uniffi/
- uses: swift-actions/setup-swift@v2
with:
swift-version: "5.10"
- name: Verify Swift bindings generated
run: |
echo "Checking UniFFI generated Swift bindings..."
ls -la bindings/uniffi/generated/chrondb.swift
wc -l bindings/uniffi/generated/chrondb.swift
echo "Swift wrapper:"
wc -l bindings/swift/Sources/ChronDB/ChronDB.swift
echo "Swift bindings verified — full test requires UniFFI scaffolding (tested in release pipeline)"
test-kotlin:
needs: build-native-lib
runs-on: ubuntu-22.04
name: "Test Kotlin (JVM)"
steps:
- uses: actions/checkout@v4
- uses: DeLaGuardo/setup-clojure@13.4
with:
cli: 1.12.3.1577
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- uses: gradle/actions/setup-gradle@v4
- name: Build ChronDB uberjar
run: clojure -M:build -- --uberjar
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Run Kotlin tests
working-directory: bindings/kotlin
run: gradle test
test-dart:
needs: build-native-lib
runs-on: ubuntu-22.04
name: "Test Dart (FFI)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Install dependencies
working-directory: bindings/dart
run: dart pub get
- name: Verify Dart bindings compile
working-directory: bindings/dart
run: dart analyze
- name: Run Dart tests
working-directory: bindings/dart
timeout-minutes: 3
continue-on-error: true
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target
CHRONDB_LIB_DIR: ${{ github.workspace }}/target
run: dart test --timeout=60s
test-go:
needs: build-native-lib
runs-on: ubuntu-22.04
name: "Test Go (cgo)"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: libchrondb-Linux
path: target/
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global init.defaultBranch "main"
- name: Setup Go headers
working-directory: bindings/go
run: |
mkdir -p include
cp ../../target/libchrondb.h include/ || true
cp ../../target/graal_isolate.h include/ || true
- name: Run Go tests
working-directory: bindings/go
env:
CGO_LDFLAGS: "-L${{ github.workspace }}/target"
CGO_CFLAGS: "-I${{ github.workspace }}/target"
LD_LIBRARY_PATH: ${{ github.workspace }}/target
run: go test -v ./...