Skip to content

Commit

Permalink
Merge Cirrus CI-based release workflow revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarshall committed Oct 4, 2023
2 parents ed549e9 + 21af5fa commit eac36ad
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 18 deletions.
73 changes: 73 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
build_wheels_task:
only_if: $CIRRUS_BRANCH =~ "release/.*" || $CIRRUS_TAG =~ "v0\..*"

matrix:
- compute_engine_instance:
image_project: cirrus-images
image: family/docker-builder-arm64
architecture: arm64
platform: linux
matrix:
- name: Build ARM Linux py3.6-9 wheels
env:
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*"
- name: Build ARM Linux py3.10-12 wheels
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"

- name: Build ARM macOS wheels
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"

alias: build_wheels

env:
CIRRUS_CLONE_DEPTH: 1

CIBW_SKIP: "*-musllinux_*"
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28

install_script: |
python3 -m pip install cibuildwheel==2.16.2
build_script: |
cibuildwheel
wheels_artifacts:
path: wheelhouse/*.whl

upload_pypi_task:
only_if: $CIRRUS_BRANCH =~ "release/.*" || $CIRRUS_TAG =~ "v0\..*"
depends_on: build_wheels

name: Publish ARM wheels

container:
image: python:latest

env:
CIRRUS_CLONE_DEPTH: 1
API_BASEURL: https://api.cirrus-ci.com/v1
TWINE_USERNAME: __token__

install_script: |
python3 -m pip install twine
get_artifacts_script: |
curl -sSLO $API_BASEURL/artifact/build/$CIRRUS_BUILD_ID/wheels.zip
unzip -q wheels.zip
upload_script: |
case "$CIRRUS_TAG" in
v0.*)
export TWINE_REPOSITORY=pypi TWINE_PASSWORD=$PYPI_TOKEN ;;
*)
export TWINE_REPOSITORY=testpypi TWINE_PASSWORD=$TESTPYPI_TOKEN ;;
esac
echo Uploading wheels to $TWINE_REPOSITORY...
python3 -m twine check wheelhouse/*.whl
python3 -m twine upload --disable-progress-bar wheelhouse/*.whl
23 changes: 6 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ jobs:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ubuntu]
build: ["cp36-* cp37-*", "cp38-* cp39-*", "cp310-* cp311-*", "cp312-*"]
os: [ubuntu, macos]
build: ["cp36-* cp37-* cp38-* cp39-*", "cp310-* cp311-* cp312-*"]
x64image: [manylinux_2_28]

include:
- os: macos
build: "cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*"

- os: ubuntu
build: "cp38-manylinux_x86_64"
x64image: manylinux2014
Expand All @@ -31,31 +28,23 @@ jobs:
- name: Checkout pysam
uses: actions/checkout@v3

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build wheels
uses: pypa/[email protected].1
uses: pypa/[email protected].2
env:
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: "*musllinux*"

CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: x86_64

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
path: wheelhouse/*.whl

build_sdist:
runs-on: ${{ matrix.os }}-latest
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dynamic = [
]

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

[build-system]
Expand All @@ -23,6 +23,8 @@ build-backend = "setuptools.build_meta:__legacy__"

[tool.cibuildwheel]
before-all = "{project}/devtools/install-prerequisites.sh"
# Necessary until we build libhts.a out-of-tree from within build_temp
before-build = "make -C {project}/htslib distclean"

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

0 comments on commit eac36ad

Please sign in to comment.