rust-roche 0.4.4

Rust translation of Tom Marsh's cpp-roche package for modelling Roche distorted stars/binary systems.
Documentation
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build and publish Rust Python extension Package

on:
  release:
    types: [published]

jobs:
  build-wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        
    steps:
      - uses: actions/checkout@v4

      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          command: build
          args: --release --out dist
          
      - name: Upload wheels
        uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}
          path: dist
      
  build-sdist:
    name: Build source distribution
    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: sdist
          path: dist
          
  pypi-publish:
    runs-on: ubuntu-latest
    needs: [build-wheels, build-sdist]
    
    permissions:
      contents: read
      id-token: write

    steps:
      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: dist

      - name: Collect all distributions
        run: |
          mkdir -p final_dist
          find dist -type f -name "*.whl" -exec mv {} final_dist \;
          find dist -type f -name "*.tar.gz" -exec mv {} final_dist \;

      - name: Publish to PyPI
        uses: PyO3/maturin-action@v1
        with:
          command: upload
          args: --non-interactive final_dist/*

  
  build_rust:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v1

    - name: Set up Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true

    - name: Build
      run: cargo build --release

    - name: Run Tests
      run: cargo test --release

    - name: Publish
      run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
      env:
        CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}