pyo3-dlpack 0.3.0

Zero-copy DLPack tensor interop for PyO3
Documentation
name: CI

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

jobs:
  lint:
    name: Lint (fmt + clippy)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - name: Rustfmt
        run: cargo fmt --all -- --check
      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

  msrv:
    name: MSRV (1.83)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@1.83
      - uses: Swatinem/rust-cache@v2
      # Check the library against the declared rust-version in Cargo.toml.
      # Dev-dependencies (criterion) may require a newer toolchain, so we
      # deliberately scope this to the public crate, not --all-targets.
      - name: Cargo check (all features)
        run: cargo check --all-features

  semver:
    name: Semver checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      # Compares the current API surface against the latest version published
      # on crates.io and fails if the change is more breaking than the version
      # bump implies. Prevents accidental breaking changes in patch/minor releases.
      - name: Check semver compatibility
        uses: obi1kenobi/cargo-semver-checks-action@v2

  test:
    name: Tests (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - uses: actions/setup-python@v6
        with:
          python-version: "3.11"
      - name: Install dependencies
        run: pip install maturin pytest numpy
      - name: Rust unit tests
        run: cargo test --lib
      - name: Build and install test module
        shell: bash
        run: |
          maturin build --manifest-path tests/python_helpers/Cargo.toml -o dist
          pip install --no-deps dist/*.whl
      - name: Python integration tests
        run: pytest tests/test_dlpack_integration.py -v