-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (172 loc) · 6.18 KB
/
Copy pathpython.yml
File metadata and controls
198 lines (172 loc) · 6.18 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# This file is autogenerated by maturin v1.9.0
# To update, run
#
# maturin generate-ci github
#
name: Python
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:
env:
FORCE_COLOR: 3
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: py
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: "Set up Python"
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: "py/pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
- name: Run tests
run: uv run pytest
- name: Minimize uv cache
run: uv cache prune --ci
build_wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- os: linux-intel
runs-on: ubuntu-latest
- os: linux-arm
runs-on: ubuntu-24.04-arm
- os: windows-intel
runs-on: windows-latest
# - os: windows-arm
# runs-on: windows-11-arm
# - os: macos-intel
# # macos-15-intel is the last x86_64 runner
# runs-on: macos-15-intel
- os: macos-arm
# macos-14+ (including latest) are ARM64 runners
runs-on: macos-latest
# - os: android-intel
# runs-on: ubuntu-latest
# platform: android
# - os: android-arm
# # GitHub Actions doesn’t currently support the Android emulator on any ARM
# # runner. So we build on a non-ARM runner, which will skip the tests.
# runs-on: ubuntu-latest
# platform: android
# archs: arm64_v8a
# - os: ios
# runs-on: macos-latest
# platform: ios
- os: pyodide
runs-on: ubuntu-latest
platform: pyodide
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Configure Rust nightly
run: rustup default nightly
# Pin Rust to nightly-2025-01-20 for pyodide builds due to Emscripten 3.1.58 compatibility.
# Rust 1.87+ generates WASM code that requires --enable-bulk-memory-opt which older
# wasm-opt versions don't support. See: https://github.com/PyO3/maturin/issues/2549
- name: Pin Rust version for pyodide (Emscripten 3.1.58 compatibility)
if: matrix.os == 'pyodide'
run: |
rustup install 1.93.0
rustup default 1.93.0
- name: Add wasm32-unknown-emscripten target if pyodide
if: matrix.os == 'pyodide'
run: rustup target add wasm32-unknown-emscripten
- name: Add i686-pc-windows-msvc target for windows
if: matrix.os == 'windows-intel'
run: rustup target add i686-pc-windows-msvc
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
- name: Build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_PLATFORM: ${{ matrix.platform || 'auto' }}
with:
package-dir: py
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Build sdist
run: pipx run build --sdist
working-directory: py
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
name: Publish to PyPI
needs: [test, build_wheels, build_sdist]
runs-on: ubuntu-latest
# environment: pypi
permissions:
id-token: write # OIDC trusted-publishing token for PyPI
# if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
# To test uploads to TestPyPI, uncomment the following:
# with:
# repository-url: https://test.pypi.org/legacy/
upload_testpypi:
name: Publish to TestPyPI
needs: [test, build_wheels, build_sdist]
runs-on: ubuntu-latest
# environment: pypi
permissions:
id-token: write # OIDC trusted-publishing token for TestPyPI
# if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true