diff --git a/.github/workflows/build_node_module/action.yml b/.github/workflows/build_node_module/action.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eaf4154c..d0f85628 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,29 @@ jobs: prerelease: true # hardcoded on for now generate_release_notes: true + rust: + runs-on: ubuntu-latest + needs: draft-release + defaults: + run: + shell: bash + working-directory: rust/vectordb + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y protobuf-compiler libssl-dev + - name: Package Rust + run: cargo package --all-features + - uses: softprops/action-gh-release@v1 + with: + files: | + rust/target/vectordb-*.crate + python: runs-on: ubuntu-latest needs: draft-release @@ -126,6 +149,11 @@ jobs: for filename in node/dist/*.tgz; do npm publish --dry-run $filename done - - uses: softprops/action-gh-release@v1 - with: - draft: false + - name: Publish to crates.io + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + cargo publish --dry-run --no-verify rust/target/vectordb-*.crate + # - uses: softprops/action-gh-release@v1 + # with: + # draft: false diff --git a/Cargo.lock b/Cargo.lock index 9e198522..cd7ff22b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3356,7 +3356,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vectordb" -version = "0.0.1" +version = "0.1.2" dependencies = [ "arrow-array", "arrow-data", @@ -3369,7 +3369,7 @@ dependencies = [ [[package]] name = "vectordb-node" -version = "0.1.0" +version = "0.1.2" dependencies = [ "arrow-array", "arrow-ipc", diff --git a/Cargo.toml b/Cargo.toml index 18fc1f65..b95029fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,4 +3,4 @@ members = [ "rust/vectordb", "rust/ffi/node" ] -resolver = "2" \ No newline at end of file +resolver = "2" diff --git a/Cross.toml b/Cross.toml index c6080a8c..6ec737f6 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,3 +1,4 @@ +# These make sure our builds are compatible with old glibc versions. [target.x86_64-unknown-linux-gnu] pre-build = [ "dpkg --add-architecture $CROSS_DEB_ARCH", @@ -10,5 +11,4 @@ pre-build = [ "dpkg --add-architecture $CROSS_DEB_ARCH", "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH protobuf-compiler", ] -image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:centos" -# docker pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge-centos@sha256:8ca737af41df2a8078eb03a0a19e38405854ad05891a7381f7f671727a9ff736 +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main-centos" diff --git a/node/README.md b/node/README.md index 9e4093a9..662ce848 100644 --- a/node/README.md +++ b/node/README.md @@ -35,6 +35,11 @@ npm run pack-build npm install --no-save ./dist/vectordb-*.tgz ``` +`npm run build` builds the Rust library, `npm run pack-build` packages the Rust +binary into an npm module called `@vectordb/` (for example, +`@vectordb/darwin-arm64.node`), and then `npm run install ...` installs that +module. + The LanceDB javascript is built with npm: ```bash diff --git a/node/native.js b/node/native.js index 881bf58e..6aeb05f4 100644 --- a/node/native.js +++ b/node/native.js @@ -18,8 +18,13 @@ let nativeLib; try { nativeLib = require(`@vectordb/${currentTarget()}`); -} catch { - throw new Error('vectordb: failed to load native library. Please file a bug report at https://github.com/lancedb/lancedb/issues'); +} catch (e) { + throw new Error(`vectordb: failed to load native library. + You may need to run \`npm install @vectordb/${currentTarget()}\`. + + If that does not work, please file a bug report at https://github.com/lancedb/lancedb/issues + + Source error: ${e}`); } // Dynamic require for runtime. diff --git a/node/package.json b/node/package.json index a485aa2b..1c070ee8 100644 --- a/node/package.json +++ b/node/package.json @@ -63,13 +63,17 @@ "x86_64-apple-darwin": "@vectordb/darwin-x64", "aarch64-apple-darwin": "@vectordb/darwin-arm64", "x86_64-unknown-linux-gnu": "@vectordb/linux-x64-gnu", - "x86_64-unknown-linux-musl": "@vectordb/linux-x64-musl" + "x86_64-unknown-linux-musl": "@vectordb/linux-x64-musl", + "aarch64-unknown-linux-gnu": "@vectordb/linux-arm64-gnu", + "aarch64-unknown-linux-musl": "@vectordb/linux-arm64-musl" } }, "optionalDependencies": { - "@vectordb/darwin-arm64": "0.1.1", - "@vectordb/darwin-x64": "0.1.1", - "@vectordb/linux-x64-gnu": "0.1.1", - "@vectordb/linux-x64-musl": "0.1.1" + "@vectordb/darwin-arm64": "0.1.2", + "@vectordb/darwin-x64": "0.1.2", + "@vectordb/linux-x64-gnu": "0.1.2", + "@vectordb/linux-x64-musl": "0.1.2", + "@vectordb/linux-arm64-gnu": "0.1.2", + "@vectordb/linux-arm64-musl": "0.1.2" } } diff --git a/rust/ffi/node/release_process.md b/rust/ffi/node/release_process.md index 80c4416b..2dcdfdaa 100644 --- a/rust/ffi/node/release_process.md +++ b/rust/ffi/node/release_process.md @@ -3,6 +3,8 @@ How to release the node module ### 1. Bump the versions + + ```shell pushd rust/vectordb cargo bump minor diff --git a/rust/vectordb/Cargo.toml b/rust/vectordb/Cargo.toml index bc066608..54504a53 100644 --- a/rust/vectordb/Cargo.toml +++ b/rust/vectordb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vectordb" -version = "0.0.1" +version = "0.1.2" edition = "2021" description = "Serverless, low-latency vector database for AI applications" license = "Apache-2.0"