| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # Publish the paimon Python binding to PyPI. |
| # Trigger: push tag only (e.g. v0.1.0). |
| # Pre-release tags (containing '-') publish to TestPyPI; release tags publish to PyPI. |
| # |
| # Token auth: add secrets PYPI_API_TOKEN / TEST_PYPI_API_TOKEN for publishing. |
| |
| name: Release Python Binding |
| |
| on: |
| push: |
| tags: |
| - "v[0-9]+.[0-9]+.[0-9]+" |
| - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" |
| workflow_dispatch: |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} |
| cancel-in-progress: true |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| sdist: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v7 |
| |
| - uses: PyO3/maturin-action@v1 |
| with: |
| working-directory: bindings/python |
| command: sdist |
| args: -o dist |
| before-script-linux: | |
| sudo apt-get update && sudo apt-get install -y libssl-dev |
| |
| - name: Upload sdist |
| uses: actions/upload-artifact@v7 |
| with: |
| name: wheels-sdist |
| path: bindings/python/dist |
| |
| wheels: |
| runs-on: ${{ matrix.os }} |
| strategy: |
| matrix: |
| include: |
| - { os: windows-latest } |
| - { os: macos-15-intel, target: "x86_64-apple-darwin" } |
| - { os: macos-latest, target: "aarch64-apple-darwin" } |
| - { os: ubuntu-latest, target: "x86_64" } |
| - { os: ubuntu-latest, target: "aarch64", manylinux: "manylinux_2_28" } |
| steps: |
| - uses: actions/checkout@v7 |
| |
| - uses: PyO3/maturin-action@v1 |
| with: |
| working-directory: bindings/python |
| target: ${{ matrix.target }} |
| command: build |
| args: --release -o dist |
| manylinux: ${{ matrix.manylinux || 'auto' }} |
| before-script-linux: | |
| # Install OpenSSL for x86_64 (manylinux2014 with OpenSSL 1.1) |
| if [ "${{ matrix.target }}" = "x86_64" ]; then |
| yum install -y openssl11-devel |
| # Create symlinks so pkg-config finds openssl11 as openssl |
| ln -sf /usr/lib64/pkgconfig/openssl11.pc /usr/lib64/pkgconfig/openssl.pc |
| ln -sf /usr/lib64/pkgconfig/libssl11.pc /usr/lib64/pkgconfig/libssl.pc |
| ln -sf /usr/lib64/pkgconfig/libcrypto11.pc /usr/lib64/pkgconfig/libcrypto.pc |
| fi |
| |
| # Install precompiled OpenSSL from Debian packages for aarch64 |
| if [ "${{ matrix.target }}" = "aarch64" ]; then |
| set -e |
| echo "Installing OpenSSL for aarch64 from Debian packages..." |
| |
| (cd /tmp |
| # Debian Bullseye arm64 packages (OpenSSL 1.1.1) |
| DEBIAN_MIRROR="http://ftp.debian.org/debian/pool/main/o/openssl" |
| curl -sLO "${DEBIAN_MIRROR}/libssl1.1_1.1.1w-0+deb11u1_arm64.deb" |
| curl -sLO "${DEBIAN_MIRROR}/libssl-dev_1.1.1w-0+deb11u1_arm64.deb" |
| |
| # Extract .deb packages (ar format) |
| for deb in *.deb; do |
| ar x "$deb" |
| tar xf data.tar.* |
| rm -f debian-binary control.tar.* data.tar.* |
| done |
| |
| # Install to maturin's expected location |
| TARGET_DIR="/usr/aarch64-unknown-linux-gnu" |
| mkdir -p "${TARGET_DIR}/include/openssl" "${TARGET_DIR}/lib" |
| |
| # Copy main OpenSSL headers (architecture-independent) |
| cp -r usr/include/openssl/* "${TARGET_DIR}/include/openssl/" |
| |
| # Overwrite with architecture-specific headers |
| cp -f usr/include/aarch64-linux-gnu/openssl/configuration.h "${TARGET_DIR}/include/openssl/" || true |
| cp -f usr/include/aarch64-linux-gnu/openssl/opensslconf.h "${TARGET_DIR}/include/openssl/" || true |
| |
| # Copy libraries |
| cp -a usr/lib/aarch64-linux-gnu/libssl* "${TARGET_DIR}/lib/" |
| cp -a usr/lib/aarch64-linux-gnu/libcrypto* "${TARGET_DIR}/lib/" |
| |
| # Verify |
| echo "✓ OpenSSL installed" |
| ls "${TARGET_DIR}/lib/libssl.a" && echo "✓ libssl.a found" |
| ls "${TARGET_DIR}/include/openssl/opensslv.h" && echo "✓ opensslv.h found" |
| ls "${TARGET_DIR}/include/openssl/opensslconf.h" && echo "✓ opensslconf.h found" |
| ) # End subshell |
| |
| # Fix ring crate build: define ARM architecture version for aarch64 |
| export CFLAGS_aarch64_unknown_linux_gnu="-D__ARM_ARCH=8" |
| fi |
| |
| - name: Upload wheels |
| uses: actions/upload-artifact@v7 |
| with: |
| name: wheels-${{ matrix.os }}-${{ matrix.target || 'native' }} |
| path: bindings/python/dist |
| |
| release: |
| name: Publish to PyPI |
| runs-on: ubuntu-latest |
| permissions: |
| contents: read |
| needs: [sdist, wheels] |
| if: startsWith(github.ref, 'refs/tags/') |
| steps: |
| - uses: actions/download-artifact@v8 |
| with: |
| pattern: wheels-* |
| merge-multiple: true |
| path: bindings/python/dist |
| |
| - name: Publish to TestPyPI |
| if: contains(github.ref, '-') |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b |
| with: |
| repository-url: https://test.pypi.org/legacy/ |
| skip-existing: true |
| packages-dir: bindings/python/dist |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| |
| - name: Publish to PyPI |
| if: ${{ !contains(github.ref, '-') }} |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b |
| with: |
| skip-existing: true |
| packages-dir: bindings/python/dist |
| password: ${{ secrets.PYPI_API_TOKEN }} |