Skip to content

Commit 3fdef47

Browse files
committed
chore(release): fix maturin build
1 parent 9f2f0b8 commit 3fdef47

File tree

1 file changed

+90
-19
lines changed

1 file changed

+90
-19
lines changed
Lines changed: 90 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- main
4+
- feat/maturin-release
55

66
permissions:
77
contents: write
@@ -23,49 +23,120 @@ jobs:
2323
release-type: python
2424
target-branch: main
2525

26-
build:
27-
name: upload wheel & publish to pypi
28-
runs-on: ubuntu-latest
26+
build-wheels:
27+
name: build wheels (${{ matrix.label }})
28+
runs-on: ${{ matrix.os }}
2929
needs: release-please
3030
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
31-
32-
environment: pypi
33-
permissions:
34-
id-token: write
35-
contents: write
36-
3731
strategy:
3832
fail-fast: false
3933
matrix:
4034
python-version: ["3.14"]
35+
include:
36+
- os: ubuntu-latest
37+
label: linux-x86_64
38+
extra-args: "--compatibility manylinux_2_35"
39+
- os: macos-13
40+
label: macos-x86_64
41+
extra-args: ""
42+
- os: macos-14
43+
label: macos-aarch64
44+
extra-args: ""
45+
- os: windows-latest
46+
label: windows-x86_64
47+
extra-args: ""
4148
steps:
4249
- uses: actions/checkout@v4
4350

44-
- name: Install uv & set Python
51+
- name: Install uv
4552
uses: astral-sh/setup-uv@v7
4653
with:
4754
python-version: ${{ matrix.python-version }}
48-
enable-cache: true
49-
cache-python: true
5055

51-
- name: Install Python ${{ matrix.python-version }}
52-
run: uv python install ${{ matrix.python-version }}
56+
- name: Install maturin
57+
run: uv tool install maturin
5358

54-
- name: Sync dependencies
55-
run: uv sync --frozen
59+
- name: Setup Rust
60+
uses: dtolnay/rust-toolchain@stable
61+
62+
- name: Install maturin
63+
run: uv tool install maturin
5664

5765
- name: Build wheel
58-
run: uv build
66+
run: uvx maturin build --release --out dist --skip-sdist ${{ matrix.extra-args }}
67+
68+
- name: Upload wheel artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: wheels-${{ matrix.label }}
72+
path: dist/*.whl
73+
if-no-files-found: error
74+
75+
build-sdist:
76+
name: build sdist
77+
runs-on: ubuntu-latest
78+
needs: release-please
79+
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- name: Install uv
84+
uses: astral-sh/setup-uv@v7
85+
with:
86+
python-version: ${{ matrix.python-version }}
87+
88+
- name: Setup Rust
89+
uses: dtolnay/rust-toolchain@stable
90+
91+
- name: Install maturin
92+
run: uv tool install maturin
93+
94+
- name: Build sdist
95+
run: uvx maturin sdist --out dist
96+
97+
- name: Upload sdist artifact
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: sdist
101+
path: dist/*.tar.gz
102+
if-no-files-found: error
103+
104+
publish:
105+
name: publish release artifacts
106+
runs-on: ubuntu-latest
107+
needs:
108+
- release-please
109+
- build-wheels
110+
- build-sdist
111+
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
112+
environment: pypi
113+
permissions:
114+
id-token: write
115+
contents: write
116+
steps:
117+
- name: Download wheel artifacts
118+
uses: actions/download-artifact@v4
119+
with:
120+
pattern: wheels-*
121+
merge-multiple: true
122+
path: dist
123+
124+
- name: Download sdist artifact
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: sdist
128+
path: dist
59129

60130
- name: Upload binaries to release
61131
uses: svenstaro/upload-release-action@v2
62132
with:
63133
repo_token: ${{ secrets.GITHUB_TOKEN }}
64-
file: dist/memu_*.whl
134+
file: dist/*
65135
tag: ${{ needs.release-please.outputs.tag_name }}
66136
file_glob: true
67137

68138
- name: Publish to PyPI
69139
uses: pypa/gh-action-pypi-publish@release/v1
70140
with:
71141
packages-dir: dist/
142+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)