-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (90 loc) · 2.3 KB
/
python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Python
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
pull_request:
release:
types: [published]
workflow_dispatch:
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
PYTHON_VERSION: "3.10"
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push'}}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: pip install
run: pip install .[tests]
- name: pytest
run: pytest
wheels_sdist:
if: ${{ github.event_name == 'release' }}
needs: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist
wheels_linux:
if: ${{ github.event_name == 'release' }}
needs: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels
path: dist
pypi_release:
permissions:
contents: read
if: ${{ github.event_name == 'release' }}
needs:
- wheels_sdist
- wheels_linux
runs-on: ubuntu-latest
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- name: Download wheels
if: ${{ env.MATURIN_PYPI_TOKEN != '' }}
uses: actions/download-artifact@v4
with:
name: wheels
- name: Publish to PyPI
if: ${{ env.MATURIN_PYPI_TOKEN != '' }}
uses: PyO3/maturin-action@v1
with:
command: upload
args: --skip-existing *