readcon-db 0.1.2

Mmap-backed CON frame corpus (Heed/LMDB), xxHash exact match, multi-language FFI
Documentation
name: Python wheels

on:
  push:
    tags:
      - 'v*'
  pull_request:
    paths:
      - 'src/**'
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'python/**'
      - '.github/workflows/python_wheels.yml'
  workflow_dispatch:

concurrency:
  group: python-wheels-${{ github.ref }}
  cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}

permissions:
  contents: read

env:
  CARGO_HTTP_MULTIPLEXING: "false"
  CARGO_NET_RETRY: "10"
  CARGO_HTTP_TIMEOUT: "120"
  RUSTFLAGS: "-C link-arg=-fuse-ld=bfd"
  CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: "cc"

jobs:
  sdist:
    name: Build sdist
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --manifest-path python/pyproject.toml --out dist
      - name: Validate sdist
        run: pipx run twine check --strict dist/*
      - uses: actions/upload-artifact@v4
        with:
          name: sdist
          path: dist/*.tar.gz
          if-no-files-found: error

  wheels:
    name: Wheel (${{ matrix.os }}, ${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64
          - os: macos-14
            target: aarch64
          - os: macos-15
            target: x86_64
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          manylinux: auto
          args: >-
            --release --out dist --features python --find-interpreter
            --manifest-path python/pyproject.toml
          docker-options: >-
            -e CARGO_HTTP_MULTIPLEXING=false
            -e CARGO_NET_RETRY=10
            -e CARGO_HTTP_TIMEOUT=120
      - name: Validate wheels
        if: matrix.target != 'aarch64' || runner.os != 'Linux'
        run: pipx run twine check --strict dist/*
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.target }}
          path: dist/*.whl
          if-no-files-found: error

  publish:
    name: Publish to PyPI
    needs: [sdist, wheels]
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/v')
    environment:
      name: pypi
      url: https://pypi.org/p/readcon-db
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: '{sdist,wheels-*}'
          merge-multiple: true
          path: dist/
      - name: List artifacts
        run: ls -la dist/
      # Configure Trusted Publisher on PyPI for project readcon-db:
      # owner lode-org, repo readcon-db, workflow python_wheels.yml, environment pypi
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          skip-existing: true