Skip to content

Update cibuildwheel to 2.16.2 for Python 3.12 support #5

Update cibuildwheel to 2.16.2 for Python 3.12 support

Update cibuildwheel to 2.16.2 for Python 3.12 support #5

Workflow file for this run

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@v3
with:
submodules: true
- uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Apply patches
run: (cd faiss && git apply ../patch/faiss-rename-swigfaiss.patch && git apply ../patch/py312-use-packaging.patch)
- name: install build
run: pip install build
- name: Build sdist
run: python -m build . --sdist
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.gpu }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] #, macos-latest]
arch: [auto64]
gpu: [OFF]
opt_level: [avx2]
# include:
# - os: windows-latest
# arch: auto64
# gpu: OFF
# opt_level: generic
# - os: ubuntu-latest
# arch: aarch64
# gpu: OFF
# opt_level: generic
# - os: macos-latest
# arch: arm64
# gpu: OFF
# opt_level: generic
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch != 'auto64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_LINUX: >
FAISS_OPT_LEVEL=${{ matrix.opt_level }}
FAISS_ENABLE_GPU=${{ matrix.gpu }}
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
CIBW_ENVIRONMENT_WINDOWS: >
FAISS_OPT_LEVEL=${{ matrix.opt_level }}
CMAKE_PREFIX_PATH="c:\\opt"
PATH="${PATH};${CONDA}\\condabin;${CONDA}\\Library\\bin"
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
- uses: actions/upload-artifact@v3
with:
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@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1