Skip to content

Commit 25e5875

Browse files
authored
Create CI.yml
1 parent fcd5974 commit 25e5875

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/CI.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
tags:
9+
- "*"
10+
pull_request:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
linux:
18+
runs-on: ${{ matrix.platform.runner }}
19+
strategy:
20+
matrix:
21+
platform:
22+
- runner: ubuntu-22.04
23+
target: x86_64
24+
- runner: ubuntu-22.04
25+
target: x86
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: 3.x
31+
- name: Build wheels
32+
uses: PyO3/maturin-action@v1
33+
with:
34+
target: ${{ matrix.platform.target }}
35+
args: --release --out dist --find-interpreter
36+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
37+
manylinux: auto
38+
- name: Upload wheels
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: wheels-linux-${{ matrix.platform.target }}
42+
path: dist
43+
44+
windows:
45+
runs-on: ${{ matrix.platform.runner }}
46+
strategy:
47+
matrix:
48+
platform:
49+
- runner: windows-latest
50+
target: x64
51+
- runner: windows-latest
52+
target: x86
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: 3.x
58+
architecture: ${{ matrix.platform.target }}
59+
- name: Build wheels
60+
uses: PyO3/maturin-action@v1
61+
with:
62+
target: ${{ matrix.platform.target }}
63+
args: --release --out dist --find-interpreter
64+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
65+
- name: Upload wheels
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: wheels-windows-${{ matrix.platform.target }}
69+
path: dist
70+
71+
sdist:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
- name: Build sdist
76+
uses: PyO3/maturin-action@v1
77+
with:
78+
command: sdist
79+
args: --out dist
80+
- name: Upload sdist
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: wheels-sdist
84+
path: dist
85+
86+
release:
87+
name: Release
88+
runs-on: ubuntu-latest
89+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
90+
needs: [linux, windows, sdist]
91+
permissions:
92+
# Use to sign the release artifacts
93+
id-token: write
94+
# Used to upload release artifacts
95+
contents: write
96+
# Used to generate artifact attestation
97+
attestations: write
98+
steps:
99+
- uses: actions/download-artifact@v4
100+
- name: Generate artifact attestation
101+
uses: actions/attest-build-provenance@v1
102+
with:
103+
subject-path: "wheels-*/*"
104+
- name: Publish to PyPI
105+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
106+
uses: PyO3/maturin-action@v1
107+
env:
108+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
109+
with:
110+
command: upload
111+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)