bola 0.1.2

A lightweight native rust linear algebra library.
Documentation
name: Build and Test Crate

on:
  workflow_dispatch:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "*" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: Build on ${{ matrix.os }} (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: windows-latest
            target: x86_64-pc-windows-msvc
          - os: macos-13 # Explicitly use an x86 runner
            target: x86_64-apple-darwin
          - os: macos-latest # Apple Silicon M1 runner
            target: aarch64-apple-darwin

    steps:
    - name: ๐Ÿ“ฅ Checkout repository
      uses: actions/checkout@v4

    - name: ๐Ÿ› ๏ธ Install Rust toolchain
      uses: actions-rust-lang/setup-rust-toolchain@v1
      with:
        target: ${{ matrix.target }}
        toolchain: stable

    - name: ๐Ÿ—๏ธ Build library and tests in release mode
      run: cargo test --release --no-run --verbose --target ${{ matrix.target }}

    - name: โฌ†๏ธ Upload target directory
      uses: actions/upload-artifact@v4
      with:
        name: target-${{ matrix.os }}-${{ matrix.target }}
        path: target

  test:
    name: Test on ${{ matrix.os }} (${{ matrix.target }})
    needs: build
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: windows-latest
            target: x86_64-pc-windows-msvc
          - os: macos-13
            target: x86_64-apple-darwin
          - os: macos-latest
            target: aarch64-apple-darwin

    steps:
    - name: ๐Ÿ“ฅ Checkout repository
      uses: actions/checkout@v4

    - name: ๐Ÿ› ๏ธ Install Rust toolchain
      uses: actions-rust-lang/setup-rust-toolchain@v1
      with:
        target: ${{ matrix.target }}
        toolchain: stable

    - name: ๐Ÿ“ฅ Download target directory
      uses: actions/download-artifact@v4
      with:
        name: target-${{ matrix.os }}-${{ matrix.target }}
        path: target

    - name: ๐Ÿงช Run tests (without rebuilding)
      run: cargo test --release --verbose --target ${{ matrix.target }}

  benchmark:
    name: Benchmark on ${{ matrix.os }} (${{ matrix.target }})
    needs: test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: windows-latest
            target: x86_64-pc-windows-msvc
          - os: macos-13
            target: x86_64-apple-darwin
          - os: macos-latest
            target: aarch64-apple-darwin

    steps:
    - name: ๐Ÿ“ฅ Checkout repository
      uses: actions/checkout@v4

    - name: ๐Ÿ› ๏ธ Install Rust toolchain
      uses: actions-rust-lang/setup-rust-toolchain@v1
      with:
        target: ${{ matrix.target }}
        toolchain: stable
        
    - name: ๐Ÿš€ Run benchmarks
      run: cargo bench --verbose --target ${{ matrix.target }} --bench=workflow_dep