Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
debcd91
add windows and mac github runners
malzag May 15, 2026
07b4062
fix windows compile errors from bindgen type mismatch on MSVC
malzag May 15, 2026
b228176
add 30 minute timeouts to unit tests workflow
malzag May 15, 2026
50b39a3
fix another windows compile error from bindgen type mismatch on MSVC
malzag May 15, 2026
256638f
enable rust backtraces in CI tests
malzag May 15, 2026
88e5c52
fix windows test crashes from missing backend init and /EHsc
malzag May 16, 2026
a5b958b
bump vendored llama.cpp to b9174
malzag May 16, 2026
ee87102
wrap mtmd and fit ffi entry points to surface c++ exceptions as typed…
malzag May 16, 2026
bd7ff5d
wrap encode and memory seq ffi entry points to surface c++ exceptions…
malzag May 16, 2026
53087b3
wrap chat parse ffi accessors to surface c++ exceptions as typed rust…
malzag May 16, 2026
3471b41
retrofit existing wrappers to per-wrapper status enums and surface c+…
malzag May 16, 2026
002b61b
pass /EHsc to vendored llama.cpp msvc build so c++ exceptions can unw…
malzag May 16, 2026
fa39d5a
wrap remaining raw vendored ffi calls to surface c++ exceptions as ty…
malzag May 16, 2026
38cfdf7
apply cargo fmt to phase 1 wrapper refactor
malzag May 16, 2026
5e4b7c5
use per-wrapper LLAMA_RS_SAMPLER_ACCEPT_OK constant in sampler accept…
malzag May 16, 2026
f5d0272
build llm tests in release mode to avoid windows debug-crt _osfile as…
malzag May 16, 2026
2e169e1
replace coverage scripts with cargo-llvm-cov and rust-coverage-check …
mcharytoniuk May 19, 2026
f38012f
rename error variants to describe semantics instead of FFI mechanics
mcharytoniuk May 19, 2026
c03f4b2
cover previously-uncovered parser, sampler, and log decoder failure p…
mcharytoniuk May 19, 2026
323a6f6
unify clippy into a single target covering all workspace crates
mcharytoniuk May 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/rules/code-coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code Coverage Measurement

- Use `make coverage` to measure code coverage. This is the authoritative source.
31 changes: 0 additions & 31 deletions .claude/skills/coverage/SKILL.md

This file was deleted.

20 changes: 20 additions & 0 deletions .github/actions/install-build-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: install-build-dependencies
description: Install OS-specific system packages needed to build llama-cpp-bindings (CMake, libclang, GNU make).

runs:
using: composite
steps:
- name: install linux build dependencies
if: runner.os == 'Linux'
shell: bash
run: sudo apt-get update && sudo apt-get install -y cmake libclang-dev

- name: install windows build dependencies
if: runner.os == 'Windows'
shell: bash
run: choco install -y make

- name: set windows libclang path
if: runner.os == 'Windows'
shell: bash
run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $GITHUB_ENV
11 changes: 11 additions & 0 deletions .github/actions/install-rust-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: install-rust-toolchain
description: Install the pinned stable Rust toolchain (with rustfmt and clippy) and configure the cargo build cache.

runs:
using: composite
steps:
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2
29 changes: 18 additions & 11 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,40 @@ env:
CARGO_TERM_COLOR: always

jobs:
fmt:
formatting:
name: formatting
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/install-rust-toolchain

- run: make fmt.check

test:
name: tests
runs-on: ubuntu-latest
name: tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
env:
LLAMA_DISABLE_CCACHE: '1'
RUST_BACKTRACE: '1'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: install system dependencies
run: sudo apt-get update && sudo apt-get install -y cmake libclang-dev

- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: ./.github/actions/install-build-dependencies

- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/install-rust-toolchain

- run: make test.unit
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ target/

# Mac stuff
.DS_Store

# Node modules (rust-coverage-check npm dependency)
node_modules/

# LLVM source-based coverage raw and merged profile artifacts
*.profraw
*.profdata
68 changes: 49 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ TEST_DEVICE ?=
QWEN_CAPABLE_FEATURES = multimodal_capable,mrope_model

