Fix Kotlin test calling removed openWithIdleTimeout #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| paths: | |
| - "java/**" | |
| - "src/chrondb/lib/**" | |
| - "bindings/**" | |
| - "dev/chrondb/shared_library.clj" | |
| - "VERSION" | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-native-lib: | |
| runs-on: ${{ matrix.os }} | |
| name: "Build libchrondb on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| release_tag: ${{ steps.version.outputs.release_tag }} | |
| prerelease: ${{ steps.version.outputs.prerelease }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| RELEASE_TAG="${GITHUB_REF_NAME}" | |
| PRERELEASE=false | |
| else | |
| FILE_VERSION="$(cat VERSION | tr -d '[:space:]')" | |
| SHORT_SHA="${GITHUB_SHA::7}" | |
| VERSION="${FILE_VERSION}-dev.${SHORT_SHA}" | |
| RELEASE_TAG="latest" | |
| PRERELEASE=true | |
| fi | |
| echo "$VERSION" > VERSION | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT | |
| echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT | |
| - name: Validate VERSION matches tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| FILE_VERSION="$(cat VERSION | tr -d '[:space:]')" | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "::error::VERSION file ($FILE_VERSION) does not match tag ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| - 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 | |
| - name: List output files | |
| run: ls -la target/libchrondb* target/graal_isolate* || true | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: | | |
| target/libchrondb.* | |
| target/graal_isolate.h | |
| target/graal_isolate_dynamic.h | |
| target/libchrondb.h | |
| target/libchrondb_dynamic.h | |
| # --- Rust --- | |
| package-rust: | |
| needs: build-native-lib | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Rust binding on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - name: Determine platform and extension | |
| id: platform | |
| run: | | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| echo "ext=dylib" >> $GITHUB_OUTPUT | |
| echo "name=macos-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "ext=so" >> $GITHUB_OUTPUT | |
| echo "name=linux-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package Rust tarball | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| PLATFORM="${{ steps.platform.outputs.name }}" | |
| EXT="${{ steps.platform.outputs.ext }}" | |
| PKG_DIR="chrondb-rust-${VERSION}-${PLATFORM}" | |
| mkdir -p "${PKG_DIR}/lib" | |
| mkdir -p "${PKG_DIR}/include" | |
| mkdir -p "${PKG_DIR}/src" | |
| cp target/libchrondb.${EXT} "${PKG_DIR}/lib/" | |
| cp target/libchrondb.h "${PKG_DIR}/include/" | |
| cp target/graal_isolate.h "${PKG_DIR}/include/" | |
| cp target/libchrondb_dynamic.h "${PKG_DIR}/include/" || true | |
| cp target/graal_isolate_dynamic.h "${PKG_DIR}/include/" || true | |
| cp -r bindings/rust/src/* "${PKG_DIR}/src/" | |
| cp bindings/rust/Cargo.toml "${PKG_DIR}/" | |
| cp bindings/rust/build.rs "${PKG_DIR}/" | |
| tar -czf "chrondb-rust-${VERSION}-${PLATFORM}.tar.gz" "${PKG_DIR}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-rust-${{ steps.platform.outputs.name }} | |
| path: chrondb-rust-*.tar.gz | |
| publish-rust: | |
| needs: [build-native-lib, package-rust] | |
| runs-on: ubuntu-22.04 | |
| name: "Publish Rust crate to crates.io" | |
| environment: tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Update crate version | |
| working-directory: bindings/rust | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" Cargo.toml | |
| echo "Publishing version: ${VERSION}" | |
| - name: Publish to crates.io | |
| working-directory: bindings/rust | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: cargo publish --allow-dirty | |
| # --- UniFFI (generates Python/Ruby/Kotlin/Swift) --- | |
| build-uniffi: | |
| needs: build-native-lib | |
| runs-on: ${{ matrix.os }} | |
| name: "Build UniFFI on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| 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-release-${{ runner.os }}-${{ hashFiles('bindings/uniffi/Cargo.lock', 'bindings/uniffi/Cargo.toml') }} | |
| restore-keys: cargo-uniffi-release-${{ runner.os }}- | |
| - 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.${{ matrix.lib_ext }} \ | |
| --language python \ | |
| --language ruby \ | |
| --language kotlin \ | |
| --language swift \ | |
| --out-dir generated/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: uniffi-${{ runner.os }}-${{ matrix.arch }} | |
| path: | | |
| bindings/uniffi/generated/ | |
| bindings/uniffi/target/release/libchrondb_uniffi.${{ matrix.lib_ext }} | |
| # --- Python --- | |
| package-python: | |
| needs: [build-native-lib, build-uniffi] | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Python wheel on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| wheel_tag: macosx_14_0_arm64 | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| wheel_tag: manylinux_2_35_x86_64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: uniffi-${{ runner.os }}-${{ matrix.arch }} | |
| path: bindings/uniffi/ | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tools | |
| run: pip install build wheel | |
| - name: Determine platform | |
| id: platform | |
| run: | | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| echo "name=macos-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=linux-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Prepare wheel | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| working-directory: bindings/python | |
| run: | | |
| # Convert SemVer prerelease (0.2.3-dev.abc1234) to PEP 440 (0.2.3.devabc1234) | |
| PY_VERSION=$(echo "$VERSION" | sed 's/-dev\.\(.*\)/.dev\1/' | tr -d '[:space:]') | |
| printf '%s' "$PY_VERSION" > VERSION | |
| cp ../uniffi/generated/chrondb.py chrondb/_generated/ | |
| cp ../uniffi/target/release/libchrondb_uniffi.${{ matrix.lib_ext }} chrondb/_generated/ | |
| mkdir -p chrondb/lib | |
| cp ../../target/libchrondb.${{ matrix.lib_ext }} chrondb/lib/ | |
| - name: Build wheel | |
| working-directory: bindings/python | |
| run: python -m build --wheel | |
| - name: Retag wheel with platform | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| working-directory: bindings/python | |
| run: | | |
| WHEEL_TAG="${{ matrix.wheel_tag }}" | |
| cd dist | |
| wheel tags --remove --platform-tag "${WHEEL_TAG}" *.whl | |
| if [ "$VERSION" = "latest" ]; then | |
| RETAGGED=$(ls *.whl) | |
| cp "$RETAGGED" "chrondb-latest-py3-none-${WHEEL_TAG}.whl" | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-python-${{ steps.platform.outputs.name }} | |
| path: bindings/python/dist/chrondb-*.whl | |
| publish-python: | |
| needs: [build-native-lib, package-python] | |
| runs-on: ubuntu-22.04 | |
| name: "Publish Python to PyPI" | |
| environment: tests | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: chrondb-python-* | |
| path: dist/ | |
| merge-multiple: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install twine | |
| run: pip install twine | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| rm -f dist/chrondb-latest-*.whl | |
| twine upload dist/*.whl | |
| # --- Ruby --- | |
| package-ruby: | |
| needs: [build-native-lib, build-uniffi] | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Ruby gem on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: uniffi-${{ runner.os }}-${{ matrix.arch }} | |
| path: bindings/uniffi/ | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| - name: Prepare gem | |
| working-directory: bindings/ruby | |
| run: | | |
| cp ../uniffi/generated/chrondb.rb lib/chrondb_generated.rb | |
| cp ../../target/libchrondb.${{ matrix.lib_ext }} lib/ | |
| cp ../uniffi/target/release/libchrondb_uniffi.${{ matrix.lib_ext }} lib/ | |
| - name: Build gem | |
| working-directory: bindings/ruby | |
| run: gem build chrondb.gemspec | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-ruby-${{ matrix.arch }} | |
| path: bindings/ruby/*.gem | |
| publish-ruby: | |
| needs: [build-native-lib, package-ruby] | |
| runs-on: ubuntu-22.04 | |
| name: "Publish Ruby gem" | |
| environment: tests | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: chrondb-ruby-* | |
| path: gems/ | |
| merge-multiple: true | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| - name: Publish to RubyGems | |
| env: | |
| GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
| run: | | |
| for gem in gems/*.gem; do | |
| gem push "$gem" || true | |
| done | |
| # --- Node.js --- | |
| build-node: | |
| needs: build-native-lib | |
| runs-on: ${{ matrix.os }} | |
| name: "Build Node.js on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Build native addon | |
| working-directory: bindings/node | |
| env: | |
| CHRONDB_LIB_DIR: ${{ github.workspace }}/target | |
| run: | | |
| npm install | |
| npx napi build --release | |
| - name: Bundle native library | |
| working-directory: bindings/node | |
| run: | | |
| mkdir -p lib | |
| cp ${{ github.workspace }}/target/libchrondb.${{ matrix.lib_ext }} lib/ | |
| - name: Pack npm tarball | |
| working-directory: bindings/node | |
| run: npm pack | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-node-${{ matrix.arch }} | |
| path: bindings/node/*.tgz | |
| publish-node: | |
| needs: [build-native-lib, build-node] | |
| runs-on: ubuntu-22.04 | |
| name: "Publish Node.js to npm" | |
| environment: tests | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: chrondb-node-* | |
| path: packages/ | |
| merge-multiple: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Publish to npm | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| for pkg in packages/*.tgz; do | |
| npm publish "$pkg" --access public || true | |
| done | |
| # --- Swift --- | |
| package-swift: | |
| needs: [build-native-lib, build-uniffi] | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Swift binding on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: uniffi-${{ runner.os }}-${{ matrix.arch }} | |
| path: bindings/uniffi/ | |
| - name: Determine platform | |
| id: platform | |
| run: | | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| echo "name=macos-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=linux-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package Swift tarball | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| PLATFORM="${{ steps.platform.outputs.name }}" | |
| PKG_DIR="chrondb-swift-${VERSION}-${PLATFORM}" | |
| mkdir -p "${PKG_DIR}/Sources/ChronDB" | |
| mkdir -p "${PKG_DIR}/Sources/ChronDBFFI/headers" | |
| mkdir -p "${PKG_DIR}/Tests/ChronDBTests" | |
| mkdir -p "${PKG_DIR}/lib" | |
| # Copy wrapper and Package.swift | |
| cp bindings/swift/Package.swift "${PKG_DIR}/" | |
| cp bindings/swift/Sources/ChronDB/ChronDB.swift "${PKG_DIR}/Sources/ChronDB/" | |
| cp bindings/swift/Tests/ChronDBTests/ChronDBTests.swift "${PKG_DIR}/Tests/ChronDBTests/" | |
| # Copy UniFFI-generated Swift | |
| cp bindings/uniffi/generated/chrondb.swift "${PKG_DIR}/Sources/ChronDB/chrondb_generated.swift" | |
| # Copy FFI module map and header | |
| cp bindings/swift/Sources/ChronDBFFI/module.modulemap "${PKG_DIR}/Sources/ChronDBFFI/" | |
| cp bindings/uniffi/generated/chrondbFFI.h "${PKG_DIR}/Sources/ChronDBFFI/headers/" || true | |
| # Copy native libraries | |
| cp target/libchrondb.${{ matrix.lib_ext }} "${PKG_DIR}/lib/" | |
| cp bindings/uniffi/target/release/libchrondb_uniffi.${{ matrix.lib_ext }} "${PKG_DIR}/lib/" | |
| tar -czf "chrondb-swift-${VERSION}-${PLATFORM}.tar.gz" "${PKG_DIR}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-swift-${{ steps.platform.outputs.name }} | |
| path: chrondb-swift-*.tar.gz | |
| # --- Kotlin --- | |
| package-kotlin: | |
| needs: build-native-lib | |
| runs-on: ubuntu-22.04 | |
| name: "Package Kotlin binding (JVM)" | |
| 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: Build uberjar | |
| run: clojure -M:build -- --uberjar | |
| - name: Package Kotlin tarball | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| PKG_DIR="chrondb-kotlin-${VERSION}" | |
| mkdir -p "${PKG_DIR}/src/main/kotlin/com/chrondb" | |
| mkdir -p "${PKG_DIR}/src/test/kotlin/com/chrondb" | |
| mkdir -p "${PKG_DIR}/lib" | |
| # Copy wrapper and build files | |
| cp bindings/kotlin/build.gradle.kts "${PKG_DIR}/" | |
| cp bindings/kotlin/settings.gradle.kts "${PKG_DIR}/" | |
| cp bindings/kotlin/src/main/kotlin/com/chrondb/ChronDB.kt "${PKG_DIR}/src/main/kotlin/com/chrondb/" | |
| cp bindings/kotlin/src/test/kotlin/com/chrondb/ChronDBTest.kt "${PKG_DIR}/src/test/kotlin/com/chrondb/" | |
| # Include the uberjar | |
| cp target/chrondb.jar "${PKG_DIR}/lib/" | |
| tar -czf "chrondb-kotlin-${VERSION}.tar.gz" "${PKG_DIR}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-kotlin | |
| path: chrondb-kotlin-*.tar.gz | |
| # --- Dart --- | |
| package-dart: | |
| needs: build-native-lib | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Dart binding on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - name: Determine platform | |
| id: platform | |
| run: | | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| echo "name=macos-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=linux-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package Dart tarball | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| PLATFORM="${{ steps.platform.outputs.name }}" | |
| PKG_DIR="chrondb-dart-${VERSION}-${PLATFORM}" | |
| mkdir -p "${PKG_DIR}/lib/src" | |
| mkdir -p "${PKG_DIR}/test" | |
| mkdir -p "${PKG_DIR}/native" | |
| cp bindings/dart/pubspec.yaml "${PKG_DIR}/" | |
| cp bindings/dart/lib/chrondb.dart "${PKG_DIR}/lib/" | |
| cp bindings/dart/lib/src/*.dart "${PKG_DIR}/lib/src/" | |
| cp bindings/dart/test/*.dart "${PKG_DIR}/test/" | |
| cp target/libchrondb.${{ matrix.lib_ext }} "${PKG_DIR}/native/" | |
| tar -czf "chrondb-dart-${VERSION}-${PLATFORM}.tar.gz" "${PKG_DIR}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-dart-${{ steps.platform.outputs.name }} | |
| path: chrondb-dart-*.tar.gz | |
| # --- Go --- | |
| package-go: | |
| needs: build-native-lib | |
| runs-on: ${{ matrix.os }} | |
| name: "Package Go binding on ${{ matrix.os }}" | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "ubuntu-22.04"] | |
| include: | |
| - os: macos-14 | |
| arch: aarch64 | |
| lib_ext: dylib | |
| - os: ubuntu-22.04 | |
| arch: x86_64 | |
| lib_ext: so | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: libchrondb-${{ runner.os }}-${{ matrix.arch }} | |
| path: target/ | |
| - name: Determine platform | |
| id: platform | |
| run: | | |
| if [ "${{ runner.os }}" = "macOS" ]; then | |
| echo "name=macos-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=linux-${{ matrix.arch }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package Go tarball | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| run: | | |
| PLATFORM="${{ steps.platform.outputs.name }}" | |
| PKG_DIR="chrondb-go-${VERSION}-${PLATFORM}" | |
| mkdir -p "${PKG_DIR}/include" | |
| mkdir -p "${PKG_DIR}/lib" | |
| cp bindings/go/go.mod "${PKG_DIR}/" | |
| cp bindings/go/chrondb.go "${PKG_DIR}/" | |
| cp bindings/go/chrondb_test.go "${PKG_DIR}/" | |
| cp target/libchrondb.${{ matrix.lib_ext }} "${PKG_DIR}/lib/" | |
| cp target/libchrondb.h "${PKG_DIR}/include/" || true | |
| cp target/graal_isolate.h "${PKG_DIR}/include/" || true | |
| tar -czf "chrondb-go-${VERSION}-${PLATFORM}.tar.gz" "${PKG_DIR}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrondb-go-${{ steps.platform.outputs.name }} | |
| path: chrondb-go-*.tar.gz | |
| # --- GitHub Release --- | |
| create-release: | |
| needs: [build-native-lib, package-rust, package-python, package-ruby, build-node, package-swift, package-kotlin, package-dart, package-go] | |
| runs-on: ubuntu-22.04 | |
| name: "Create GitHub Release" | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Prepare release assets | |
| env: | |
| VERSION: ${{ needs.build-native-lib.outputs.version }} | |
| PRERELEASE: ${{ needs.build-native-lib.outputs.prerelease }} | |
| run: | | |
| mkdir -p release-assets | |
| if [ "$PRERELEASE" = "true" ]; then | |
| ASSET_VERSION="latest" | |
| else | |
| ASSET_VERSION="$VERSION" | |
| fi | |
| # Package C library tarballs | |
| for platform in linux-x86_64 macos-aarch64; do | |
| if [ "$platform" = "linux-x86_64" ]; then | |
| ARTIFACT_DIR="artifacts/libchrondb-Linux-x86_64" | |
| LIB_FILE="libchrondb.so" | |
| else | |
| ARTIFACT_DIR="artifacts/libchrondb-macOS-aarch64" | |
| LIB_FILE="libchrondb.dylib" | |
| fi | |
| if [ -d "$ARTIFACT_DIR" ]; then | |
| PKG_DIR="libchrondb-${ASSET_VERSION}-${platform}" | |
| mkdir -p "${PKG_DIR}/lib" | |
| mkdir -p "${PKG_DIR}/include" | |
| cp "${ARTIFACT_DIR}/${LIB_FILE}" "${PKG_DIR}/lib/" || true | |
| cp "${ARTIFACT_DIR}/libchrondb.h" "${PKG_DIR}/include/" || true | |
| cp "${ARTIFACT_DIR}/graal_isolate.h" "${PKG_DIR}/include/" || true | |
| cp "${ARTIFACT_DIR}/libchrondb_dynamic.h" "${PKG_DIR}/include/" || true | |
| cp "${ARTIFACT_DIR}/graal_isolate_dynamic.h" "${PKG_DIR}/include/" || true | |
| tar -czf "release-assets/libchrondb-${ASSET_VERSION}-${platform}.tar.gz" "${PKG_DIR}" | |
| fi | |
| done | |
| # Move Rust tarballs | |
| echo "Looking for Rust tarballs..." | |
| ls -la artifacts/chrondb-rust-*/ 2>/dev/null || echo "WARNING: No Rust artifact directories found" | |
| cp artifacts/chrondb-rust-*/*.tar.gz release-assets/ || echo "WARNING: Failed to copy Rust tarballs" | |
| # Move Python wheels | |
| if [ "$VERSION" = "latest" ]; then | |
| cp artifacts/chrondb-python-*/chrondb-latest-*.whl release-assets/ || true | |
| else | |
| cp artifacts/chrondb-python-*/chrondb-${VERSION}-*.whl release-assets/ || true | |
| fi | |
| # Move Ruby gems | |
| cp artifacts/chrondb-ruby-*/*.gem release-assets/ || true | |
| # Move Node.js tarballs | |
| cp artifacts/chrondb-node-*/*.tgz release-assets/ || true | |
| # Move Swift tarballs | |
| echo "Looking for Swift tarballs..." | |
| cp artifacts/chrondb-swift-*/*.tar.gz release-assets/ || echo "WARNING: Failed to copy Swift tarballs" | |
| # Move Kotlin tarballs | |
| echo "Looking for Kotlin tarballs..." | |
| cp artifacts/chrondb-kotlin-*/*.tar.gz release-assets/ || echo "WARNING: Failed to copy Kotlin tarballs" | |
| # Move Dart tarballs | |
| echo "Looking for Dart tarballs..." | |
| cp artifacts/chrondb-dart-*/*.tar.gz release-assets/ || echo "WARNING: Failed to copy Dart tarballs" | |
| # Move Go tarballs | |
| echo "Looking for Go tarballs..." | |
| cp artifacts/chrondb-go-*/*.tar.gz release-assets/ || echo "WARNING: Failed to copy Go tarballs" | |
| echo "Release assets:" | |
| ls -la release-assets/ | |
| - name: Delete existing latest release | |
| if: needs.build-native-lib.outputs.prerelease == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete latest --yes || true | |
| git push origin :refs/tags/latest || true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.build-native-lib.outputs.release_tag }} | |
| name: ${{ needs.build-native-lib.outputs.release_tag == 'latest' && 'Latest (main)' || needs.build-native-lib.outputs.release_tag }} | |
| prerelease: ${{ needs.build-native-lib.outputs.prerelease == 'true' }} | |
| make_latest: ${{ needs.build-native-lib.outputs.prerelease == 'false' }} | |
| files: release-assets/* | |
| generate_release_notes: ${{ needs.build-native-lib.outputs.prerelease == 'false' }} | |
| body: | | |
| ## Language Packages | |
| | Language | Package | | |
| |----------|---------| | |
| | Rust | `cargo add chrondb` | | |
| | Python | `pip install chrondb` | | |
| | Ruby | `gem install chrondb` | | |
| | Node.js | `npm install chrondb` | | |
| | Swift | Download `chrondb-swift-*.tar.gz` from assets below | | |
| | Kotlin | Download `chrondb-kotlin-*.tar.gz` from assets below | | |
| | Dart/Flutter | Download `chrondb-dart-*.tar.gz` from assets below | | |
| | Go | Download `chrondb-go-*.tar.gz` from assets below | | |
| All bindings are auto-generated from the Rust SDK. See [docs](https://chrondb.avelino.run/) for usage. |