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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
name: Wheels
on:
push:
branches:
- main
- wheels
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 for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64]
- [ubuntu-22.04, musllinux_x86_64]
- [ubuntu-22.04, manylinux_aarch64]
- [ubuntu-22.04, musllinux_aarch64]
- [macos-13, macosx_x86_64]
- [macos-14, macosx_arm64]
python-version: [pp310, cp38, cp39, cp310, cp311, cp312, cp313, cp314]
exclude:
# pp310, cp38 on musllinux is not support
# cp39, cp310 on musllinux_aarch64, wheel building may hangup, ignore it
# drop 37 so we can use newer cibuildwheel
- buildplat: [ubuntu-22.04, musllinux_x86_64]
python-version: cp38
- buildplat: [ubuntu-22.04, musllinux_x86_64]
python-version: pp310
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: cp38
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: cp39
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: cp310
- buildplat: [ubuntu-22.04, musllinux_aarch64]
python-version: pp310
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
env:
# select
CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
CIBW_ENABLE: pypy
CIBW_PRERELEASE_PYTHONS: 1
# linux
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# manylinux2014 can't build on aarch64
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
CIBW_ARCHS_LINUX: auto64 aarch64
CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64" && auditwheel repair -w {dest_dir} {wheel}'
# macos
CIBW_ARCHS_MACOS: auto64
CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
# build
CIBW_ENVIRONMENT: >-
CYVCF2_HTSLIB_CONFIGURE_OPTIONS="--enable-libcurl --enable-s3 --enable-lzma --enable-bz2 --with-libdeflate"
CYTHONIZE=1
CIBW_TEST_COMMAND: "{project}/ci/test"
# 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 == 'true' }}
uses: mxschmitt/action-tmate@v3
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.python-version }}-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.14"
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Build sdist
run: CYTHONIZE=1 python setup.py sdist
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-22.04
# 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@v4
with:
pattern: artifact-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
|