DEVICE_FEATURE = $(if $(TEST_DEVICE),--features $(TEST_DEVICE),)
LLM_BASE_FEATURE_FLAGS = $(DEVICE_FEATURE)
LLM_QWEN_CAPABLE_FEATURE_FLAGS = $(DEVICE_FEATURE) --features $(QWEN_CAPABLE_FEATURES)

CARGO_TEST_LLM_FLAGS = --no-fail-fast -p llama-cpp-bindings-tests $(LLM_BASE_FEATURE_FLAGS) -- --test-threads=1
CARGO_TEST_LLM_FLAGS_QWEN_CAPABLE = --no-fail-fast -p llama-cpp-bindings-tests $(LLM_QWEN_CAPABLE_FEATURE_FLAGS) -- --test-threads=1
CARGO_TEST_LLM_FLAGS = --release --no-fail-fast -p llama-cpp-bindings-tests $(DEVICE_FEATURE) -- --test-threads=1
CARGO_TEST_LLM_FLAGS_QWEN_CAPABLE = --release --no-fail-fast -p llama-cpp-bindings-tests $(LLM_QWEN_CAPABLE_FEATURE_FLAGS) -- --test-threads=1


QWEN3_5_0_8B_ENV = \
LLAMA_TEST_HF_REPO=unsloth/Qwen3.5-0.8B-GGUF \
Expand Down Expand Up @@ -42,26 +42,56 @@ DEEPSEEK_R1_DISTILL_LLAMA_8B_ENV = \
LLAMA_TEST_HF_ENCODER_REPO=Xiaojian9992024/t5-small-GGUF \
LLAMA_TEST_HF_ENCODER_MODEL=t5-small.bf16.gguf

node_modules: package-lock.json
npm ci
touch node_modules

package-lock.json: package.json
npm install --package-lock-only

.PHONY: clean.cmake
clean.cmake:
rm -rf target/llama-cpp-cmake-build

.PHONY: clippy
clippy: clippy.core clippy.tests.base clippy.tests.qwen_capable

.PHONY: clippy.core
clippy.core:
clippy:
cargo clippy --all-targets -p llama-cpp-bindings-types -- -D warnings
cargo clippy --all-targets -p llama-cpp-log-decoder -- -D warnings
cargo clippy --all-targets -p llama-cpp-bindings-build -- -D warnings
cargo clippy --all-targets -p llama-cpp-bindings-sys $(DEVICE_FEATURE) -- -D warnings
cargo clippy --all-targets -p llama-cpp-bindings $(DEVICE_FEATURE) -- -D warnings

.PHONY: clippy.tests.base
clippy.tests.base:
cargo clippy --all-targets -p llama-cpp-bindings-tests $(LLM_BASE_FEATURE_FLAGS) -- -D warnings

.PHONY: clippy.tests.qwen_capable
clippy.tests.qwen_capable:
cargo clippy --all-targets -p llama-cpp-bindings-tests $(DEVICE_FEATURE) -- -D warnings
cargo clippy --all-targets -p llama-cpp-bindings-tests $(LLM_QWEN_CAPABLE_FEATURE_FLAGS) -- -D warnings

.PHONY: coverage
coverage: node_modules
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report -p llama-cpp-log-decoder
cargo llvm-cov --no-report -p llama-cpp-bindings-types
cargo llvm-cov --no-report -p llama-cpp-bindings --lib $(DEVICE_FEATURE)
$(DEEPSEEK_R1_DISTILL_LLAMA_8B_ENV) cargo llvm-cov --no-report --no-fail-fast -p llama-cpp-bindings-tests $(DEVICE_FEATURE) -- --test-threads=1
$(GLM4_7_FLASH_ENV) cargo llvm-cov --no-report --no-fail-fast -p llama-cpp-bindings-tests $(DEVICE_FEATURE) -- --test-threads=1
$(QWEN3_5_0_8B_ENV) cargo llvm-cov --no-report --no-fail-fast -p llama-cpp-bindings-tests $(LLM_QWEN_CAPABLE_FEATURE_FLAGS) -- --test-threads=1
$(QWEN3_6_35B_A3B_ENV) cargo llvm-cov --no-report --no-fail-fast -p llama-cpp-bindings-tests $(LLM_QWEN_CAPABLE_FEATURE_FLAGS) -- --test-threads=1
cargo llvm-cov report --json --output-path target/llvm-cov.json
cargo llvm-cov report --lcov --output-path target/lcov.info
cargo llvm-cov report
npx rust-coverage-check target/llvm-cov.json \
--workspace-root $(CURDIR) \
--gated llama-cpp-bindings=95 \
--gated llama-cpp-log-decoder=99 \
--gated llama-cpp-bindings-types=99

