Skip to content

Commit 5c64a35

Browse files
committed
Maturin default ci for release
1 parent adc2577 commit 5c64a35

File tree

1 file changed

+159
-88
lines changed

1 file changed

+159
-88
lines changed
Lines changed: 159 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,176 @@
1-
# Taken from Polar-rs github action
2-
3-
name: Create Python release
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: CI
47

58
on:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
tags:
14+
- '*'
15+
pull_request:
616
workflow_dispatch:
7-
inputs:
8-
# Latest commit to include with the release. If omitted, use the latest commit on the main branch.
9-
sha:
10-
description: Commit SHA
11-
type: string
12-
# Create the sdist and build the wheels, but do not publish to PyPI / GitHub.
13-
dry-run:
14-
description: Dry run
15-
type: boolean
16-
default: false
1717

18-
env:
19-
PYTHON_VERSION: '3.9'
20-
PYTHON_VERSION_WIN_ARM64: '3.11' # ARM64 Windows doesn't have older versions
21-
CARGO_INCREMENTAL: 0
22-
CARGO_NET_RETRY: 10
23-
RUSTUP_MAX_RETRIES: 10
24-
25-
defaults:
26-
run:
27-
shell: bash
28-
29-
concurrency:
30-
group: ${{ github.workflow }}-${{ github.ref }}
31-
cancel-in-progress: true
18+
permissions:
19+
contents: read
3220

3321
jobs:
34-
manylinux-x64_64:
35-
runs-on: ubuntu-latest
22+
linux:
23+
runs-on: ${{ matrix.platform.runner }}
24+
strategy:
25+
matrix:
26+
platform:
27+
- runner: ubuntu-22.04
28+
target: x86_64
29+
- runner: ubuntu-22.04
30+
target: x86
31+
- runner: ubuntu-22.04
32+
target: aarch64
33+
- runner: ubuntu-22.04
34+
target: armv7
35+
- runner: ubuntu-22.04
36+
target: s390x
37+
- runner: ubuntu-22.04
38+
target: ppc64le
3639
steps:
3740
- uses: actions/checkout@v4
38-
with:
39-
submodules: 'recursive'
4041
- uses: actions/setup-python@v5
4142
with:
42-
python-version: '3.7'
43-
44-
- name: Publish wheel
43+
python-version: 3.x
44+
- name: Build wheels
4545
uses: PyO3/maturin-action@v1
46-
env:
47-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
48-
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
4946
with:
50-
rust-toolchain: nightly-2024-02-04
51-
maturin-version: '1.6.0'
52-
command: publish
53-
args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin
54-
55-
# Needed for Docker on Apple M1
56-
# manylinux-aarch64:
57-
# runs-on: ubuntu-latest
58-
# steps:
59-
# - uses: actions/checkout@v3
60-
# - uses: actions/setup-python@v4
61-
# with:
62-
# python-version: '3.7'
63-
#
64-
# - name: Publish wheel
65-
# uses: messense/maturin-action@v1
66-
# env:
67-
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
68-
# with:
69-
# rust-toolchain: nightly-2023-01-19
70-
# target: aarch64-unknown-linux-gnu
71-
# maturin-version: '0.14.10'
72-
# command: publish
73-
# args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin
47+
target: ${{ matrix.platform.target }}
48+
args: --release --out dist
49+
sccache: 'true'
50+
manylinux: auto
51+
- name: Build free-threaded wheels
52+
uses: PyO3/maturin-action@v1
53+
with:
54+
target: ${{ matrix.platform.target }}
55+
args: --release --out dist -i python3.13t
56+
sccache: 'true'
57+
manylinux: auto
58+
- name: Upload wheels
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: wheels-linux-${{ matrix.platform.target }}
62+
path: dist
7463

