From 0028b95fd828c6fb1d55b33b4222d8cc15cbde92 Mon Sep 17 00:00:00 2001 From: Will Jones Date: Thu, 25 May 2023 09:59:07 -0700 Subject: [PATCH] mac debug info --- .github/workflows/node.yml | 71 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 7 +++- ci/build_linux_artifacts.sh | 6 ++- ci/build_macos_artifacts.sh | 2 + node/package.json | 3 +- 5 files changed, 84 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 5a6c81e8..49780ee2 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -103,3 +103,74 @@ jobs: - name: Test run: | npm run test + node-macos: + runs-on: macos-12 + # needs: draft-release + strategy: + fail-fast: false + matrix: + target: [x86_64-apple-darwin, aarch64-apple-darwin] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install system dependencies + run: brew install protobuf + - name: Install npm dependencies + run: | + cd node + npm ci + - name: Install rustup target + if: ${{ matrix.target == 'aarch64-apple-darwin' }} + run: rustup target add aarch64-apple-darwin + - name: Build MacOS native node modules + run: bash ci/build_macos_artifacts.sh ${{ matrix.target }} + # - uses: softprops/action-gh-release@v1 + # 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 }}) + runs-on: ubuntu-latest + # needs: draft-release + strategy: + fail-fast: false + matrix: + libc: + - gnu + # 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: Setup tmate session + uses: mxschmitt/action-tmate@v3 + - name: Build Linux GNU native node modules + if: ${{ matrix.libc == 'gnu' }} + run: | + docker run \ + -v $(pwd):/io -w /io \ + quay.io/pypa/manylinux2014_${{ matrix.arch }} \ + bash ci/build_linux_artifacts.sh ${{ matrix.arch }}-unknown-linux-gnu + - name: Build musl Linux native node modules + if: ${{ matrix.libc == 'musl' }} + 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 + # - uses: softprops/action-gh-release@v1 + # with: + # draft: true + # files: node/dist/vectordb-linux*.tgz + # fail_on_unmatched_files: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 387f9c00..6d8f0253 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: Prepare Release -# Based on https://github.com/dherman/neon-prebuild-example/blob/eaa4d33d682e5eb7abbc3da7aed153a1b1acb1b3/.github/workflows/publish.yml +# TODO: bump versions in CI +# TODO: keep python release separate for now. on: push: @@ -137,7 +138,7 @@ jobs: # - musl arch: - x86_64 - - aarch64 + # - aarch64 steps: - name: Checkout uses: actions/checkout@v2 @@ -146,6 +147,8 @@ jobs: uses: docker/setup-qemu-action@v2 with: platforms: arm64 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 - name: Build Linux GNU native node modules if: ${{ matrix.libc == 'gnu' }} run: | diff --git a/ci/build_linux_artifacts.sh b/ci/build_linux_artifacts.sh index b4975c70..328358ef 100644 --- a/ci/build_linux_artifacts.sh +++ b/ci/build_linux_artifacts.sh @@ -44,9 +44,9 @@ install_node() { # 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 + nvm install -s --no-progress 17 else - nvm install 17 # latest that supports glibc 2.17 + nvm install --no-progress 17 # latest that supports glibc 2.17 fi printenv @@ -77,6 +77,8 @@ build_node_binary() { fi # We don't pass in target, since the native target here already matches # and openblas-src doesn't do well with cross-compilation. + source ~/.bashrc + npm run check-npm --script-shell bash npm run build-release --script-shell bash npm run pack-build --script-shell bash diff --git a/ci/build_macos_artifacts.sh b/ci/build_macos_artifacts.sh index 5cea8b0c..a30a936e 100644 --- a/ci/build_macos_artifacts.sh +++ b/ci/build_macos_artifacts.sh @@ -33,4 +33,6 @@ if [ -n "$1" ]; then else targets="x86_64-apple-darwin aarch64-apple-darwin" fi + +prebuild_rust $targets build_node_binaries $targets \ No newline at end of file diff --git a/node/package.json b/node/package.json index 1c070ee8..9cc8bbf9 100644 --- a/node/package.json +++ b/node/package.json @@ -11,7 +11,8 @@ "cross-release": "cargo-cp-artifact --artifact cdylib vectordb-node index.node -- cross build --message-format=json --release -p vectordb-node", "test": "mocha -recursive dist/test", "lint": "eslint src --ext .js,.ts", - "pack-build": "neon pack-build" + "pack-build": "neon pack-build", + "check-npm": "printenv && which node && which npm && npm --version" }, "repository": { "type": "git",