.PHONY: coverage-clean
coverage-clean:
cargo llvm-cov clean --workspace
rm -rf target/llvm-cov-target
rm -f target/llvm-cov.json target/lcov.info

.PHONY: coverage-report
coverage-report:
cargo llvm-cov report --html

.PHONY: fmt
fmt:
cargo fmt --all
Expand All @@ -74,11 +104,11 @@ fmt.check:
test: test.unit test.llms

.PHONY: test.deepseek_r1_distill_llama_8b
test.deepseek_r1_distill_llama_8b: clippy.core clippy.tests.base
test.deepseek_r1_distill_llama_8b: clippy
$(DEEPSEEK_R1_DISTILL_LLAMA_8B_ENV) cargo test $(CARGO_TEST_LLM_FLAGS)

.PHONY: test.glm4_7_flash
test.glm4_7_flash: clippy.core clippy.tests.base
test.glm4_7_flash: clippy
$(GLM4_7_FLASH_ENV) cargo test $(CARGO_TEST_LLM_FLAGS)

.PHONY: test.llms
Expand All @@ -89,14 +119,14 @@ test.llms: \
test.qwen3.6_35b_a3b

.PHONY: test.qwen3.5_0.8B
test.qwen3.5_0.8B: clippy.core clippy.tests.qwen_capable
test.qwen3.5_0.8B: clippy
$(QWEN3_5_0_8B_ENV) cargo test $(CARGO_TEST_LLM_FLAGS_QWEN_CAPABLE)

.PHONY: test.qwen3.6_35b_a3b
test.qwen3.6_35b_a3b: clippy.core clippy.tests.qwen_capable
test.qwen3.6_35b_a3b: clippy
$(QWEN3_6_35B_A3B_ENV) cargo test $(CARGO_TEST_LLM_FLAGS_QWEN_CAPABLE)

.PHONY: test.unit
test.unit: clippy.core
test.unit: clippy
cargo test -p llama-cpp-log-decoder
cargo test -p llama-cpp-bindings $(DEVICE_FEATURE)
1 change: 1 addition & 0 deletions llama-cpp-bindings-build/src/cmake_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn configure_platform_specific(
TargetOs::Windows(WindowsVariant::Msvc) => {
config.cflag("/w");
config.cxxflag("/w");
config.cxxflag("/EHsc");
configure_msvc_release_workaround(config, profile);
}
TargetOs::Android => {
Expand Down
1 change: 1 addition & 0 deletions llama-cpp-bindings-build/src/cpp_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn compile_cpp_wrappers(llama_src: &Path, target_os: &TargetOs) {

if target_os.is_msvc() {
build.flag("/std:c++17");
build.flag("/EHsc");
}

if target_os.is_android() && cfg!(feature = "static-stdcxx") {
Expand Down
1 change: 1 addition & 0 deletions llama-cpp-bindings-build/src/cpp_wrapper_mtmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub fn compile_mtmd(llama_src: &Path, target_os: &TargetOs) {

if target_os.is_msvc() {
build.flag("/std:c++17");
build.flag("/EHsc");
}

if target_os.is_android() && cfg!(feature = "static-stdcxx") {
Expand Down
2 changes: 1 addition & 1 deletion llama-cpp-bindings-sys/llama.cpp
Submodule llama.cpp updated 1065 files
Loading
Loading