75-
# uncomment to build a universal2 wheel
76-
# we don't run it because it is twice as big and not needed because we build for both architectures separately
77-
# macos-aarch64-universal:
78-
# runs-on: macos-latest
79-
# steps:
80-
# - uses: actions/checkout@v3
81-
# - uses: actions/setup-python@v4
82-
# with:
83-
# python-version: '3.7'
64+
musllinux:
65+
runs-on: ${{ matrix.platform.runner }}
66+
strategy:
67+
matrix:
68+
platform:
69+
- runner: ubuntu-22.04
70+
target: x86_64
71+
- runner: ubuntu-22.04
72+
target: x86
73+
- runner: ubuntu-22.04
74+
target: aarch64
75+
- runner: ubuntu-22.04
76+
target: armv7
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: actions/setup-python@v5
80+
with:
81+
python-version: 3.x
82+
- name: Build wheels
83+
uses: PyO3/maturin-action@v1
84+
with:
85+
target: ${{ matrix.platform.target }}
86+
args: --release --out dist
87+
sccache: 'true'
88+
manylinux: musllinux_1_2
89+
- name: Build free-threaded wheels
90+
uses: PyO3/maturin-action@v1
91+
with:
92+
target: ${{ matrix.platform.target }}
93+
args: --release --out dist -i python3.13t
94+
sccache: 'true'
95+
manylinux: musllinux_1_2
96+
- name: Upload wheels
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: wheels-musllinux-${{ matrix.platform.target }}
100+
path: dist
84101

85-
# - name: Fix README symlink
86-
# run: |
87-
# rm py-polars/README.md
88-
# cp README.md py-polars/README.md
102+
# No support for minimap2 for windows
89103

90-
# - name: Set up Rust
91-
# uses: dtolnay/rust-toolchain@master
92-
# with:
93-
# toolchain: nightly-2023-01-19
104+
macos:
105+
runs-on: ${{ matrix.platform.runner }}
106+
strategy:
107+
matrix:
108+
platform:
109+
- runner: macos-13
110+
target: x86_64
111+
- runner: macos-14
112+
target: aarch64
113+
steps:
114+
- uses: actions/checkout@v4
115+
- uses: actions/setup-python@v5
116+
with:
117+
python-version: 3.x
118+
- name: Build wheels
119+
uses: PyO3/maturin-action@v1
120+
with:
121+
target: ${{ matrix.platform.target }}
122+
args: --release --out dist
123+
sccache: 'true'
124+
- name: Build free-threaded wheels
125+
uses: PyO3/maturin-action@v1
126+
with:
127+
target: ${{ matrix.platform.target }}
128+
args: --release --out dist -i python3.13t
129+
sccache: 'true'
130+
- name: Upload wheels
131+
uses: actions/upload-artifact@v4
132+
with:
133+
name: wheels-macos-${{ matrix.platform.target }}
134+
path: dist
94135

95-
# - name: Set up Rust targets
96-
# run: rustup target add aarch64-apple-darwin
136+
sdist:
137+
runs-on: ubuntu-latest
138+
steps:
139+
- uses: actions/checkout@v4
140+
- name: Build sdist
141+
uses: PyO3/maturin-action@v1
142+
with:
143+
command: sdist
144+
args: --out dist
145+
- name: Upload sdist
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: wheels-sdist
149+
path: dist
97150

98-
# - name: Publish wheel
99-
# uses: messense/maturin-action@v1
100-
# env:
101-
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
102-
# with:
103-
# maturin-version: '0.14.10'
104-
# command: publish
105-
# args: -m py-polars/Cargo.toml --no-sdist --universal2 -o wheels -i python -u ritchie46
151+
release:
152+
name: Release
153+
runs-on: ubuntu-latest
154+
if: ${{ startsWith(github.ref, 'refs/tags/py-') || github.event_name == 'workflow_dispatch' }}
155+
needs: [linux, musllinux, macos, sdist]
156+
permissions:
157+
# Use to sign the release artifacts
158+
id-token: write
159+
# Used to upload release artifacts
160+
contents: write
161+
# Used to generate artifact attestation
162+
attestations: write
163+
steps:
164+
- uses: actions/download-artifact@v4
165+
- name: Generate artifact attestation
166+
uses: actions/attest-build-provenance@v1
167+
with:
168+
subject-path: 'wheels-*/*'
169+
- name: Publish to PyPI
170+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
171+
uses: PyO3/maturin-action@v1
172+
env:
173+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
174+
with:
175+
command: upload
176+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)