instmodel_inference 0.9.0

High-performance neural network inference library with instruction-based execution
Documentation
name: CI

on:
  push:
    branches: [main]
    tags:
      - 'v*'
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          components: rustfmt, clippy

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Clippy
        run: cargo clippy --all-features -- -D warnings

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1

      - name: Run unit tests
        run: cargo test --lib

      - name: Run integration tests (excluding GPU tests - no GPU in CI)
        run: |
          for test_file in tests/*.rs; do
            test_name=$(basename "$test_file" .rs)
            if [ "$test_name" != "gpu_inference_test" ]; then
              cargo test --test "$test_name"
            fi
          done

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1

      - name: Build release
        run: cargo build --release

  publish:
    name: Publish
    runs-on: ubuntu-latest
    needs: [lint, test, build]
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1

      - name: Verify version matches tag
        run: |
          TAG_VERSION="${GITHUB_REF#refs/tags/v}"
          CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
          if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
            echo "Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
            exit 1
          fi
          echo "Version verified: $CARGO_VERSION"

      - name: Publish to crates.io
        run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}