87 lines
2.8 KiB
YAML
87 lines
2.8 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
name: Test (${{ matrix.os }}, ${{ matrix.target }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Linux x86_64
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
# Linux aarch64
|
|
- os: ubuntu-26.04-arm
|
|
target: aarch64-unknown-linux-gnu
|
|
# Windows x86_64
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
# macOS Apple Silicon
|
|
- os: macos-14
|
|
target: aarch64-apple-darwin
|
|
# macOS Intel
|
|
- os: macos-13
|
|
target: x86_64-apple-darwin
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install maturin and dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install "maturin>=1.5" pytest pytest-benchmark
|
|
|
|
# v0.7.14 (closes #19): yantrikdb-python now includes a build.rs
|
|
# that emits `-undefined dynamic_lookup` on macOS targets, so
|
|
# stock `cargo build` works on macOS without external tooling.
|
|
# No more `--exclude yantrikdb-python` on the build step (still
|
|
# excluded from cargo test below because pyo3 extension-module +
|
|
# cargo test = link error on ALL platforms, since no Python
|
|
# interpreter exists at test-link time).
|
|
- name: Build tests and Rust components
|
|
run: cargo build --workspace --verbose
|
|
|
|
# `yantrikdb-python` is a pyo3 extension-module crate — `cargo test`
|
|
# tries to link a test binary against the Python C ABI but
|
|
# `extension-module` feature tells pyo3 NOT to embed the interpreter,
|
|
# so the test binary fails to link with `undefined symbol:
|
|
# PyGILState_Release` and friends. Python tests run via pytest below
|
|
# against the maturin-built wheel, which is the correct surface. So
|
|
# exclude the python crate from cargo test.
|
|
|
|
# Slim build path (`--no-default-features`) is a real deployment
|
|
# surface — users who want to BYO their own embedder strip the
|
|
# bundled-embedder + embedder-download Cargo features.
|
|
- name: Run Rust Tests (slim, --no-default-features)
|
|
run: cargo test --workspace --exclude yantrikdb-python --no-default-features --verbose
|
|
|
|
- name: Run Rust Tests
|
|
run: cargo test --workspace --exclude yantrikdb-python --verbose
|
|
|
|
- name: Install Python package
|
|
run: pip install -e ".[all,dev]"
|
|
|
|
- name: Run Python Tests
|
|
run: pytest tests/ -v
|