Repository navigation
191 lines (183 loc) · 5.98 KB
/
Copy pathpython-packaging.yml
File metadata and controls
191 lines (183 loc) · 5.98 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
# This file was mostly autogenerated by maturin v1.7.1
# To update, run
#
# maturin generate-ci github --manifest-path py-binding/Cargo.toml
#
# NOTE: There are some customizations added to the generated output.
# - workflow name is more descriptive
# - use zig compiler on most cross-compiled Linux wheels
name: Python builds
on:
push:
branches: [main]
paths:
- cpp-linter/**.{rs,toml}
- clang-tools-manager/src/**
- clang-tools-manager/Cargo.toml
- bindings/python/**
- Cargo.{toml,lock}
- .github/workflows/python-packaging.yml
- pyproject.toml
tags:
- 'cpp-linter-py/v*'
pull_request:
branches: [main]
paths:
- cpp-linter/**.{rs,toml}
- clang-tools-manager/src/**
- clang-tools-manager/Cargo.toml
- bindings/python/**
- Cargo.{toml,lock}
- .github/workflows/python-packaging.yml
- pyproject.toml
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
seed-build-script:
name: Pre-seed static binaries' versions
uses: $/.github/workflows/pre-seed-versions.yml
sdist:
needs: [seed-build-script]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@v7.1.0
with:
python-version: 3.x
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: wheels-sdist
path: dist/*
wheels:
needs: [seed-build-script]
runs-on: ${{ matrix.platform.runner }}
name: >-
wheels (${{ matrix.python.feature }},
${{ matrix.platform.runner }},
${{ matrix.platform.manylinux || 'manylinux'}}
${{ matrix.platform.target }})
strategy:
fail-fast: false
matrix:
python:
- version: '3.10'
feature: pyo3/abi3-py310
- version: '3.15t'
feature: pyo3/abi3t-py315
platform:
- runner: windows-latest
target: x64
py-arch: x64
- runner: windows-latest
target: x86
py-arch: x86
- runner: macos-15-intel
target: x86_64
- runner: macos-15
target: aarch64
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: x86_64
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: x86
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: aarch64
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: armv7
manylinux: musllinux_1_2
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
include:
# insert these manually until python 3.11 is the minimum supported python version
- python:
version: '3.11'
feature: pyo3/abi3-py311
platform:
runner: windows-11-arm
target: aarch64
py-arch: arm64
- python:
version: '3.15t'
feature: pyo3/abi3t-py315
platform:
runner: windows-11-arm
target: aarch64
py-arch: arm64
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@v7.1.0
id: setup-python
with:
python-version: ${{ matrix.python.version }}
architecture: ${{ matrix.platform.py-arch || null }}
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
target: ${{ matrix.platform.target }}
args: >-
--release
--out dist
--interpreter ${{ matrix.python.version }}
--features ${{ matrix.python.feature }}
${{ runner.os == 'Linux' && matrix.platform.target != 'ppc64le' && '--zig' || '' }}
# zizmor: ignore[cache-poisoning]
sccache: ${{ startsWith(github.ref, 'refs/tags') && 'false' || 'true' }}
manylinux: ${{ matrix.platform.manylinux || 'auto' }}
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ runner.os }}-${{ matrix.platform.target }}-${{ matrix.platform.manylinux || '_' }}-${{ matrix.python.version }}
path: dist/*
release:
name: Release
runs-on: ubuntu-latest
needs: [wheels, sdist]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Setup Python
if: ${{ !startsWith(github.ref, 'refs/tags/cpp-linter-py/v') }}
uses: actions/setup-python@v7.1.0
with:
python-version: 3.x
- name: Check distributions
if: ${{ !startsWith(github.ref, 'refs/tags/cpp-linter-py/v') }}
run: pipx run twine check dist/*
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/cpp-linter-py/v')
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
skip-existing: true
# This workflow is registered as a trusted publisher (for test-pypi and pypi).
# A token should not be required (and actually is discouraged with trusted publishers).
repository-url: ${{ contains(github.ref_name, 'rc') && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}