Skip to content

Publish wheels

Publish wheels #121

Workflow file for this run

name: Publish wheels
on:
push:
branches:
- release/*
tags:
- v[0-9]+.*
jobs:
build_wheels:
runs-on: ${{ case(matrix.kind == 'macos',
case(matrix.arch == 'arm', 'macos-latest', 'macos-15-intel'),
case(matrix.arch == 'arm', 'ubuntu-24.04-arm', 'ubuntu-latest')) }}
strategy:
matrix:
kind: [macos, many, musl]
arch: [arm, intel]
build: ["cp38-* cp39-*", "cp310-* cp311-*", "cp312-* cp313-* cp314-*"]
x64image: [manylinux_2_28]
nametag: [none]
include:
- kind: many
arch: intel
build: "cp38-manylinux_x86_64"
x64image: manylinux2014
nametag: focal
steps:
- name: Checkout pysam
uses: actions/checkout@v6
- name: Check platform is the expected ${{ matrix.arch }} architecture
run: devtools/check-platform.sh ${{ matrix.arch }}
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: ${{ case(matrix.kind == 'many', '*-musllinux_*', '*-manylinux_*') }} cp38-macosx_arm64
CIBW_BUILD_VERBOSITY: 1
# Avoid linking with non-system library libdeflate.dylib
CIBW_ENVIRONMENT_MACOS: HTSLIB_CONFIGURE_OPTIONS="--without-libdeflate"
CIBW_ARCHS: native
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.x64image }}
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
- name: Check wheelhouse
run: devtools/artifactname.py wheelhouse/*.whl >> $GITHUB_ENV
env:
NAMETAG: ${{ matrix.nametag }}
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ env.artifactname }}
path: wheelhouse/*.whl
build_sdist:
runs-on: ubuntu-latest
env:
job_python_version: "3.14"
steps:
- name: Checkout pysam
uses: actions/checkout@v6
- name: Set up Python ${{ env.job_python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.job_python_version }}
- name: Install prerequisite Python libraries
run: pip install Cython setuptools
- name: Install build prerequisites
run: |
sudo apt-get update
sudo apt-get install -q --no-install-recommends --no-install-suggests libbz2-dev libcurl4-openssl-dev liblzma-dev
- name: Create source distribution
run: python setup.py sdist --owner=root --group=root
- name: Upload sdist artifact
uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/pysam-*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: ${{ case(github.ref_type == 'tag', 'pypi', 'testpypi') }}
permissions:
id-token: write
steps:
- name: Get artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: dist
- name: Publish distribution to Test PyPI
if: github.ref_type == 'branch'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: github.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@release/v1