Upgrade faiss to v1.9.0 #380
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
jobs: | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Apply patch | |
run: cd faiss && git apply ../patch/faiss-rename-swigfaiss.patch && cd .. | |
- name: Install build dependencies | |
run: python -m pip install build | |
- name: Build sdist | |
run: python -m build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.opt_level }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: auto64 | |
opt_level: avx512 | |
- os: ubuntu-latest | |
arch: aarch64 | |
opt_level: generic | |
- os: macos-13 | |
arch: x86_64 | |
opt_level: avx2 | |
- os: macos-latest | |
arch: arm64 | |
opt_level: generic | |
- os: windows-latest | |
arch: auto64 | |
opt_level: avx2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Set up QEMU | |
if: runner.os == 'Linux' && matrix.arch == 'aarch64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up conda | |
if: runner.os == 'Windows' | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.21.1 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_ENVIRONMENT_LINUX: > | |
FAISS_OPT_LEVEL=${{ matrix.opt_level }} | |
FAISS_ENABLE_GPU=OFF | |
CIBW_ENVIRONMENT_MACOS: > | |
FAISS_OPT_LEVEL=${{ matrix.opt_level }} | |
TARGET_ARCH=${{ matrix.arch }} | |
LIBOMP_USE_HIDDEN_HELPER_TASK=0 | |
LIBOMP_NUM_HIDDEN_HELPER_THREADS=0 | |
KMP_DUPLICATE_LIB_OK=TRUE | |
OMP_NUM_THREADS=1 | |
MACOSX_DEPLOYMENT_TARGET=10.14 | |
CIBW_ENVIRONMENT_WINDOWS: > | |
FAISS_OPT_LEVEL=${{ matrix.opt_level }} | |
CMAKE_PREFIX_PATH="c:\\opt" | |
LIB="${LIB};${CMAKE_PREFIX_PATH}\\lib;${CONDA}\\Library\\lib" | |
CPATH="${CPATH};${CMAKE_PREFIX_PATH}\\include;${CONDA}\\Library\\include" | |
CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh | |
CIBW_BEFORE_TEST_LINUX: pip install torch --index-url https://download.pytorch.org/whl/cpu | |
CIBW_TEST_COMMAND: > | |
env -u FAISS_OPT_LEVEL pytest {project}/faiss/tests | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheel-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.opt_level }} | |
path: ./wheelhouse/*.whl | |
publish: | |
name: Upload packages to PyPI | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/faiss-cpu | |
permissions: | |
id-token: write | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |