Skip to content

Commit 0337da9

Browse files
authored
MAINT: Modernize cibuildwheel infrastructure (#54)
1 parent c9fa491 commit 0337da9

File tree

8 files changed

+112
-94
lines changed

8 files changed

+112
-94
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
jobs:
44
build_docs:
55
docker:
6-
- image: cimg/python:3.10
6+
- image: cimg/python:3.12.3
77
steps:
88
- checkout
99
- run:

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
actions:
9+
patterns:
10+
- "*"

.github/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot

.github/workflows/build_wheels.yml

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,91 @@ concurrency:
1414

1515
jobs:
1616
build_wheels:
17-
name: Build wheels on ${{ matrix.os }}
17+
name: ${{ matrix.os }} ${{ matrix.arch }} py${{ matrix.python}} wheels
1818
runs-on: ${{ matrix.os }}
19+
continue-on-error: true
1920
strategy:
2021
matrix:
2122
# macos-13 is an intel runner, macos-14 is apple silicon
2223
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
24+
arch: [native]
25+
python: ["*"]
26+
# Split aarch64 across jobs because it uses emulation (slow)
27+
include:
28+
- os: ubuntu-latest
29+
arch: i686
30+
python: "*"
31+
- os: ubuntu-latest
32+
arch: aarch64
33+
python: "38"
34+
- os: ubuntu-latest
35+
arch: aarch64
36+
python: "39"
37+
- os: ubuntu-latest
38+
arch: aarch64
39+
python: "310"
40+
- os: ubuntu-latest
41+
arch: aarch64
42+
python: "311"
43+
- os: ubuntu-latest
44+
arch: aarch64
45+
python: "312"
2346
steps:
2447
- uses: actions/checkout@v4
48+
with:
49+
submodules: true
50+
# Linux emulation for aarch64 support
51+
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
52+
- uses: docker/setup-qemu-action@v3
53+
with:
54+
platforms: all
55+
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
56+
- uses: pypa/[email protected]
57+
env:
58+
CIBW_BUILDING: "true"
59+
CIBW_ARCHS: ${{ matrix.arch }} # simplest for now
60+
CIBW_BUILD: "{c,p}p${{ matrix.python }}-*"
61+
CIBW_SKIP: "{c,p}p3{6,7}-*"
62+
CIBW_TEST_COMMAND: "python -c \"import rtmixer; print(rtmixer.__version__)\""
63+
# No portaudio on these platforms:
64+
CIBW_TEST_SKIP: "*_i686 *-musllinux_* *_aarch64"
65+
# To enable testing we'd have to bump up to the Almalinux 8-based image:
66+
# CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
67+
CIBW_BUILD_VERBOSITY: "3"
68+
CIBW_BEFORE_TEST_LINUX: "bash {project}/tools/cibw_before_test_linux.sh"
69+
- uses: actions/upload-artifact@v4
70+
with:
71+
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch}}-${{ strategy.job-index }}
72+
path: ./wheelhouse/*.whl
73+
74+
# From https://cibuildwheel.pypa.io/en/stable/deliver-to-pypi/
75+
# and https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#trusted-publishing
76+
make_sdist:
77+
name: Make SDist
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
- run: pipx run build --sdist
82+
- uses: actions/upload-artifact@v4
83+
with:
84+
name: cibw-sdist
85+
path: dist/*.tar.gz
86+
87+
pypi-publish:
88+
name: Upload release to PyPI
89+
needs: [build_wheels, make_sdist]
90+
if: github.event_name == 'release' && github.event.action == 'published'
91+
environment:
92+
name: pypi
93+
url: https://pypi.org/p/rtmixer
94+
permissions:
95+
id-token: write
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/download-artifact@v4
99+
with:
100+
pattern: cibw-*
101+
path: dist
102+
merge-multiple: true
103+
- run: ls -al dist/*
104+
- uses: pypa/gh-action-pypi-publish@release/v1

azure-pipelines.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

rtmixer_build.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This is used to create the _rtmixer extension module (see setup.py).
22

3+
import sys
34
from cffi import FFI
45
import pa_ringbuffer
56

@@ -15,15 +16,16 @@
1516
1617
""")
1718
ffibuilder.cdef(open('src/rtmixer.h').read())
19+
# '-Wconversion'
20+
extra_compile_args = list()
21+
if sys.platform == "linux":
22+
extra_compile_args.append("--std=c99")
1823
ffibuilder.set_source(
1924
'_rtmixer',
2025
RINGBUFFER_CDEF + open('src/rtmixer.c').read(),
2126
include_dirs=['src', 'portaudio/include'],
2227
sources=['portaudio/src/common/pa_ringbuffer.c'],
23-
extra_compile_args=[
24-
'--std=c99',
25-
# '-Wconversion',
26-
],
28+
extra_compile_args=extra_compile_args,
2729
# TODO: release mode by default, option for using debug mode
2830
undef_macros=[
2931
# 'NDEBUG'

src/rtmixer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
https://python-rtmixer.readthedocs.io/
44
55
"""
6-
__version__ = '0.1.4'
6+
__version__ = '0.1.5'
77

88
import sounddevice as _sd
99
from pa_ringbuffer import init as _init_ringbuffer

tools/cibw_before_test_linux.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -xeo pipefail
4+
5+
if [[ "$(cat /etc/redhat-release)" == 'AlmaLinux'* ]]; then
6+
dnf config-manager --set-enabled powertools
7+
dnf install -y epel-release
8+
fi
9+
yum install -y portaudio

0 commit comments

Comments
 (0)