.PHONY: check fmt test doctest doc \
coverage coverage-summary \
bench bench-quick miri asan ci clean \
public-api public-api-update \
python-test python-typecheck python-wheel python-examples-test \
node-test node-build node-verify node-example
RUSTFMT_OPTS := imports_granularity=Crate,group_imports=StdExternalCrate
check:
cargo fmt --all -- --check --config $(RUSTFMT_OPTS)
cargo clippy --all-targets --features test-helpers -- -D warnings
fmt:
cargo fmt --all -- --config $(RUSTFMT_OPTS)
public-api:
cargo public-api --simplified > /tmp/infino-public-api.current
diff -u public-api.txt /tmp/infino-public-api.current \
|| { echo "Public API drifted. Review, then run 'make public-api-update'."; exit 1; }
public-api-update:
cargo public-api --simplified > public-api.txt
test:
cargo test --features test-helpers
coverage:
cargo llvm-cov --summary-only --features test-helpers --fail-under-lines 90 --fail-under-functions 90 --fail-under-regions 90 --ignore-filename-regex "test_helpers/"
coverage-summary:
cargo llvm-cov --summary-only --features test-helpers
bench:
cargo bench --features test-helpers
bench-quick:
INFINO_BENCH_SUPERFILE_DOCS=100000 cargo bench --features test-helpers -- superfile fts warm
miri:
cargo +nightly miri test --lib superfile::fts
asan:
RUSTFLAGS="-Z sanitizer=address" \
cargo +nightly test --lib \
--target $$(rustc -vV | sed -n 's|host: ||p') superfile::fts
doctest:
cargo test --doc
doc:
cargo doc --no-deps --open
python-test:
python3 -m venv infino-python/.venv
infino-python/.venv/bin/pip install -q --upgrade pip
infino-python/.venv/bin/pip install -q maturin pytest pyarrow pandas
VIRTUAL_ENV=$(CURDIR)/infino-python/.venv infino-python/.venv/bin/maturin develop --locked -m infino-python/Cargo.toml
infino-python/.venv/bin/python -m pytest infino-python/tests/ -v
python-typecheck:
python3 -m venv infino-python/.venv
infino-python/.venv/bin/pip install -q --upgrade pip mypy
MYPYPATH=infino-python/python infino-python/.venv/bin/mypy \
--config-file infino-python/pyproject.toml \
infino-python/python/infino/__init__.py \
infino-python/tests/typing/quickstart.py
python-wheel:
python3 -m venv infino-python/.venv
infino-python/.venv/bin/pip install -q --upgrade pip maturin
infino-python/.venv/bin/maturin build --release --locked --out infino-python/dist -m infino-python/Cargo.toml
CONCURRENT_EXAMPLE_TESTS ?= 4
python-examples-test:
python3 -m venv infino-python/.venv
infino-python/.venv/bin/pip install -q --upgrade pip maturin
VIRTUAL_ENV=$(CURDIR)/infino-python/.venv infino-python/.venv/bin/maturin develop --locked -m infino-python/Cargo.toml
grep -v '^[[:space:]]*infino' infino-python/examples/requirements.txt \
| infino-python/.venv/bin/pip install -q -r /dev/stdin
infino-python/.venv/bin/pip install -q nbconvert ipykernel
PYTHONPATH=infino-python/examples infino-python/.venv/bin/python \
-c "from _shared.embedding import _get_model; _get_model()" >/dev/null
@ls infino-python/examples/*/[0-9]*.ipynb | \
PY=infino-python/.venv/bin/python xargs -P $(CONCURRENT_EXAMPLE_TESTS) -I {} \
sh -c 'echo "executing {}"; "$$PY" -m nbconvert --to notebook --execute \
--stdout --ExecutePreprocessor.timeout=900 "{}" >/dev/null'; \
status=$$?; \
rm -rf infino-python/examples/*/*_data infino-python/examples/_shared/__pycache__; \
exit $$status
node-test:
cd infino-node && npm install && npm run build:debug && npm test
node-build:
cd infino-node && npm install && npm run build
node-example:
cd infino-node/examples/agent-memory && npm install && node index.mjs
cd infino-node/examples/hybrid-search-api && npm install && SMOKE=1 node index.mjs
node-verify:
cd infino-node && ./scripts/verify-pack.sh
ci: check doctest coverage
@echo "✓ ready to PR"
clean:
cargo clean
rm -rf target/llvm-cov
rm -f lcov.info