name: Test
on:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint, format & docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: lint
- name: Check formatting
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Build docs
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --all-features
- name: Doctests
run: cargo test --doc --all-features
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@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: test
- name: Run tests
run: cargo test --workspace --all-features --exclude code2graph-py --exclude code2graph-node
bindings:
name: Build bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: bindings
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build Python wheel (maturin)
run: |
pip install maturin
maturin build --release -m bindings/python/Cargo.toml
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: "22"
- name: Build Node addon (napi)
working-directory: bindings/node
run: |
npm ci
npx napi build --release --platform