simd-r-drive 0.8.0-alpha

SIMD-optimized append-only schema-less storage engine. Key-based binary storage in a single-file storage container.
Documentation
name: Build Python WebSocket Wheels

on:
  push:
    tags:
      - "python-v*"
    paths:
      - "experiments/bindings/python-ws-client/**"
      - ".github/workflows/*.yml"
  pull_request:
    paths:
      - "experiments/bindings/python-ws-client/**"
      - ".github/workflows/*.yml"

jobs:
  build:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    env:
      # This was opted for instead of using `working-directory`, which breaks
      # tools like `maturin` and `cibuildwheel` that expect the workspace root.
      PYTHON_BINDING_DIR: experiments/bindings/python-ws-client
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install uv
        run: |
          curl -LsSf https://astral.sh/uv/install.sh | sh
          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
        shell: bash

      - name: Run integration and unit tests
        run: |
          chmod +x experiments/bindings/python-ws-client/integration_test.sh
          ./experiments/bindings/python-ws-client/integration_test.sh
        shell: bash

      - name: Install cibuildwheel
        run: uv pip install --system cibuildwheel==2.23.3
        shell: bash

      # Note: Using `working-directory` here is problematic due to relative path linking
      - name: Build wheels
        env:
          CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-* pp* *-manylinux_i686 *-musllinux_*"
        run: cibuildwheel "${{ env.PYTHON_BINDING_DIR }}" --output-dir "${{ env.PYTHON_BINDING_DIR }}/dist"
        shell: bash

      - name: Upload wheels
        uses: actions/upload-artifact@v4
        with:
          name: simd-r-drive-ws-client-wheels-${{ matrix.os }}
          path: ${{ env.PYTHON_BINDING_DIR }}/dist/*.whl

  publish:
    name: Upload wheels to PyPI
    needs: build
    runs-on: ubuntu-latest

    # Accept tags like: python-v0.3.0-test or python-v0.3.0
    # Example test tagging:
    #   git tag python-v0.3.0-test (or `*-test2`, etc)
    #   git push origin python-v0.3.0-test (or `*-test2`, etc)
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/python-v')

    steps:
      - uses: actions/checkout@v4

      - name: Download built wheels from all platforms
        uses: actions/download-artifact@v4
        with:
          pattern: simd-r-drive-ws-client-wheels-*
          merge-multiple: true
          path: dist

      - name: Determine PyPI repository and token
        id: pypi
        run: |
          if [[ "${GITHUB_REF}" == *-test* ]]; then
            echo "url=https://test.pypi.org/legacy/" >> $GITHUB_OUTPUT
            echo "token=${{ secrets.PYPI_TEST_API_TOKEN }}" >> $GITHUB_OUTPUT
          else
            echo "url=https://upload.pypi.org/legacy/" >> $GITHUB_OUTPUT
            echo "token=${{ secrets.PYPI_API_TOKEN }}" >> $GITHUB_OUTPUT
          fi

      - name: Upload to PyPI (or Test PyPI)
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          repository-url: ${{ steps.pypi.outputs.url }}
          user: __token__
          password: ${{ steps.pypi.outputs.token }}