Skip to content

Commit b8e6dd3

Browse files
committed
updated github workflow
1 parent cc82934 commit b8e6dd3

File tree

1 file changed

+116
-43
lines changed

1 file changed

+116
-43
lines changed

.github/workflows/CI.yml

Lines changed: 116 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,145 @@
33
#
44
# maturin generate-ci github
55
#
6-
name: Build and Publish
6+
7+
name: CI
78

89
on:
910
push:
1011
branches:
1112
- main
13+
- master
14+
tags:
15+
- '*'
1216
pull_request:
13-
branches:
14-
- main
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
1521

1622
jobs:
17-
build:
18-
runs-on: ${{ matrix.os }}
23+
linux:
24+
runs-on: ${{ matrix.platform.runner }}
1925
strategy:
2026
matrix:
21-
os: [ubuntu-latest, macos-latest, windows-latest]
22-
27+
platform:
28+
- runner: ubuntu-latest
29+
target: x86_64
30+
- runner: ubuntu-latest
31+
target: x86
32+
- runner: ubuntu-latest
33+
target: aarch64
34+
- runner: ubuntu-latest
35+
target: armv7
36+
- runner: ubuntu-latest
37+
target: s390x
38+
- runner: ubuntu-latest
39+
target: ppc64le
2340
steps:
24-
- uses: actions/checkout@v2
25-
26-
- name: Set up Python
27-
uses: actions/setup-python@v2
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-python@v5
2843
with:
29-
python-version: 3.9 # Use any version >=3.6 for the build
30-
31-
- name: Install Rust
32-
uses: actions-rs/toolchain@v1
44+
python-version: '3.10'
45+
- name: Build wheels
46+
uses: PyO3/maturin-action@v1
3347
with:
34-
toolchain: stable
35-
profile: minimal
36-
override: true
37-
38-
- name: Install maturin
39-
run: pip install maturin
48+
target: ${{ matrix.platform.target }}
49+
args: --release --out dist --find-interpreter --bindings pyo3-abi3
50+
sccache: 'true'
51+
manylinux: auto
52+
- name: Upload wheels
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: wheels-linux-${{ matrix.platform.target }}
56+
path: dist
4057

58+
windows:
59+
runs-on: ${{ matrix.platform.runner }}
60+
strategy:
61+
matrix:
62+
platform:
63+
- runner: windows-latest
64+
target: x64
65+
- runner: windows-latest
66+
target: x86
67+
steps:
68+
- uses: actions/checkout@v4
69+
- uses: actions/setup-python@v5
70+
with:
71+
python-version: '3.10'
72+
architecture: ${{ matrix.platform.target }}
4173
- name: Build wheels
42-
run: maturin build --release --strip
74+
uses: PyO3/maturin-action@v1
75+
with:
76+
target: ${{ matrix.platform.target }}
77+
args: --release --out dist --find-interpreter --bindings pyo3-abi3
78+
sccache: 'true'
79+
- name: Upload wheels
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: wheels-windows-${{ matrix.platform.target }}
83+
path: dist
4384

44-
- name: Upload artifact
45-
uses: actions/upload-artifact@v2
85+
macos:
86+
runs-on: ${{ matrix.platform.runner }}
87+
strategy:
88+
matrix:
89+
platform:
90+
- runner: macos-latest
91+
target: x86_64
92+
- runner: macos-14
93+
target: aarch64
94+
steps:
95+
- uses: actions/checkout@v4
96+
- uses: actions/setup-python@v5
4697
with:
47-
name: wheels
48-
path: target/wheels/*.whl
98+
python-version: '3.10'
99+
- name: Build wheels
100+
uses: PyO3/maturin-action@v1
101+
with:
102+
target: ${{ matrix.platform.target }}
103+
args: --release --out dist --find-interpreter --bindings pyo3-abi3
104+
sccache: 'true'
105+
- name: Upload wheels
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: wheels-macos-${{ matrix.platform.target }}
109+
path: dist
49110

50-
publish:
51-
needs: build
111+
sdist:
52112
runs-on: ubuntu-latest
53113
steps:
54-
- uses: actions/checkout@v2
55-
56-
- name: Download artifact
57-
uses: actions/download-artifact@v2
114+
- uses: actions/checkout@v4
115+
- name: Build sdist
116+
uses: PyO3/maturin-action@v1
58117
with:
59-
name: wheels
118+
command: sdist
119+
args: --out dist --bindings pyo3-abi3
120+
- name: Upload sdist
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: wheels-sdist
60124
path: dist
61125

62-
- name: Set up Python
63-
uses: actions/setup-python@v2
126+
release:
127+
name: Release
128+
runs-on: ubuntu-latest
129+
if: "startsWith(github.ref, 'refs/tags/')"
130+
needs: [linux, windows, macos, sdist]
131+
steps:
132+
- uses: actions/download-artifact@v4
64133
with:
65-
python-version: 3.x
66-
67-
- name: Install twine
68-
run: pip install twine
69-
134+
name: wheels-linux-x86_64
135+
- uses: actions/download-artifact@v4
136+
with:
137+
name: wheels-windows-x64
138+
- uses: actions/download-artifact@v4
139+
with:
140+
name: wheels-macos-x86_64
70141
- name: Publish to PyPI
71-
run: twine upload dist/*
142+
uses: PyO3/maturin-action@v1
72143
env:
73-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
74-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
144+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
145+
with:
146+
command: upload
147+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)