Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ 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 $(LLM_BASE_FEATURE_FLAGS) -- --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
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