Skip to content

Commit 8bbb554

Browse files
committed
chore(actions): add pypi, and crates github action release
1 parent 5755bba commit 8bbb554

File tree

2 files changed

+241
-0
lines changed

2 files changed

+241
-0
lines changed

.github/workflows/python-release.yml

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github -m binding/python/Cargo.toml
5+
#
6+
name: Python PyPi Release
7+
8+
on:
9+
workflow_run:
10+
workflows: ["Python PyPi Release"]
11+
types:
12+
- completed
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
linux:
19+
runs-on: ${{ matrix.platform.runner }}
20+
strategy:
21+
matrix:
22+
platform:
23+
- runner: ubuntu-22.04
24+
target: x86_64
25+
- runner: ubuntu-22.04
26+
target: x86
27+
- runner: ubuntu-22.04
28+
target: aarch64
29+
- runner: ubuntu-22.04
30+
target: armv7
31+
- runner: ubuntu-22.04
32+
target: s390x
33+
- runner: ubuntu-22.04
34+
target: ppc64le
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: 3.x
40+
- name: Build wheels
41+
uses: PyO3/maturin-action@v1
42+
with:
43+
target: ${{ matrix.platform.target }}
44+
args: --release --out dist --manifest-path binding/python/Cargo.toml
45+
sccache: 'true'
46+
manylinux: auto
47+
- name: Build free-threaded wheels
48+
uses: PyO3/maturin-action@v1
49+
with:
50+
target: ${{ matrix.platform.target }}
51+
args: --release --out dist --manifest-path binding/python/Cargo.toml -i python3.13t
52+
sccache: 'true'
53+
manylinux: auto
54+
- name: Upload wheels
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: wheels-linux-${{ matrix.platform.target }}
58+
path: dist
59+
60+
musllinux:
61+
runs-on: ${{ matrix.platform.runner }}
62+
strategy:
63+
matrix:
64+
platform:
65+
- runner: ubuntu-22.04
66+
target: x86_64
67+
- runner: ubuntu-22.04
68+
target: x86
69+
- runner: ubuntu-22.04
70+
target: aarch64
71+
- runner: ubuntu-22.04
72+
target: armv7
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-python@v5
76+
with:
77+
python-version: 3.x
78+
- name: Build wheels
79+
uses: PyO3/maturin-action@v1
80+
with:
81+
target: ${{ matrix.platform.target }}
82+
args: --release --out dist --manifest-path binding/python/Cargo.toml
83+
sccache: 'true'
84+
manylinux: musllinux_1_2
85+
- name: Build free-threaded wheels
86+
uses: PyO3/maturin-action@v1
87+
with:
88+
target: ${{ matrix.platform.target }}
89+
args: --release --out dist --manifest-path binding/python/Cargo.toml -i python3.13t
90+
sccache: 'true'
91+
manylinux: musllinux_1_2
92+
- name: Upload wheels
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: wheels-musllinux-${{ matrix.platform.target }}
96+
path: dist
97+
98+
windows:
99+
runs-on: ${{ matrix.platform.runner }}
100+
strategy:
101+
matrix:
102+
platform:
103+
- runner: windows-latest
104+
target: x64
105+
- runner: windows-latest
106+
target: x86
107+
steps:
108+
- uses: actions/checkout@v4
109+
- uses: actions/setup-python@v5
110+
with:
111+
python-version: 3.x
112+
architecture: ${{ matrix.platform.target }}
113+
- name: Build wheels
114+
uses: PyO3/maturin-action@v1
115+
with:
116+
target: ${{ matrix.platform.target }}
117+
args: --release --out dist --manifest-path binding/python/Cargo.toml
118+
sccache: 'true'
119+
- name: Build free-threaded wheels
120+
uses: PyO3/maturin-action@v1
121+
with:
122+
target: ${{ matrix.platform.target }}
123+
args: --release --out dist --manifest-path binding/python/Cargo.toml -i python3.13t
124+
sccache: 'true'
125+
- name: Upload wheels
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: wheels-windows-${{ matrix.platform.target }}
129+
path: dist
130+
131+
macos:
132+
runs-on: ${{ matrix.platform.runner }}
133+
strategy:
134+
matrix:
135+
platform:
136+
- runner: macos-13
137+
target: x86_64
138+
- runner: macos-14
139+
target: aarch64
140+
steps:
141+
- uses: actions/checkout@v4
142+
- uses: actions/setup-python@v5
143+
with:
144+
python-version: 3.x
145+
- name: Build wheels
146+
uses: PyO3/maturin-action@v1
147+
with:
148+
target: ${{ matrix.platform.target }}
149+
args: --release --out dist --manifest-path binding/python/Cargo.toml
150+
sccache: 'true'
151+
- name: Build free-threaded wheels
152+
uses: PyO3/maturin-action@v1
153+
with:
154+
target: ${{ matrix.platform.target }}
155+
args: --release --out dist --manifest-path binding/python/Cargo.toml -i python3.13t
156+
sccache: 'true'
157+
- name: Upload wheels
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: wheels-macos-${{ matrix.platform.target }}
161+
path: dist
162+
163+
sdist:
164+
runs-on: ubuntu-latest
165+
steps:
166+
- uses: actions/checkout@v4
167+
- name: Build sdist
168+
uses: PyO3/maturin-action@v1
169+
with:
170+
command: sdist
171+
args: --out dist --manifest-path binding/python/Cargo.toml
172+
- name: Upload sdist
173+
uses: actions/upload-artifact@v4
174+
with:
175+
name: wheels-sdist
176+
path: dist
177+
178+
release:
179+
name: Release
180+
runs-on: ubuntu-latest
181+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
182+
needs: [linux, musllinux, windows, macos, sdist]
183+
permissions:
184+
# Use to sign the release artifacts
185+
id-token: write
186+
# Used to upload release artifacts
187+
contents: write
188+
# Used to generate artifact attestation
189+
attestations: write
190+
steps:
191+
- uses: actions/download-artifact@v4
192+
- name: Generate artifact attestation
193+
uses: actions/attest-build-provenance@v1
194+
with:
195+
subject-path: 'wheels-*/*'
196+
- name: Publish to PyPI
197+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
198+
uses: PyO3/maturin-action@v1
199+
env:
200+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
201+
with:
202+
command: upload
203+
args: --non-interactive --skip-existing wheels-*/*

.github/workflows/rust-release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Rust Release
2+
3+
env:
4+
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
5+
6+
on:
7+
workflow_run:
8+
workflows: ["Python PyPi Release"]
9+
types:
10+
- completed
11+
12+
13+
jobs:
14+
rust_publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Install Rust
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
25+
- name: Cache Cargo Registry
26+
uses: actions/cache@v1
27+
with:
28+
path: ~/.cargo/registry
29+
key: ubuntu-latest-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
30+
31+
- name: Dry Run Publish package rust
32+
working-directory: ./bintensors
33+
run: cargo publish --dry-run
34+
35+
- name: Publish package rust
36+
if: ${{ !contains(github.ref, 'rc') }}
37+
working-directory: ./bintensors
38+
run: cargo publish --token ${CRATES_TOKEN}

0 commit comments

Comments
 (0)