dlpack-rs 0.3.3

Portable Rust bindings for the DLPack protocol (FFI + safe wrappers + optional pyo3 glue)
Documentation
name: CI

on:
  push:
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  fmt:
    name: rustfmt check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --check

  clippy-no-default:
    name: clippy (no-default-features)
    runs-on: ubuntu-latest
    needs: fmt
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --no-default-features -- -D warnings

  clippy-pyo3:
    name: clippy (--features pyo3)
    runs-on: ubuntu-latest
    needs: fmt
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --features pyo3 -- -D warnings

  test:
    name: test (no-default-features)
    runs-on: ubuntu-latest
    needs: [clippy-no-default, clippy-pyo3]
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo test --no-default-features

  # aarch64 native job.
  # GitHub-hosted aarch64 runners are available as "ubuntu-24.04-arm" on public repos.
  # If the runner label is unavailable on your plan, replace with ubuntu-latest and add
  # a QEMU step: uses: docker/setup-qemu-action@v3 / with: platforms: linux/arm64.
  clippy-aarch64:
    name: clippy aarch64 (--features pyo3)
    runs-on: ubuntu-24.04-arm
    needs: fmt
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --features pyo3 -- -D warnings

  test-aarch64:
    name: test aarch64 (no-default-features)
    runs-on: ubuntu-24.04-arm
    needs: clippy-aarch64
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo test --no-default-features

  # Guard: ensures the committed src/bindings.rs is up to date with the vendored header.
  # Runs bindgen (requires libclang) and fails if there is any diff.
  regenerate-check:
    name: bindings regenerate-check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Install libclang
        run: sudo apt-get update && sudo apt-get install -y libclang-dev clang
      - name: Regenerate bindings
        run: cargo build --features bindgen
      - name: Check committed bindings are up to date
        run: git diff --exit-code src/bindings.rs