# We create a composite action to be re-used both for testing and for releasing name: build-linux-wheel description: "Build a manylinux wheel for lance" inputs: python-minor-version: description: "10, 11, 12, 13" required: true args: description: "--release" required: false default: "" arm-build: description: "Build for arm64 instead of x86_64" # Note: this does *not* mean the host is arm64, since we might be cross-compiling. required: false default: "false" manylinux: description: "The manylinux version to build for" required: false default: "2_17" package-name: description: "Override [project] name in python/pyproject.toml (e.g. 'lancedb-compat'). Default keeps 'lancedb'." required: false default: "lancedb" rustflags: description: "RUSTFLAGS for the build container, as a single whitespace-free token (e.g. '-Ctarget-cpu=x86-64-v2'). Empty leaves RUSTFLAGS unset, keeping the defaults from .cargo/config.toml." required: false default: "" runs: using: "composite" steps: - name: CONFIRM ARM BUILD shell: bash env: ARM_BUILD: ${{ inputs.arm-build }} run: | echo "ARM BUILD: $ARM_BUILD" - name: Patch package name for variant build if: ${{ inputs.package-name != 'lancedb' }} shell: bash env: PACKAGE_NAME: ${{ inputs.package-name }} run: | # Swap the [project] name so this build produces e.g. lancedb-compat # wheels. The package still installs files under the lancedb/ # namespace -- import lancedb still works after pip install. sed -i.bak 's/^name = "lancedb"$/name = "'"$PACKAGE_NAME"'"/' python/pyproject.toml rm -f python/pyproject.toml.bak grep '^name = ' python/pyproject.toml - name: Build x86_64 Manylinux wheel if: ${{ inputs.arm-build == 'false' }} uses: PyO3/maturin-action@v1 with: maturin-version: "1.12.4" command: build working-directory: python docker-options: "-e PIP_EXTRA_INDEX_URL='https://pypi.fury.io/lance-format/ https://pypi.fury.io/lancedb/' -e PROTOC=/usr/local/bin/protoc ${{ inputs.rustflags != '' && format('-e RUSTFLAGS={0}', inputs.rustflags) || '' }}" target: x86_64-unknown-linux-gnu manylinux: ${{ inputs.manylinux }} args: ${{ inputs.args }} before-script-linux: | set -e curl -fsSL https://github.com/protocolbuffers/protobuf/releases/download/v24.4/protoc-24.4-linux-x86_64.zip -o /tmp/protoc.zip unzip /tmp/protoc.zip -d /usr/local rm /tmp/protoc.zip /usr/local/bin/protoc --version - name: Build Arm Manylinux Wheel if: ${{ inputs.arm-build == 'true' }} uses: PyO3/maturin-action@v1 with: maturin-version: "1.12.4" command: build working-directory: python docker-options: "-e PIP_EXTRA_INDEX_URL='https://pypi.fury.io/lance-format/ https://pypi.fury.io/lancedb/' -e PROTOC=/usr/local/bin/protoc ${{ inputs.rustflags != '' && format('-e RUSTFLAGS={0}', inputs.rustflags) || '' }}" target: aarch64-unknown-linux-gnu manylinux: ${{ inputs.manylinux }} args: ${{ inputs.args }} before-script-linux: | set -e yum install -y clang curl -fsSL https://github.com/protocolbuffers/protobuf/releases/download/v24.4/protoc-24.4-linux-aarch_64.zip -o /tmp/protoc.zip unzip /tmp/protoc.zip -d /usr/local rm /tmp/protoc.zip /usr/local/bin/protoc --version