From 500aa7b0020ef381565bfb45b493a299c81a576f Mon Sep 17 00:00:00 2001 From: Will Jones Date: Thu, 25 May 2023 09:04:07 -0700 Subject: [PATCH] give up on musl for now --- .github/workflows/release.yml | 16 ++++++++++-- ci/build_linux_artifacts.sh | 26 +++++++++++--------- {rust/ffi/node => ci}/release_process.md | 7 ++++++ ci/ubuntu_build.dockerfile | 31 ------------------------ 4 files changed, 35 insertions(+), 45 deletions(-) rename {rust/ffi/node => ci}/release_process.md (94%) delete mode 100644 ci/ubuntu_build.dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 272595bb4..758cb8a53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,7 @@ jobs: with: draft: true files: target/vectordb-*.crate + fail_on_unmatched_files: true python: runs-on: ubuntu-latest @@ -66,6 +67,7 @@ jobs: files: | python/dist/lancedb-*.tar.gz python/dist/lancedb-*.whl + fail_on_unmatched_files: true node: runs-on: ubuntu-latest @@ -95,6 +97,7 @@ jobs: with: draft: true files: node/vectordb-*.tgz + fail_on_unmatched_files: true node-macos: runs-on: macos-12 @@ -118,6 +121,7 @@ jobs: with: draft: true files: node/dist/vectordb-darwin*.tgz + fail_on_unmatched_files: true node-linux: name: node-linux (${{ matrix.arch}}-unknown-linux-${{ matrix.libc }}) @@ -128,13 +132,20 @@ jobs: matrix: libc: - gnu - - musl + # TODO: re-enable musl once we have refactored to pre-built containers + # Right now we have to build node from source which is too expensive. + # - musl arch: - x86_64 - aarch64 steps: - name: Checkout uses: actions/checkout@v2 + - name: Set up QEMU + if: ${{ matrix.arch == 'aarch64' }} + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 - name: Build Linux GNU native node modules if: ${{ matrix.libc == 'gnu' }} run: | @@ -145,7 +156,7 @@ jobs: - name: Build musl Linux native node modules if: ${{ matrix.libc == 'musl' }} run: | - docker run \ + docker run --platform linux/arm64/v8 \ -v $(pwd):/io -w /io \ quay.io/pypa/musllinux_1_1_${{ matrix.arch }} \ bash ci/build_linux_artifacts.sh ${{ matrix.arch }}-unknown-linux-musl @@ -153,6 +164,7 @@ jobs: with: draft: true files: node/dist/vectordb-linux*.tgz + fail_on_unmatched_files: true release: needs: [python, node, node-macos, node-linux, rust] diff --git a/ci/build_linux_artifacts.sh b/ci/build_linux_artifacts.sh index 515e99233..1f59c0d82 100644 --- a/ci/build_linux_artifacts.sh +++ b/ci/build_linux_artifacts.sh @@ -7,10 +7,7 @@ # - aarch64-unknown-linux-musl # - x86_64-unknown-linux-musl -# On MacOS, need to run in a linux container: -# docker run -v $(pwd):/io -w /io - -# Must run rustup toolchain install stable-x86_64-unknown-linux-gnu --force-non-host +# TODO: refactor this into a Docker container we can pull set -e @@ -40,11 +37,15 @@ setup_dependencies() { install_node() { echo "Installing node..." + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash + source "$HOME"/.bashrc + if [[ $1 == *musl ]]; then - apk add nodejs-current npm + # This node version is 15, we need 16 or higher: + # apk add nodejs-current npm + # So instead we install from source (nvm doesn't provide binaries for musl): + nvm install -s 17 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 } @@ -53,7 +54,6 @@ 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() { @@ -64,8 +64,10 @@ build_node_binary() { # This is needed for cargo to allow build cdylibs with musl export RUSTFLAGS="-C target-feature=-crt-static" fi - npm run build-release -- --target $1 - npm run pack-build -- --target $1 + # We don't pass in target, since the native target here already matches + # and openblas-src doesn't do well with cross-compilation. + npm run build-release + npm run pack-build popd } @@ -77,6 +79,6 @@ TARGET=${1:-x86_64-unknown-linux-gnu} # aarch64-unknown-linux-musl setup_dependencies $TARGET -install_node -install_rust $TARGET +install_node $TARGET +install_rust build_node_binary $TARGET diff --git a/rust/ffi/node/release_process.md b/ci/release_process.md similarity index 94% rename from rust/ffi/node/release_process.md rename to ci/release_process.md index 99b688c02..8beca8311 100644 --- a/rust/ffi/node/release_process.md +++ b/ci/release_process.md @@ -102,3 +102,10 @@ docker run -it \ bash ``` --> + +``` +docker run \ + -v $(pwd):/io -w /io \ + quay.io/pypa/musllinux_1_1_aarch64 \ + bash alpine_repro.sh +``` \ No newline at end of file diff --git a/ci/ubuntu_build.dockerfile b/ci/ubuntu_build.dockerfile deleted file mode 100644 index fd6c30205..000000000 --- a/ci/ubuntu_build.dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -# On MacOS, need to run in a linux container: -# cat ci/ubuntu_build.dockerfile | docker build -t lancedb-node-build - -# docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/io -w /io lancedb-node-build bash ci/build_linux_artifacts.sh -FROM ubuntu:20.04 - -ARG DEBIAN_FRONTEND=noninteractive -ENV TZ=Europe/Moscow - -RUN apt update && apt install -y protobuf-compiler libssl-dev build-essential curl \ - software-properties-common npm docker.io - -# Install rust -RUN curl https://sh.rustup.rs -sSf | bash -s -- -y - -ENV PATH="/root/.cargo/bin:${PATH}" - -# Install cross -# https://github.com/cross-rs/cross/issues/1257#issuecomment-1544553706 -RUN cargo install cross --git https://github.com/cross-rs/cross - -# Install additional build targets -RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu aarch64-unknown-linux-musl x86_64-unknown-linux-musl - -# Install node -RUN npm install npm@latest -g && \ - npm install n -g && \ - n latest - -# set CROSS_CONTAINER_IN_CONTAINER to inform `cross` that it is executed from within a container -ENV CROSS_CONTAINER_IN_CONTAINER=true -ENV CROSS_CONTAINER_ENGINE_NO_BUILDKIT=1