rustygraph 0.4.2

A high-performance library for visibility graph computation from time series data
Documentation
name: Publish Python Package

on:
  push:
    branches: [ "main" ]
    paths:
      - 'src/**'
      - 'python/**'
      - 'pyproject.toml'
      - 'Cargo.toml'
      - 'Cargo.lock'
  workflow_dispatch:  # Allow manual triggering

jobs:
  # Build wheels for Linux
  linux:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target: [x86_64, aarch64]
    steps:
    - uses: actions/checkout@v4

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

    - name: Build wheels
      uses: PyO3/maturin-action@v1
      with:
        target: ${{ matrix.target }}
        args: --release --out dist --find-interpreter
        sccache: 'true'
        manylinux: auto

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

  # Build wheels for macOS
  macos:
    runs-on: macos-latest
    strategy:
      matrix:
        target: [aarch64]
    steps:
    - uses: actions/checkout@v4

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

    - name: Build wheels
      uses: PyO3/maturin-action@v1
      with:
        target: ${{ matrix.target }}
        args: --release --out dist --find-interpreter
        sccache: 'true'

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

  # Build wheels for Windows
  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        target: [x64]
    steps:
    - uses: actions/checkout@v4

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

    - name: Build wheels
      uses: PyO3/maturin-action@v1
      with:
        target: ${{ matrix.target }}
        args: --release --out dist --find-interpreter
        sccache: 'true'

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

  # Build source distribution
  sdist:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - name: Build sdist
      uses: PyO3/maturin-action@v1
      with:
        command: sdist
        args: --out dist

    - name: Upload sdist
      uses: actions/upload-artifact@v4
      with:
        name: wheels-sdist
        path: dist

  # Publish to PyPI
  release:
    name: Release to PyPI
    runs-on: ubuntu-latest
    needs: [linux, macos, windows, sdist]
    permissions:
      id-token: write  # Required for trusted publishing
    steps:
    - uses: actions/download-artifact@v4
      with:
        pattern: wheels-*
        merge-multiple: true
        path: dist

    - name: Publish to PyPI
      uses: PyO3/maturin-action@v1
      with:
        command: upload
        args: --non-interactive --skip-existing dist/*
      env:
        MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}