faiss 0.13.0

High-level bindings for Faiss, the vector similarity search engine
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  # test `faiss` crates after installing libfaiss_c.so
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
          - beta
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Install OpenBLAS and LAPACK
        run: sudo apt install -y libopenblas-dev liblapack-dev
      - name: Cache Faiss shared objects
        uses: actions/cache@v4
        with:
          path: ~/.faiss_c
          key: libfaiss-${{ runner.os }}-${{ hashFiles('.git/modules/faiss-sys/faiss/HEAD') }}
      - name: Install CMake
        uses: lukka/get-cmake@latest
      - name: Download and build Faiss
        run: ./faiss-sys/ci/install_faiss_c.sh
      - name: Install Faiss
        run: sudo cp $HOME/.faiss_c/lib*.so /usr/lib/
      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          cache: true
      # Build and run tests
      - name: Run tests
        run: cargo test --verbose
      # Check that GPU modules compile
      - name: Check GPU feature
        run: cargo check --features=gpu

  # test `faiss` crates with static linking
  build-static:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - stable
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Install OpenBLAS and LAPACK
        run: sudo apt install -y libopenblas-dev liblapack-dev
      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          cache: true
      - name: Install CMake
        uses: lukka/get-cmake@latest
      - run: gcc -v
      - run: cmake --version
      # Build everything and run tests
      - name: Run tests
        run: cargo test --verbose --features static

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: stable
          components: clippy
          cache: true
      - run: cargo clippy
        env:
          RUSTFLAGS: -W warnings