forked from tuxu/python-samplerate
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (156 loc) · 5.47 KB
/
Copy pathpythonpackage.yml
File metadata and controls
179 lines (156 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: samplerate
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
# Weekly run: wheel tests install the newest NumPy/pytest, so this catches
# dependency drift (e.g. the NumPy 2.4 resize break) between releases.
schedule:
- cron: "17 4 * * 1"
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- os: ubuntu-latest
arch: x86_64
# Linux ARM64 (native, no QEMU)
- os: ubuntu-24.04-arm
arch: aarch64
# Windows AMD64
- os: windows-latest
arch: AMD64
# macOS x86_64 (Intel)
- os: macos-15-intel
arch: x86_64
# macOS ARM64 (Apple Silicon)
- os: macos-latest
arch: arm64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@e090b81e30c4d855ea63bf4b6e59204c09a101ae # v4.2.1
with:
extras: uv
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build and test source distribution
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0 # setuptools-scm needs tags for the version
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: false # output is published; don't restore a cache
# `uv build` builds the sdist, then a wheel *from* the sdist, so a file
# missing from MANIFEST.in fails here instead of on a user's machine.
- name: Build sdist and a wheel from it
run: uv build
- name: Test the wheel built from the sdist
run: |
uv venv
uv pip install dist/*.whl --group test
uv run --no-project pytest tests -m "not perf"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-sdist
path: dist/*.tar.gz
if-no-files-found: error
# Keep the NumPy floor in pyproject.toml honest: oldest supported Python
# with the oldest allowed NumPy.
numpy_oldest:
name: Test oldest supported NumPy
runs-on: ubuntu-latest
permissions:
contents: read
env:
UV_PYTHON: "3.11"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: false
- name: Build and install with the oldest NumPy
run: |
uv venv
floor=$(sed -n 's/.*"numpy>=\([0-9.]*\)".*/\1/p' pyproject.toml)
uv pip install . --group test "numpy==$floor"
- name: Test
run: |
uv run --no-project python -c "import numpy; print('numpy', numpy.__version__)"
uv run --no-project pytest tests -m "not perf"
# Early warning: NumPy's nightly builds on the newest CPython. Not a release
# gate; it only runs on the schedule or by hand.
numpy_nightly:
name: Test against NumPy nightly
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: false
- name: Build and install
run: uv sync --python 3.14 --group test
- name: Install NumPy nightly
run: >
uv pip install --pre --upgrade
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
numpy
- name: Test
run: |
uv run --no-sync python -c "import numpy; print('numpy', numpy.__version__)"
uv run --no-sync pytest tests -m "not perf"
publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/samplerate-ledfx/
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
pattern: cibw-*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R dist
# Uses trusted publishing and uploads PEP 740 attestations for each file.
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2