Skip to content

Commit

Permalink
Merge release workflow revamp and package metadata updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarshall committed Oct 2, 2023
2 parents 7d1df29 + c16550a commit 9401189
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 83 deletions.
103 changes: 38 additions & 65 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish pysam wheels to PyPI and TestPyPI
name: Publish wheels

on:
push:
Expand All @@ -12,77 +12,52 @@ on:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu-latest, macos-10.15] # windows-2019,
cibw_archs: [auto]
cibw_build: ['cp37-* cp38-* cp39-* cp310-* cp311-*']
os: [ubuntu]
build: ["cp36-* cp37-*", "cp38-* cp39-*", "cp310-* cp311-*", "cp312-*"]
x64image: [manylinux_2_28]

include:
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp36-*
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp37-*
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp38-*
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp39-*
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp310-*
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: cp311-*
- os: macos
build: "cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"

- os: ubuntu
build: "cp38-manylinux_x86_64"
x64image: manylinux2014

steps:
- name: Checkout pysam
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Set up QEMU
if: ${{ matrix.cibw_archs == 'aarch64' }}
uses: docker/setup-qemu-action@v1

- name: Install prerequisite Python libraries
run: |
python -m pip install --upgrade pip
pip install cython pytest pytest-pep8
- name: Build wheels for linux
if: runner.os == 'Linux'
uses: pypa/[email protected]
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: "*musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
CIBW_MANYLINUX_I686_IMAGE: manylinux_2_24
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_24
CIBW_BEFORE_BUILD: apt-get update && apt-get install -y libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev && pip install cython
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for macos
if: runner.os != 'Linux'
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_BEFORE_BUILD: pip install cython
CIBW_ARCHS: ${{ matrix.cibw_archs }}

CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 arm64

CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.x64image }}
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28

CIBW_TEST_SKIP: "*-*linux_i686 *-*linux_aarch64 *-macosx_arm64"

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

build_sdist:

runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
Expand Down Expand Up @@ -115,28 +90,26 @@ jobs:
path: dist/*.tar.gz

upload_pypi:

needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }}

permissions:
id-token: write

steps:
- name: Get Artifacts
- name: Get artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish distribution to Test PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 34 additions & 0 deletions devtools/install-prerequisites.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh -e

if test -x /usr/bin/dnf; then
echo Installing prerequisites via dnf...
dnf -y install epel-release
dnf -y install zlib-devel bzip2-devel xz-devel curl-devel samtools bcftools htslib-tools

elif test -x /usr/bin/yum; then
if yum -y install epel-release; then
echo Installing prerequisites via yum...
yum -y install zlib-devel bzip2-devel xz-devel curl-devel samtools bcftools htslib-tools
else
echo Installing non-test prerequisites via yum...
yum -y install zlib-devel bzip2-devel xz-devel curl-devel
fi

elif test -d /etc/dpkg; then
echo Installing prerequisites via apt-get...
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev samtools bcftools tabix

elif test -x /sbin/apk; then
echo Installing non-test prerequisites via apk...
apk update
apk add zlib-dev bzip2-dev xz-dev curl-dev

elif test -x ${HOMEBREW_PREFIX-/usr/local}/bin/brew; then
echo Installing prerequisites via brew...
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q samtools bcftools
brew unlink xz || true

else
echo No package manager detected
fi
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[project]
name = "pysam"
description = "pysam - a python module for reading, manipulating and writing genomic data sets."
description = "Package for reading, manipulating, and writing genomic data"
license = { text = "MIT License" }
version = "0.21.0"
authors = [
{ name = "Andreas Heger", email = "[email protected]"}
]
Expand All @@ -11,12 +10,23 @@ requires-python = ">=3.6"
dynamic = [
"classifiers",
"readme",
"version",
]

[project.urls]
"Documentation" = "https://pysam.readthedocs.io/en/stable/"
"Release notes" = "https://pysam.readthedocs.io/en/stable/release.html"

[build-system]
requires = ["setuptools>=59.0", "Cython>=0.29.12,<4"]
build-backend = "setuptools.build_meta:__legacy__"

[tool.cibuildwheel]
before-all = "{project}/devtools/install-prerequisites.sh"

test-requires = ["pytest"]
test-command = "REF_PATH=: pytest {project}/tests"

[tool.tox]
legacy_tox_ini = """
[tox]
Expand Down
26 changes: 10 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#! /usr/bin/python

'''pysam - a python module for reading, manipulating and writing
'''pysam --- a Python package for reading, manipulating, and writing
genomic data sets.
pysam is a lightweight wrapper of the htslib C-API and provides
facilities to read and write SAM/BAM/VCF/BCF/BED/GFF/GTF/FASTA/FASTQ
files as well as access to the command line functionality of the
samtools and bcftools packages. The module supports compression and
random access through indexing.
This module provides a low-level wrapper around the htslib C-API as
using cython and a high-level API for convenient access to the data
within standard genomic file formats.
See:
http://www.htslib.org
https://github.com/pysam-developers/pysam
http://pysam.readthedocs.org/en/stable
pysam is a lightweight wrapper of the HTSlib API and provides facilities
to read and write SAM/BAM/CRAM/VCF/BCF/BED/GFF/GTF/FASTA/FASTQ files
as well as access to the command-line functionality of samtools and bcftools.
The module supports compression and random access through indexing.
This module provides a low-level wrapper around HTSlib's C API using Cython
and a high-level API for convenient access to the data within standard genomic
file formats.
'''

import collections
Expand Down Expand Up @@ -675,8 +668,9 @@ def prebuild_libcsamtools(ext, force):
metadata = {
'name': "pysam",
'version': get_pysam_version(),
'description': "pysam",
'description': "Package for reading, manipulating, and writing genomic data",
'long_description': __doc__,
'long_description_content_type': "text/x-rst",
'author': "Andreas Heger",
'author_email': "[email protected]",
'license': "MIT",
Expand Down

0 comments on commit 9401189

Please sign in to comment.