Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Build wheels using cibuildwheel. #8

Merged
merged 10 commits into from
Oct 12, 2021
31 changes: 31 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build wheels

on:
workflow_dispatch
jvkersch marked this conversation as resolved.
Show resolved Hide resolved

jobs:
buildwheels:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
jvkersch marked this conversation as resolved.
Show resolved Hide resolved
python-version: ['3.6']

runs-on: ${{ matrix.os }}

steps:
- name: install automake
run: brew install automake
if: matrix.os == 'macos-latest'
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: install cibuildwheel
run: python -m pip install cibuildwheel==2.1.3
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_BUILD: "./ci/build-parasail.sh"
CIBW_SKIP: "cp310-macosx_* pp3*"
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wheelhouse/
build/
vpsearch.egg-info/
vpsearch/_vpsearch.cpp
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ represents the linearized tree can only query the database, not build the tree.
The slower tree-of-nodes implementation can build and query (albeit with more
overhead).

## Building wheels

Wheels for this package can be built in a platform-independent way using
[cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/), running under
GitHub actions. As an administrator, you can start a workflow to build wheels
by selecting the "Build wheels" action from the GitHub actions menu, and
clicking the "Run workflow" button. When the workflow completes, wheels for
Linux and macOS will be available as a zipped artifact.

It is possible to run cibuildwheels locally, but only to build wheels for
Linux. In a clean Python environment, run `pip install cibuildwheel` to install
the tool, followed by e.g.
```bash
CIBW_BUILD_VERBOSITY=1 \
CIBW_BUILD=cp38-manylinux_x86_64 \
CIBW_BEFORE_BUILD="./ci/build-parasail.sh" \
python -m cibuildwheel --output-dir wheelhouse --platform linux
```
to build Python 3.8 wheels for Linux. By varying the build tag, wheels for
other Python versions can be built.

## License

This package is licensed under the [BSD license](LICENSE.txt).
Expand Down
17 changes: 17 additions & 0 deletions ci/build-parasail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#
# Download a fixed version of Parasail, compile it, and install to /usr/local.
# Mainly used to build Linux wheels, inside an appropriate manylinux container.
jvkersch marked this conversation as resolved.
Show resolved Hide resolved

set -euxo pipefail

PARASAIL_VERSION="2.4.3"
PARASAIL_URL="https://github.com/jeffdaily/parasail/releases/download/v${PARASAIL_VERSION}/parasail-${PARASAIL_VERSION}.tar.gz"

# Download
curl -L "${PARASAIL_URL}" -o - | tar xzf -

# Build
cd "parasail-${PARASAIL_VERSION}"
autoreconf -fi
./configure --prefix "/usr/local" && make -j4 && make install
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = [
"setuptools",
"wheel",
"Cython>=0.28.5",
"oldest-supported-numpy", # https://github.com/scipy/oldest-supported-numpy
]