-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (95 loc) · 2.88 KB
/
Copy pathpython.yml
File metadata and controls
101 lines (95 loc) · 2.88 KB
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
101
name: python
# Additive to ci.yml: builds and tests the clients/python bindings only.
# Gated on paths so unrelated changes don't trigger it.
on:
push:
branches: [master, v2]
paths:
- "clients/python/**"
- "crates/propagon/**"
- ".github/workflows/python.yml"
pull_request:
paths:
- "clients/python/**"
- "crates/propagon/**"
- ".github/workflows/python.yml"
workflow_dispatch:
defaults:
run:
working-directory: clients/python
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: clients/python
- run: cargo fmt --all --check
# The bindings are their own workspace; the core CI never lints them, so
# the no-panic-across-FFI gate is enforced here.
- run: cargo clippy --all-targets -- -D warnings
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: clients/python
# `maturin develop` requires an active virtualenv; setup-python doesn't
# create one. Make a venv and activate it within the step (cross-platform
# via bash, which GitHub provides on Windows too) so the build installs
# into it and pytest imports from it.
- name: Build the extension and run the test suite
shell: bash
run: |
python -m venv .venv
source .venv/bin/activate 2>/dev/null || source .venv/Scripts/activate
python -m pip install --upgrade pip maturin pytest
maturin develop --release
pytest -q
wheels:
name: wheels (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Build abi3 wheel
uses: PyO3/maturin-action@v1
with:
working-directory: clients/python
command: build
args: --release --out dist
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: clients/python/dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: clients/python
command: sdist
args: --out dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: clients/python/dist