Skip to content

Commit a6f309b

Browse files
authored
build: use updated maturin release workflow (#44)
1 parent 95320bc commit a6f309b

File tree

3 files changed

+64
-40
lines changed

3 files changed

+64
-40
lines changed

.github/workflows/release.yaml

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,103 @@
1-
# This file is autogenerated by maturin v1.2.3
2-
# To update, run
3-
#
4-
# maturin generate-ci github
5-
#
6-
# Edited to incorporate genomicmedlab/software-templates Python template
7-
# See also https://www.maturin.rs/distribution#using-pypis-trusted-publishing
81
name: Publish Python distribution to PyPI
92

103
on:
11-
release:
12-
types: [created]
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
workflow_dispatch:
1310

1411
permissions:
1512
contents: read
1613

1714
jobs:
1815
linux:
19-
runs-on: ubuntu-latest
16+
runs-on: ${{ matrix.platform.runner }}
2017
strategy:
2118
matrix:
22-
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
19+
platform:
20+
- runner: ubuntu-22.04
21+
target: x86_64
22+
- runner: ubuntu-22.04
23+
target: x86
24+
- runner: ubuntu-22.04
25+
target: aarch64
26+
- runner: ubuntu-22.04
27+
target: armv7
28+
- runner: ubuntu-22.04
29+
target: s390x
30+
- runner: ubuntu-22.04
31+
target: ppc64le
2332
steps:
2433
- uses: actions/checkout@v4
2534
- uses: actions/setup-python@v5
2635
with:
27-
python-version: '3.10'
36+
python-version: 3.x
2837
- name: Build wheels
2938
uses: PyO3/maturin-action@v1
3039
with:
31-
target: ${{ matrix.target }}
32-
args: --release --out dist --find-interpreter
40+
target: ${{ matrix.platform.target }}
41+
args: --release --out dist --manifest-path rust/Cargo.toml
3342
sccache: 'true'
3443
manylinux: auto
3544
- name: Upload wheels
3645
uses: actions/upload-artifact@v4
3746
with:
38-
name: wheels
47+
name: wheels-linux-${{ matrix.platform.target }}
3948
path: dist
4049

4150
windows:
42-
runs-on: windows-latest
51+
runs-on: ${{ matrix.platform.runner }}
4352
strategy:
4453
matrix:
45-
target: [x64, x86]
54+
platform:
55+
- runner: windows-latest
56+
target: x64
57+
- runner: windows-latest
58+
target: x86
4659
steps:
4760
- uses: actions/checkout@v4
4861
- uses: actions/setup-python@v5
4962
with:
50-
python-version: '3.10'
51-
architecture: ${{ matrix.target }}
63+
python-version: 3.x
64+
architecture: ${{ matrix.platform.target }}
5265
- name: Build wheels
5366
uses: PyO3/maturin-action@v1
5467
with:
55-
target: ${{ matrix.target }}
56-
args: --release --out dist --find-interpreter
68+
target: ${{ matrix.platform.target }}
69+
args: --release --out dist --manifest-path rust/Cargo.toml
5770
sccache: 'true'
5871
- name: Upload wheels
5972
uses: actions/upload-artifact@v4
6073
with:
61-
name: wheels
74+
name: wheels-windows-${{ matrix.platform.target }}
6275
path: dist
6376

6477
macos:
65-
runs-on: macos-latest
78+
runs-on: ${{ matrix.platform.runner }}
6679
strategy:
6780
matrix:
68-
target: [x86_64, aarch64]
81+
platform:
82+
- runner: macos-latest
83+
target: x86_64
84+
- runner: macos-14
85+
target: aarch64
6986
steps:
7087
- uses: actions/checkout@v4
7188
- uses: actions/setup-python@v5
7289
with:
73-
python-version: '3.10'
90+
python-version: 3.x
7491
- name: Build wheels
7592
uses: PyO3/maturin-action@v1
7693
with:
77-
target: ${{ matrix.target }}
78-
args: --release --out dist --find-interpreter
94+
target: ${{ matrix.platform.target }}
95+
args: --release --out dist --manifest-path rust/Cargo.toml
7996
sccache: 'true'
8097
- name: Upload wheels
8198
uses: actions/upload-artifact@v4
8299
with:
83-
name: wheels
100+
name: wheels-macos-${{ matrix.platform.target }}
84101
path: dist
85102

86103
sdist:
@@ -95,25 +112,35 @@ jobs:
95112
- name: Upload sdist
96113
uses: actions/upload-artifact@v4
97114
with:
98-
name: wheels
115+
name: wheels-sdist
99116
path: dist
100117

101118
release:
102119
name: Release
103120
runs-on: ubuntu-latest
121+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
122+
needs: [
123+
linux,
124+
windows,
125+
macos,
126+
sdist
127+
]
104128
environment:
105129
name: pypi
106130
url: https://pypi.org/p/agct
107131
permissions:
108-
id-token: write # IMPORTANT: mandatory for trusted publishing
109-
if: "startsWith(github.ref, 'refs/tags/')"
110-
needs: [linux, windows, macos, sdist]
132+
id-token: write
133+
contents: write
134+
attestations: write
111135
steps:
112-
- uses: actions/download-artifact@v4
136+
- name: Acquire build artifacts from parent jobs
137+
uses: actions/download-artifact@v4
138+
- name: Generate artifact attestation
139+
uses: actions/attest-build-provenance@v1
113140
with:
114-
name: wheels
141+
subject-path: 'wheels-*/*'
115142
- name: Publish to PyPI
116143
uses: PyO3/maturin-action@v1
117144
with:
118145
command: upload
119-
args: --non-interactive --skip-existing *
146+
args: --non-interactive --skip-existing wheels-*/*

rust/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@ crate-type = ["cdylib"]
1111
chainfile = "0.3.0"
1212
directories = "5.0"
1313
omics = { version = "0.2.0", features = ["coordinate"] }
14-
15-
[dependencies.pyo3]
16-
version = "0.20.2"
17-
features = ["abi3-py38"]
14+
pyo3 = { version = "0.23.3", features = ["abi3-py310"] }

rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Converter {
8686
/// agct._core Python module. Collect Python-facing methods.
8787
#[pymodule]
8888
#[pyo3(name = "_core")]
89-
fn agct(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
89+
fn agct(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
9090
m.add_class::<Converter>()?;
9191
m.add("NoLiftoverError", _py.get_type::<NoLiftoverError>())?;
9292
m.add("ChainfileError", _py.get_type::<ChainfileError>())?;

0 commit comments

Comments
 (0)