-
Notifications
You must be signed in to change notification settings - Fork 6
200 lines (167 loc) · 5.13 KB
/
Copy pathpython-wheels.yml
File metadata and controls
200 lines (167 loc) · 5.13 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
199
200
# This is mostly copied from
# <https://github.com/messense/crfs-rs/blob/main/.github/workflows/Python.yml>
name: release-python-wheels
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
jobs:
# Windows & macos
build-dist-wheel:
name: Build wheel for ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.runner }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version-file: "boreal-py/pyproject.toml"
architecture: ${{ matrix.platform.pyarch }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --auditwheel check --out dist -m boreal-py/Cargo.toml
- name: Test installing built wheel
run: |
pip install boreal-python --no-index --find-links dist --force-reinstall
python -c "import boreal"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.name }}
path: dist
strategy:
fail-fast: false
matrix:
platform:
- name: windows-x64
runner: windows-latest
target: x86_64
pyarch: x64
- name: windows-i686
runner: windows-latest
target: x86
pyarch: x86
- name: macos-x64
runner: macos-15-intel
target: x86_64
pyarch: x64
- name: macos-aarch64
runner: macos-15
target: aarch64
pyarch: arm64
# Linux for glibc
build-manylinux:
name: Build wheel for manylinux ${{ matrix.target }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version-file: "boreal-py/pyproject.toml"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --auditwheel check --out dist -m boreal-py/Cargo.toml
- name: Test installing built wheel
if: ${{ matrix.target == 'x86_64' }}
run: |
pip install boreal-python --no-index --find-links dist --force-reinstall
python -c "import boreal"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-manylinux-${{ matrix.target }}
path: dist
strategy:
fail-fast: false
matrix:
target: [x86_64, x86]
# Linux for musl
build-musllinux:
name: Build wheel for musllinux ${{ matrix.target }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version-file: "boreal-py/pyproject.toml"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --auditwheel repair --out dist -m boreal-py/Cargo.toml
- name: Setup alpine
uses: jirutka/setup-alpine@v1
with:
arch: ${{ matrix.target }}
packages: py3-pip
- name: Test installing the wheel
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install boreal-python --no-index --find-links /home/runner/work/boreal/boreal/dist --force-reinstall
python3 -c "import boreal"
shell: alpine.sh {0}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.target }}
path: dist
strategy:
fail-fast: false
matrix:
target: [x86_64, x86]
# Source wheel
build-source:
name: Build source wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version-file: "boreal-py/pyproject.toml"
- name: Build source wheel
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist -m boreal-py/Cargo.toml
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [build-dist-wheel, build-manylinux, build-musllinux, build-source]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v5
with:
path: boreal-py
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-path: 'boreal-py/wheels-*/*'
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
working-directory: boreal-py
args: --non-interactive --skip-existing wheels-*/*