Skip to content

Commit debc3bf

Browse files
Adding CI for build, cross-compile in py03 and bump py03 version (#8)
* add ci * add fasttokens * maturin upgrade * maturin upgrade * bump default compiler * add cross compile * Update pyproject.toml * build: Use python as build folder * build: Remove folder and don't build on tag release * build: Don't build on tag release --------- Co-authored-by: AlonKejzman <alonkeizman@gmail.com>
1 parent e2df4fe commit debc3bf

File tree

4 files changed

+280
-15
lines changed

4 files changed

+280
-15
lines changed
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: build-maturin
7+
8+
on:
9+
workflow_call:
10+
inputs:
11+
publish_pypi:
12+
description: "Whether to publish the package to PyPI."
13+
required: false
14+
type: boolean
15+
default: false
16+
secrets:
17+
PYPI_TOKEN:
18+
description: "The PyPI token for publishing."
19+
required: true
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
linux:
26+
runs-on: ${{ matrix.platform.runner }}
27+
strategy:
28+
matrix:
29+
platform:
30+
- runner: ubuntu-22.04
31+
target: x86_64
32+
manylinux: auto
33+
ft: true
34+
- runner: ubuntu-22.04
35+
target: x86
36+
manylinux: auto
37+
ft: true
38+
- runner: ubuntu-22.04
39+
target: aarch64
40+
manylinux: manylinux_2_28
41+
ft: false
42+
- runner: ubuntu-22.04
43+
target: armv7
44+
manylinux: manylinux_2_28
45+
ft: false
46+
- runner: ubuntu-22.04
47+
target: ppc64le
48+
manylinux: manylinux_2_28
49+
ft: true
50+
steps:
51+
- uses: actions/checkout@v6
52+
- uses: actions/setup-python@v6
53+
with:
54+
python-version: 3.x
55+
- name: Build wheels
56+
uses: PyO3/maturin-action@v1
57+
with:
58+
working-directory: python
59+
target: ${{ matrix.platform.target }}
60+
args: --release --out dist --find-interpreter
61+
sccache: "false"
62+
manylinux: ${{ matrix.platform.manylinux }}
63+
before-script-linux: |
64+
if command -v apt-get &> /dev/null; then
65+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
66+
elif command -v yum &> /dev/null; then
67+
yum install openssl-devel perl-IPC-Cmd -y
68+
else
69+
echo "Neither apt-get nor yum is installed. Please install a package manager."
70+
exit 1
71+
fi
72+
- name: Build free-threaded wheels
73+
uses: PyO3/maturin-action@v1
74+
if: ${{ matrix.platform.ft }}
75+
with:
76+
working-directory: python
77+
target: ${{ matrix.platform.target }}
78+
args: --release --out dist -i python3.13t
79+
sccache: "false"
80+
manylinux: auto
81+
before-script-linux: |
82+
if command -v apt-get &> /dev/null; then
83+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
84+
elif command -v yum &> /dev/null; then
85+
yum install openssl-devel perl-IPC-Cmd -y
86+
else
87+
echo "Neither apt-get nor yum is installed. Please install a package manager."
88+
exit 1
89+
fi
90+
- name: Upload wheels
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: wheels-linux-${{ matrix.platform.target }}
94+
path: python/dist
95+
96+
musllinux:
97+
runs-on: ${{ matrix.platform.runner }}
98+
strategy:
99+
matrix:
100+
platform:
101+
- runner: ubuntu-22.04
102+
target: x86_64
103+
- runner: ubuntu-22.04
104+
target: x86
105+
- runner: ubuntu-22.04
106+
target: aarch64
107+
- runner: ubuntu-22.04
108+
target: armv7
109+
steps:
110+
- uses: actions/checkout@v6
111+
- uses: actions/setup-python@v6
112+
with:
113+
python-version: 3.x
114+
- name: Build wheels
115+
uses: PyO3/maturin-action@v1
116+
with:
117+
working-directory: python
118+
target: ${{ matrix.platform.target }}
119+
args: --release --out dist --find-interpreter
120+
sccache: "false"
121+
manylinux: musllinux_1_2
122+
- name: Build free-threaded wheels
123+
uses: PyO3/maturin-action@v1
124+
with:
125+
working-directory: python
126+
target: ${{ matrix.platform.target }}
127+
args: --release --out dist -i python3.13t
128+
sccache: "false"
129+
manylinux: musllinux_1_2
130+
- name: Upload wheels
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: wheels-musllinux-${{ matrix.platform.target }}
134+
path: python/dist
135+
136+
windows:
137+
runs-on: windows-latest
138+
steps:
139+
- uses: actions/checkout@v6
140+
- uses: actions/setup-python@v6
141+
with:
142+
python-version: 3.x
143+
architecture: x64
144+
- name: Build wheels
145+
uses: PyO3/maturin-action@v1
146+
with:
147+
working-directory: python
148+
target: x64
149+
args: --release --out dist --find-interpreter
150+
sccache: "false"
151+
- name: Upload wheels
152+
uses: actions/upload-artifact@v4
153+
with:
154+
name: wheels-windows-x64
155+
path: python/dist
156+
157+
macos:
158+
runs-on: ${{ matrix.platform.runner }}
159+
strategy:
160+
matrix:
161+
platform:
162+
- runner: macos-15
163+
target: x86_64
164+
- runner: macos-15
165+
target: aarch64
166+
steps:
167+
- uses: actions/checkout@v6
168+
- uses: actions/setup-python@v6
169+
with:
170+
python-version: 3.x
171+
- name: Build wheels
172+
uses: PyO3/maturin-action@v1
173+
with:
174+
working-directory: python
175+
target: ${{ matrix.platform.target }}
176+
args: --release --out dist --find-interpreter
177+
sccache: "false"
178+
- name: Build free-threaded wheels
179+
uses: PyO3/maturin-action@v1
180+
with:
181+
working-directory: python
182+
target: ${{ matrix.platform.target }}
183+
args: --release --out dist -i python3.13t
184+
sccache: "false"
185+
- name: Upload wheels
186+
uses: actions/upload-artifact@v4
187+
with:
188+
name: wheels-macos-${{ matrix.platform.target }}
189+
path: python/dist
190+
191+
sdist:
192+
runs-on: ubuntu-latest
193+
steps:
194+
- uses: actions/checkout@v6
195+
- name: Build sdist
196+
uses: PyO3/maturin-action@v1
197+
with:
198+
working-directory: python
199+
command: sdist
200+
args: --out dist
201+
- name: Upload sdist
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: wheels-sdist
205+
path: python/dist
206+
207+
release:
208+
name: Release
209+
runs-on: ubuntu-latest
210+
if: ${{ github.event_name == 'workflow_dispatch' }}
211+
needs: [linux, musllinux, windows, macos, sdist]
212+
permissions:
213+
id-token: write
214+
contents: write
215+
attestations: write
216+
steps:
217+
- uses: actions/download-artifact@v4
218+
- name: Generate artifact attestation
219+
uses: actions/attest-build-provenance@v1
220+
with:
221+
subject-path: "wheels-*/*"
222+
- name: Publish to PyPI
223+
if: ${{ inputs.publish_pypi }}
224+
uses: PyO3/maturin-action@v1
225+
env:
226+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
227+
with:
228+
command: upload
229+
args: --non-interactive --skip-existing wheels-*/*
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and Release fastokens
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- "python/**"
10+
- "src/**"
11+
- "Cargo.toml"
12+
- "Cargo.lock"
13+
- ".github/workflows/**"
14+
tags:
15+
- "*"
16+
pull_request:
17+
paths:
18+
- "python/**"
19+
- "src/**"
20+
- "Cargo.toml"
21+
- "Cargo.lock"
22+
- ".github/workflows/**"
23+
workflow_dispatch:
24+
inputs:
25+
publish_pypi:
26+
description: "Publish to PyPI?"
27+
required: false
28+
type: boolean
29+
default: false
30+
31+
jobs:
32+
build-package:
33+
uses: ./.github/workflows/build-maturin.yml
34+
with:
35+
publish_pypi: ${{ github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.publish_pypi) }}
36+
secrets:
37+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

python/Cargo.lock

Lines changed: 13 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ crate-type = ["cdylib"]
1414

1515
[dependencies]
1616
fastokens = { path = ".." }
17-
pyo3 = "0.23"
17+
pyo3 = {version = "0.25", features = ["extension-module", "abi3-py39"] }
1818
rayon = "1"
1919
serde_json = "1"

0 commit comments

Comments
 (0)