Wheels #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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-12, macosx_x86_64] | |
- [macos-12, macosx_arm64] | |
python-version: [pp310, cp37, cp38, cp39, cp310, cp311, cp312] | |
exclude: | |
# pp310, cp37, cp38 on musllinux is not support | |
# cp39, cp310 on musllinux_aarch64, wheel building may hangup, ignore it | |
- buildplat: [ubuntu-22.04, musllinux_x86_64] | |
python-version: cp37 | |
- 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: cp37 | |
- 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 | |
# cp37, pp310 on macos arm64 is not supported | |
- buildplat: [macos-12, macosx_arm64] | |
python-version: cp37 | |
- buildplat: [macos-12, macosx_arm64] | |
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/[email protected] | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
config-file: "{package}/pyproject.toml" | |
env: | |
# select | |
CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.buildplat[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 arm64 | |
CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps" | |
# 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" | |
# macOS build arm64 on x86_64 with cross-compiler, not support test | |
CIBW_TEST_SKIP: "*-macosx_arm64" | |
# 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.12" | |
- 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 }} |