luwen 0.8.5

A high-level interface for Tenstorrent AI accelerators
Documentation
name: Build

on:
  workflow_call:
    inputs:
      ref:
        default: ${{ github.ref }}
        required: false
        type: string
      upload:
        default: false
        required: false
        type: boolean
  workflow_dispatch:
    inputs:
      upload:
        description: Upload artifacts
        required: false
        default: true
        type: boolean

permissions:
  contents: read

jobs:

  # Build Rust crates
  rs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - name: Install protoc
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Build workspace
        run: cargo build --workspace

  # Build Python wheels.
  py:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - python-version: "3.10"
            args: >-
              --release --out dist
              -m bind/pyluwen/Cargo.toml
              --interpreter python3.10
            artifact: wheels-cp310
          - python-version: "3.11"
            args: >-
              --release --sdist --out dist
              -m bind/pyluwen/Cargo.toml
            artifact: wheels-abi3
    steps:
      - uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - uses: actions/setup-python@v6
        with:
          python-version: ${{ matrix.python-version }}
      - name: Build wheel
        uses: PyO3/maturin-action@v1
        with:
          target: x86_64
          manylinux: 2_28
          args: ${{ matrix.args }}
          before-script-linux: |
            dnf install -y protobuf-compiler
      - name: Store wheel
        if: inputs.upload
        uses: actions/upload-artifact@v7
        with:
          name: ${{ matrix.artifact }}
          path: dist