Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit f25874e

Browse files
authored
Use maturin to build release (#1)
1 parent 9a30676 commit f25874e

File tree

5 files changed

+107
-38
lines changed

5 files changed

+107
-38
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ on:
33
workflow_dispatch:
44
push:
55
branches: [ "main" ]
6-
tags-ignore: [ "**" ]
6+
tags: [ "*" ]
77
pull_request:
8-
schedule:
9-
- cron: "0 8 * * *"
108
concurrency:
119
group: check-${{ github.ref }}
1210
cancel-in-progress: true

.github/workflows/release.yml

Lines changed: 104 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,135 @@ on:
33
workflow_dispatch:
44
push:
55
branches: [ "main" ]
6-
tags-ignore: [ "**" ]
6+
tags: [ "*" ]
77
pull_request:
88
schedule:
99
- cron: "0 8 * * *"
1010
concurrency:
1111
group: build-${{ github.ref }}
1212
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
1317
jobs:
14-
build_wheels:
15-
name: Build wheels on ${{ matrix.os }}
16-
runs-on: ${{ matrix.os }}
18+
linux:
19+
runs-on: ${{ matrix.platform.runner }}
20+
strategy:
21+
matrix:
22+
platform:
23+
- runner: ubuntu-latest
24+
target: x86_64
25+
- runner: ubuntu-latest
26+
target: x86
27+
- runner: ubuntu-latest
28+
target: aarch64
29+
- runner: ubuntu-latest
30+
target: armv7
31+
- runner: ubuntu-latest
32+
target: s390x
33+
- runner: ubuntu-latest
34+
target: ppc64le
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.12'
40+
- name: Build wheels
41+
uses: PyO3/maturin-action@v1
42+
with:
43+
target: ${{ matrix.platform.target }}
44+
args: --release --out dist
45+
sccache: 'true'
46+
manylinux: auto
47+
- name: Upload wheels
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: wheels-linux-${{ matrix.platform.target }}
51+
path: dist
52+
53+
windows:
54+
runs-on: ${{ matrix.platform.runner }}
55+
strategy:
56+
matrix:
57+
platform:
58+
- runner: windows-latest
59+
target: x64
60+
- runner: windows-latest
61+
target: x86
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: '3.12'
67+
architecture: ${{ matrix.platform.target }}
68+
- name: Build wheels
69+
uses: PyO3/maturin-action@v1
70+
with:
71+
target: ${{ matrix.platform.target }}
72+
args: --release --out dist
73+
sccache: 'true'
74+
- name: Upload wheels
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: wheels-windows-${{ matrix.platform.target }}
78+
path: dist
79+
80+
macos:
81+
runs-on: ${{ matrix.platform.runner }}
1782
strategy:
18-
fail-fast: false
1983
matrix:
20-
os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ]
21-
env:
22-
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
23-
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
24-
CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
84+
platform:
85+
- runner: macos-latest
86+
target: x86_64
87+
- runner: macos-14
88+
target: aarch64
2589
steps:
2690
- uses: actions/checkout@v4
91+
- uses: actions/setup-python@v5
92+
with:
93+
python-version: '3.12'
2794
- name: Build wheels
28-
uses: pypa/[email protected]
29-
- uses: actions/upload-artifact@v4
95+
uses: PyO3/maturin-action@v1
3096
with:
31-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32-
path: ./wheelhouse/*.whl
97+
target: ${{ matrix.platform.target }}
98+
args: --release --out dist
99+
sccache: 'true'
100+
- name: Upload wheels
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: wheels-macos-${{ matrix.platform.target }}
104+
path: dist
33105

34-
build_sdist:
35-
name: Build SDist
106+
sdist:
36107
runs-on: ubuntu-latest
37108
steps:
38109
- uses: actions/checkout@v4
39-
- name: Build SDist
40-
run: pipx run build --sdist
41-
- uses: actions/upload-artifact@v4
110+
- name: Build sdist
111+
uses: PyO3/maturin-action@v1
42112
with:
43-
name: cibw-sdist
44-
path: dist/*.tar.gz
113+
command: sdist
114+
args: --out dist
115+
- name: Upload sdist
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: wheels-sdist
119+
path: dist
45120

46-
upload_pypi:
47-
needs: [ build_wheels, build_sdist ]
121+
release:
122+
name: Release
48123
runs-on: ubuntu-latest
49124
environment:
50125
name: release
51126
url: https://pypi.org/p/pyproject-fmt
52127
permissions:
53128
id-token: write
54-
if: github.event_name == 'release' && github.event.action == 'published'
129+
if: "startsWith(github.ref, 'refs/tags/')"
130+
needs: [ linux, windows, macos, sdist ]
55131
steps:
56132
- uses: actions/download-artifact@v4
133+
- name: Publish to PyPI
134+
uses: PyO3/maturin-action@v1
57135
with:
58-
pattern: cibw-*
59-
path: dist
60-
merge-multiple: true
61-
- uses: pypa/gh-action-pypi-publish@release/v1
136+
command: upload
137+
args: --non-interactive --skip-existing wheels-*/*

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ repos:
3030
- id: ruff-format
3131
- id: ruff
3232
args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ]
33-
- repo: https://github.com/doublify/pre-commit-rust
34-
rev: v1.0
35-
hooks:
36-
- id: fmt
37-
- id: clippy
3833
- repo: meta
3934
hooks:
4035
- id: check-hooks-apply

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyproject-fmt-rust"
3-
version = "2.0.0"
3+
version = "1.0.0"
44
description = "Format pyproject.toml files"
55
repository = "https://github.com/tox-dev/pyproject-fmt"
66
readme = "README.md"

0 commit comments

Comments
 (0)