-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (102 loc) · 3.44 KB
/
Copy pathpython-bindings.yml
File metadata and controls
122 lines (102 loc) · 3.44 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Python bindings
# `agent/**` so a feature branch gates itself before a pull request exists —
# full reasoning, including why the duplicate run while a PR is open is
# deliberate, in ci.yml.
on:
push:
branches: [main, develop, 'agent/**']
paths:
- 'bindings/python/**'
- 'crates/ae-core/**'
- '.github/workflows/python-bindings.yml'
pull_request:
branches: [main, develop]
paths:
- 'bindings/python/**'
- 'crates/ae-core/**'
- '.github/workflows/python-bindings.yml'
permissions:
contents: read
defaults:
run:
working-directory: bindings/python
jobs:
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
# Pinned to match crates/rust-toolchain.toml, same reasoning as rust.yml:
# a floating toolchain turns an unrelated Rust release into a red gate on
# an untouched branch.
- uses: dtolnay/rust-toolchain@1.97.1
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: bindings/python
- run: cargo fmt --all -- --check
- run: cargo clippy --locked --all-targets --all-features -- -D warnings
build:
name: Build
needs: check
# Four runners producing wheels is a packaging check, not a compile gate:
# the Test job below already builds a wheel on Linux, so a branch that
# cannot compile goes red without this. Keep it off intermediate pushes and
# run it where the wheels are actually about to matter — the pull request
# and the integration branches.
if: github.event_name == 'pull_request' || github.ref_name == 'develop' || github.ref_name == 'main'
strategy:
fail-fast: false
matrix:
include:
# abi3 (abi3-py39): one wheel per platform covers every CPython
# 3.9+, so the matrix is OS x arch, not OS x CPython minor.
- os: ubuntu-latest
target: x86_64
manylinux: auto
- os: ubuntu-latest
target: aarch64
manylinux: auto
- os: macos-latest
target: x86_64
- os: macos-latest
target: aarch64
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@1.97.1
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
target: ${{ matrix.target }}
args: --release --out dist
manylinux: ${{ matrix.manylinux || 'auto' }}
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}-${{ matrix.target }}
path: bindings/python/dist/*.whl
test:
name: Test
needs: check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@1.97.1
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- run: pip install maturin pytest
# Not `maturin develop`: that needs an active virtualenv to install
# into, and a bare `actions/setup-python` runner has none. Build the
# wheel and install it the same way a real consumer would.
- run: maturin build --release --out dist
- run: pip install dist/*.whl
- run: pytest tests/ -v