prollytree 0.3.4

A prolly (probabilistic) tree for efficient storage, retrieval, and modification of ordered data.
Documentation
name: Build Python Package

on:
  pull_request:
    types: [opened, ready_for_review, synchronize]
    paths:
      - 'python/**'
      - 'src/python.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'pyproject.toml'
      - '.github/workflows/python.yml'
  push:
    branches:
      - main
    paths:
      - 'python/**'
      - 'src/python.rs'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'pyproject.toml'
      - '.github/workflows/python.yml'

jobs:
  build-wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          # Linux. Pinned to manylinux_2_28 (AlmaLinux 8) because manylinux2014
          # (CentOS 7) ships libclang 3.4 — too old for zstd-sys/bindgen, which
          # needs clang_getTranslationUnitTargetInfo (libclang ≥ 6.0).
          - os: ubuntu-latest
            target: x86_64
            manylinux: 2_28
#          - os: ubuntu-latest
#            target: aarch64
#            manylinux: auto
#          # Windows
#          - os: windows-latest
#            target: x64
#            manylinux: false
#          - os: windows-latest
#            target: x86
#            manylinux: false
#          # macOS
#          - os: macos-latest
#            target: x86_64
#            manylinux: false
#          - os: macos-14
#            target: aarch64
#            manylinux: false

    steps:
    - uses: actions/checkout@v4

    - name: Setup Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.11'

    - name: Build wheels (CPython only)
      uses: PyO3/maturin-action@v1
      env:
        # Ensure PyO3 doesn't try to use PyPy
        PYO3_CROSS_PYTHON_VERSION: "3.11"
      with:
        target: ${{ matrix.target }}
        args: --release --out dist --features python,git,sql,rocksdb_storage --interpreter python3.11
        sccache: 'true'
        manylinux: ${{ matrix.manylinux }}
        rust-toolchain: stable
        before-script-linux: |
          # librocksdb-sys needs:
          #   - clang/libclang for bindgen
          #   - a C++ toolchain (g++) to compile RocksDB itself
          #   - glibc-devel for `bits/libc-header-start.h` (missing in aarch64
          #     manylinux_2_28 by default; harmless on x86_64)
          if command -v yum >/dev/null 2>&1; then
            yum install -y clang gcc gcc-c++ glibc-devel
          elif command -v apt-get >/dev/null 2>&1; then
            apt-get update && apt-get install -y --no-install-recommends clang g++ libc6-dev
          fi

    - name: Configure git identity for tests
      if: runner.os == 'Linux'
      run: |
        git config --global user.name  "CI Test"
        git config --global user.email "ci@example.com"

    - name: Install wheel and pytest
      if: runner.os == 'Linux'
      run: |
        python -m pip install --upgrade pip
        python -m pip install pytest
        # Install the wheel built for this runner's platform.
        WHEEL=$(ls dist/prollytree-*-cp38-abi3-manylinux*_${{ matrix.target }}.whl | head -1)
        echo "Installing $WHEEL"
        python -m pip install --force-reinstall "$WHEEL"

    - name: Run Python tests (storage backends)
      if: runner.os == 'Linux'
      # Scoped to the backend-coverage file; other test files have unrelated
      # pre-existing setup issues (e.g. test_sql.py fixture doesn't git-init
      # its tempdir). Broaden once those are fixed.
      run: |
        python -m pytest python/tests/test_versioned_kv.py -v

    - name: Upload wheels
      uses: actions/upload-artifact@v4
      with:
        name: wheels-${{ matrix.os }}-${{ matrix.target }}
        path: dist