-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (116 loc) · 3.77 KB
/
Copy pathpython.yaml
File metadata and controls
134 lines (116 loc) · 3.77 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
name: Python
on:
push:
tags: ["v*"]
pull_request:
paths:
- "src/python.rs"
- "python/**"
- "pyproject.toml"
- "murk.pyi"
- "Cargo.toml"
- ".github/workflows/python.yaml"
permissions:
contents: read
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b # v4.0.0
with:
src: python/
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
- name: Build release binary (for test fixture)
run: cargo build --release
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Install and test
run: |
uv venv
source .venv/bin/activate
uv pip install maturin pytest
maturin develop --features python
pytest python/tests -v
wheels:
name: Build wheels (${{ matrix.os }}, ${{ matrix.target }})
needs: [lint, test]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64
- os: ubuntu-latest
target: aarch64
manylinux: manylinux_2_28
- os: macos-14
target: x86_64
- os: macos-latest
target: aarch64
- os: windows-latest
target: x64
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.target == 'aarch64'
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v3
with:
platforms: arm64
- name: Build wheels
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
with:
target: ${{ matrix.target }}
args: --release --out dist --features python -i python3.12
manylinux: ${{ matrix.manylinux || 'auto' }}
docker-options: -e PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-${{ matrix.os }}-${{ matrix.target }}
path: dist/
sdist:
name: Build sdist
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-sdist
path: dist/
publish:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
needs: [wheels, sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: wheels-*
merge-multiple: true
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
with:
skip-existing: true