Repository navigation
52 lines (42 loc) · 1.65 KB
/
Copy pathci-python.yml
File metadata and controls
52 lines (42 loc) · 1.65 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
name: CI (Python)
on:
push:
branches: [master]
paths: ["python/**", "bindings/uniffi/**", "rust/**", "spec/test-vectors/**", ".github/workflows/ci-python.yml"]
pull_request:
paths: ["python/**", "bindings/uniffi/**", "rust/**", "spec/test-vectors/**", ".github/workflows/ci-python.yml"]
jobs:
ci:
# The Python package is a UniFFI (ctypes) binding, so the native lib + generated
# module must be staged into the package before importing it.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build UniFFI lib + generate bindings
run: |
cargo build --release --manifest-path bindings/uniffi/Cargo.toml
gen="$(mktemp -d)"
( cd bindings/uniffi && cargo run --release --quiet --bin uniffi-bindgen -- \
generate --library target/release/libchromahash_uniffi.so --language python --out-dir "$gen" )
cp "$gen/chromahash_uniffi.py" python/chromahash/_uniffi.py
cp bindings/uniffi/target/release/libchromahash_uniffi.so python/chromahash/
- name: Install dependencies
working-directory: python
run: uv sync
- name: Format check
working-directory: python
run: uv run ruff format --check .
- name: Lint
working-directory: python
run: uv run ruff check .
- name: Test
working-directory: python
run: uv run pytest tests/