forked from kyamagu/faiss-wheels
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 2.88 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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 patch
run: cd faiss && git apply ../patch/faiss-rename-swigfaiss.patch && cd ..
- name: Build sdist
run: python setup.py 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/[email protected]
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