fastembed 5.16.1

Library for generating vector embeddings, reranking locally.
name: "Cargo Tests"
on:
  pull_request:
  push:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-Dwarnings"
  ONNX_VERSION: v1.24.4

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Rust Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Free Disk Space
        uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
        with:
          # this might remove tools that are actually needed,
          tool-cache: false

      - name: Restore Builds
        id: cache-build-restore
        uses: actions/cache/restore@v4
        with:
          key: '${{ runner.os }}-onnxruntime-${{ env.ONNX_VERSION }}'
          path: |
            onnxruntime/build/Linux/Release/

      - name: Compile ONNX Runtime for Linux
        if: steps.cache-build-restore.outputs.cache-hit != 'true'
        run: |
          echo Cloning ONNX Runtime repository...
          git clone https://github.com/microsoft/onnxruntime --recursive --branch $ONNX_VERSION --single-branch --depth 1
          cd onnxruntime
          ./build.sh --update --build --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync
          cd ..

      - name: Cargo Test With Release Build
        run: ORT_LIB_LOCATION="$(pwd)/onnxruntime/build/Linux/Release" cargo test --release --no-default-features --features hf-hub-native-tls,image-models

      - name: Cargo Test Offline
        run: ORT_LIB_LOCATION="$(pwd)/onnxruntime/build/Linux/Release" cargo test --no-default-features --features image-models

      - name: Cargo Clippy
        run: cargo clippy

      - name: Cargo FMT
        run: cargo fmt --all -- --check

      - name: Always Save Cache
        id: cache-build-save
        if: always() && steps.cache-build-restore.outputs.cache-hit != 'true'
        uses: actions/cache/save@v4
        with:
          key: '${{ steps.cache-build-restore.outputs.cache-primary-key }}'
          path: |
            onnxruntime/build/Linux/Release/

  clippy-features:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            features: "qwen3,hf-hub-native-tls"
          - os: ubuntu-latest
            features: "nomic-v2-moe,hf-hub-native-tls"
          - os: ubuntu-latest
            features: "hf-hub-rustls-tls,image-models"
          - os: windows-latest
            features: "directml,hf-hub-native-tls,image-models"
    steps:
      - uses: actions/checkout@v4
      - name: Rust Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          key: ${{ matrix.features }}
      - name: Clippy
        run: cargo clippy --no-default-features --features ${{ matrix.features }} -- -D warnings