Skip to content

Wheels

Wheels #130

Workflow file for this run

name: Wheels
on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
schedule:
# run weekly on a Monday
- cron: '0 0 * * 1'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: "3.7"
- name: Install cibuildwheel
run: |
python -m pip install -U cibuildwheel
- name: Build wheels for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686* *musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
CIBW_TEST_COMMAND: "{project}/ci/test"
CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 LDFLAGS='-L/usr/lib64/openssl11' CPPFLAGS='-I/usr/include/openssl11' C_INCLUDE_PATH='/root/include' LIBRARY_PATH='/root/lib'"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH='/root/lib' auditwheel repair -w {dest_dir} {wheel}
- name: Build wheels for Mac OS x86
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686*"
CIBW_ARCHS_MACOS: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
CIBW_TEST_COMMAND: "{project}/ci/test"
CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
# https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
LDFLAGS: "-L/usr/local/opt/[email protected]/lib"
CPPFLAGS: "-I/usr/local/opt/[email protected]/include"
PKG_CONFIG_PATH: "/usr/local/opt/[email protected]/lib/pkgconfig"
- name: Build wheels for Mac OS arm64
# don't build with libdeflate, see https://github.com/brentp/cyvcf2/issues/252
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686*"
CIBW_ARCHS_MACOS: "arm64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-arm64-deps"
CIBW_TEST_COMMAND: "{project}/ci/test"
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_ENVIRONMENT: "CYTHONIZE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
# https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
LDFLAGS: "-L/usr/local/opt/[email protected]/lib"
CPPFLAGS: "-I/usr/local/opt/[email protected]/include"
PKG_CONFIG_PATH: "/usr/local/opt/[email protected]/lib/pkgconfig"
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.7"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libbz2-dev liblzma-dev libssl-dev
git submodule update --init --recursive
cd htslib
autoheader && autoconf && autoreconf --install
./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2
make
cd ..
pip install -r requirements.txt
- name: Build sdist
run: CYTHONIZE=1 python setup.py sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}