mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-04 19:02:58 +00:00
Compare commits
1 Commits
v0.1.2-dev
...
v0.1.2-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d600e4fff8 |
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
@@ -120,39 +120,34 @@ jobs:
|
|||||||
files: node/dist/vectordb-darwin*.tgz
|
files: node/dist/vectordb-darwin*.tgz
|
||||||
|
|
||||||
node-linux:
|
node-linux:
|
||||||
name: Linux ${{ matrix.settings.arch}} native node module
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: draft-release
|
needs: draft-release
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
libc:
|
target:
|
||||||
- gnu
|
- x86_64-unknown-linux-gnu
|
||||||
- musl
|
- aarch64-unknown-linux-gnu
|
||||||
arch:
|
- aarch64-unknown-linux-musl
|
||||||
- x86_64
|
- x86_64-unknown-linux-musl
|
||||||
- aarch64
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
working-directory: node
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Build Linux GNU native node modules
|
- name: Setup Rust
|
||||||
if: ${{ matrix.libc == 'gnu' }}
|
uses: ATiltedTree/setup-rust@v1
|
||||||
|
with:
|
||||||
|
rust-version: stable
|
||||||
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
docker run \
|
sudo apt update
|
||||||
-v $(pwd):/io -w /io \
|
sudo apt install -y protobuf-compiler libssl-dev
|
||||||
quay.io/pypa/manylinux2014_${{ matrix.arch }} \
|
cargo install cross
|
||||||
bash ci/build_linux_artifacts.sh ${{ matrix.arch }}-unknown-linux-gnu
|
- name: Install npm dependencies
|
||||||
- name: Build musl Linux native node modules
|
|
||||||
if: ${{ matrix.libc == 'musl' }}
|
|
||||||
run: |
|
run: |
|
||||||
docker run \
|
cd node
|
||||||
-v $(pwd):/io -w /io \
|
npm ci
|
||||||
quay.io/pypa/musllinux_1_1_${{ matrix.arch }} \
|
- name: Build Linux native node modules
|
||||||
bash ci/build_linux_artifacts.sh ${{ matrix.arch }}-unknown-linux-musl
|
run: bash ci/build_linux_artifacts.sh ${{ matrix.target }}
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
pre-build = [
|
pre-build = [
|
||||||
# Install newer gfortran
|
# Install newer gfortran
|
||||||
"yum install -y openssl-devel unzip gcc-gfortran",
|
"yum install -y centos-release-scl",
|
||||||
"scl enable devtoolset-11 bash",
|
"yum install -y openssl-devel unzip devtoolset-11-gcc-gfortran",
|
||||||
# protobuf is too old, so we directly download binaries
|
# protobuf is too old, so we directly download binaries
|
||||||
"PB_REL=https://github.com/protocolbuffers/protobuf/releases",
|
"PB_REL=https://github.com/protocolbuffers/protobuf/releases",
|
||||||
"PB_VERSION=23.1",
|
"PB_VERSION=23.1",
|
||||||
@@ -21,18 +21,15 @@ pre-build = [
|
|||||||
"curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
|
"curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip",
|
||||||
"unzip protoc-$PB_VERSION-linux-x86_64.zip -d /usr/local",
|
"unzip protoc-$PB_VERSION-linux-x86_64.zip -d /usr/local",
|
||||||
]
|
]
|
||||||
# https://github.com/cross-rs/cross/blob/main/docker/Dockerfile.aarch64-unknown-linux-gnu.centos
|
|
||||||
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main-centos"
|
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main-centos"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-musl]
|
[target.x86_64-unknown-linux-musl]
|
||||||
# https://github.com/cross-rs/cross/blob/main/docker/Dockerfile.x86_64-unknown-linux-musl
|
|
||||||
pre-build = [
|
pre-build = [
|
||||||
"dpkg --add-architecture $CROSS_DEB_ARCH",
|
"dpkg --add-architecture $CROSS_DEB_ARCH",
|
||||||
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH",
|
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-musl]
|
[target.aarch64-unknown-linux-musl]
|
||||||
# https://github.com/cross-rs/cross/blob/main/docker/Dockerfile.aarch64-unknown-linux-musl
|
|
||||||
pre-build = [
|
pre-build = [
|
||||||
"dpkg --add-architecture $CROSS_DEB_ARCH",
|
"dpkg --add-architecture $CROSS_DEB_ARCH",
|
||||||
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH",
|
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH",
|
||||||
|
|||||||
@@ -13,69 +13,28 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
setup_dependencies() {
|
build_node_binaries() {
|
||||||
echo "Installing system dependencies..."
|
|
||||||
if [[ $1 == *musl ]]; then
|
|
||||||
# musllinux
|
|
||||||
apk add openssl-dev
|
|
||||||
else
|
|
||||||
# manylinux2014
|
|
||||||
yum install -y openssl-devel unzip
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $1 == x86_64* ]]; then
|
|
||||||
ARCH=x86_64
|
|
||||||
else
|
|
||||||
# gnu target
|
|
||||||
ARCH=aarch_64
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install new enough protobuf (yum-provided is old)
|
|
||||||
PB_REL=https://github.com/protocolbuffers/protobuf/releases
|
|
||||||
PB_VERSION=23.1
|
|
||||||
curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-$ARCH.zip
|
|
||||||
unzip protoc-$PB_VERSION-linux-$ARCH.zip -d /usr/local
|
|
||||||
}
|
|
||||||
|
|
||||||
install_node() {
|
|
||||||
echo "Installing node..."
|
|
||||||
if [[ $1 == *musl ]]; then
|
|
||||||
apk add nodejs-current npm
|
|
||||||
else
|
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
|
|
||||||
source "$HOME"/.nvm/nvm.sh
|
|
||||||
nvm install 17 # latest that supports glibc 2.17
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_rust() {
|
|
||||||
echo "Installing rust..."
|
|
||||||
curl https://sh.rustup.rs -sSf | bash -s -- -y
|
|
||||||
export PATH="$PATH:/root/.cargo/bin"
|
|
||||||
rustup target add $1
|
|
||||||
}
|
|
||||||
|
|
||||||
build_node_binary() {
|
|
||||||
echo "Building node library for $1..."
|
|
||||||
pushd node
|
pushd node
|
||||||
|
|
||||||
if [[ $1 == *musl ]]; then
|
for target in $1
|
||||||
# This is needed for cargo to allow build cdylibs with musl
|
do
|
||||||
export RUSTFLAGS="-C target-feature=-crt-static"
|
echo "Building node library for $target"
|
||||||
fi
|
# cross doesn't yet pass this down to Docker, so we do it ourselves.
|
||||||
npm run build-release -- --target $1
|
export CROSS_CONTAINER_OPTS="--platform linux/amd64"
|
||||||
npm run pack-build -- --target $1
|
if [[ $target == *musl ]]; then
|
||||||
|
# This is needed for cargo to allow build cdylibs with musl
|
||||||
|
RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
|
fi
|
||||||
|
npm run cross-release -- --target $target
|
||||||
|
npm run pack-build -- --target $target
|
||||||
|
done
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET=${1:-x86_64-unknown-linux-gnu}
|
if [ -n "$1" ]; then
|
||||||
# Others:
|
targets=$1
|
||||||
# aarch64-unknown-linux-gnu
|
else
|
||||||
# x86_64-unknown-linux-musl
|
# targets="x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu aarch64-unknown-linux-musl x86_64-unknown-linux-musl"
|
||||||
# aarch64-unknown-linux-musl
|
targets="aarch64-unknown-linux-gnu"
|
||||||
|
fi
|
||||||
setup_dependencies $TARGET
|
build_node_binaries $targets
|
||||||
install_node
|
|
||||||
install_rust $TARGET
|
|
||||||
build_node_binary $TARGET
|
|
||||||
@@ -68,37 +68,18 @@ bash ci/build_macos_artifacts.sh
|
|||||||
|
|
||||||
### Build the Linux release libraries
|
### Build the Linux release libraries
|
||||||
|
|
||||||
To build a Linux library, we need to use docker with a different build script:
|
One-time setup, building the Docker container
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cat ci/ubuntu_build.dockerfile | docker build -t lancedb-node-build -
|
||||||
|
```
|
||||||
|
|
||||||
|
To build:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ARCH=aarch64
|
|
||||||
docker run \
|
docker run \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v $(pwd):/io -w /io \
|
-v $(pwd):/io -w /io \
|
||||||
quay.io/pypa/manylinux2014_$ARCH \
|
lancedb-node-build \
|
||||||
bash ci/build_linux_artifacts.sh $ARCH-unknown-linux-gnu
|
bash ci/build_linux_artifacts.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
You can change `ARCH` to `x86_64`.
|
|
||||||
|
|
||||||
Similar script for musl binaries:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
ARCH=aarch64
|
|
||||||
docker run \
|
|
||||||
-v $(pwd):/io -w /io \
|
|
||||||
quay.io/pypa/musllinux_1_1_$ARCH \
|
|
||||||
bash ci/build_linux_artifacts.sh $ARCH-unknown-linux-musl
|
|
||||||
```
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
For debugging, use this snippet:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
ARCH=aarch64
|
|
||||||
docker run -it \
|
|
||||||
-v $(pwd):/io -w /io \
|
|
||||||
quay.io/pypa/musllinux_1_1_$ARCH \
|
|
||||||
bash
|
|
||||||
```
|
|
||||||
-->
|
|
||||||
|
|||||||
Reference in New Issue
Block a user