From 181f8e1ebf0f909220b3e0592abd88524bc16d5d Mon Sep 17 00:00:00 2001 From: Will Jones Date: Wed, 24 May 2023 20:54:47 -0700 Subject: [PATCH] try manylinux again --- .github/workflows/release.yml | 59 ++++++++++++++++++++++++----------- Cross.toml | 3 +- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d393ada..46748329 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,35 +120,58 @@ jobs: files: node/dist/vectordb-darwin*.tgz node-linux: + name: Linux ${{ matrix.settings.arch}} native node module runs-on: ubuntu-latest needs: draft-release strategy: fail-fast: false matrix: - target: - - x86_64-unknown-linux-gnu - # TODO: get release working for these targets - # - aarch64-unknown-linux-gnu - # - aarch64-unknown-linux-musl - # - x86_64-unknown-linux-musl + libc: + - gnu + - musl + settings: + - container: quay.io/pypa/manylinux2014_x86_64 + arch: x86_64 + protoc_arch: x86_64 + # TODO: find a way to build aarch64 on GA + # - container: quay.io/pypa/manylinux2014_aarch64 + # arch: aarch64 + # protoc_arch: aarch_64 + container: + image: ${{ matrix.settings.container }} + options: --platform linux/amd64 + defaults: + run: + shell: bash + working-directory: node steps: - name: Checkout uses: actions/checkout@v2 - - name: Setup Rust - uses: ATiltedTree/setup-rust@v1 - with: - rust-version: stable - name: Install system dependencies run: | - sudo apt update - sudo apt install -y protobuf-compiler libssl-dev - cargo install cross - - name: Install npm dependencies + yum install -y openssl-devel unzip + # 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-${{ matrix.settings.protoc_arch }}.zip + unzip protoc-$PB_VERSION-linux-${{ matrix.settings.protoc_arch }}.zip -d /usr/local + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 17 # Last that support glibc 2.17 + - name: Setup Rust run: | - cd node - npm ci - - name: Build Linux native node modules - run: bash ci/build_linux_artifacts.sh ${{ matrix.target }} + curl https://sh.rustup.rs -sSf | bash -s -- -y + echo "/root/.cargo/bin" >> $GITHUB_PATH + - name: Install npm dependencies + run: npm ci + - name: Build ${{ matrix.settings.libc }} library + run: | + BUILD_TARGET=${{ matrix.settings.arch }}-unknown-linux-${{ matrix.settings.libc }} + rustup target add $BUILD_TARGET + export RUSTFLAGS="-C target-feature=-crt-static" # for musl + npm run build-release -- --target $BUILD_TARGET + npm run pack-build -- --target $BUILD_TARGET - uses: softprops/action-gh-release@v1 with: draft: true diff --git a/Cross.toml b/Cross.toml index 0ee2864f..e9396965 100644 --- a/Cross.toml +++ b/Cross.toml @@ -2,8 +2,7 @@ [target.x86_64-unknown-linux-gnu] pre-build = [ # Install newer gfortran - "yum install -y centos-release-scl", - "yum install -y openssl-devel unzip devtoolset-11-gcc-gfortran", + "yum install -y openssl-devel unzip gcc-gfortran", "scl enable devtoolset-11 bash", # protobuf is too old, so we directly download binaries "PB_REL=https://github.com/protocolbuffers/protobuf/releases",