mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-08-27 07:31:24 +02:00
985b14912b
* ci : apply ccache-clear with older/min/dry-run to all ccache jobs Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : install gh in ccache-clear if missing (container jobs) The ccache-clear action relies on the gh CLI, which is not present in container-based jobs. Install it on demand so those jobs can clear caches. Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : install gh via apt repo in ccache-clear The install.sh script used previously is no longer served (404). Switch to the official GitHub CLI apt repository, which is still available. Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : pass --repo to gh cache commands in ccache-clear In container jobs gh cannot auto-detect the repository from git, so gh cache list/delete fail with 'failed to run git: not a git repository'. Pass the repository explicitly via --repo using GITHUB_REPOSITORY. Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : drop -new suffix from vulkan ccache key The -new suffix was only needed to force a fresh cache. With ccache-clear now evicting stale caches, the original key can be used again. The old ccache-vulkan-ubuntu-24.04-arm-new entries still match the ccache-clear key prefix and are cleaned up automatically. Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : fix ccache-clear date parsing on macOS (BSD date) macOS ships BSD date, which has no -d option. The older cutoff check was silently disabled there: 'date: illegal option -- d' errors in the log and the loop was only stopped by the min limit, risking deletion of caches not older than the cutoff (e.g. saved by a concurrent job). Parse the ISO-8601 timestamps with GNU date when available and fall back to BSD date otherwise (TZ=UTC, fractional seconds dropped). Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : extract ccache-clear logic into scripts/ccache-clear.sh The composite action now consists of a dedicated step that installs the GitHub CLI when missing (e.g. in container jobs) and a thin step that calls the new script. The script follows the make-release-checks.sh conventions (usage/env header, set -euo pipefail, CLI flags) and only checks that gh is available. The action inputs are unchanged, so the workflow steps are untouched. Assisted-by: llama.cpp:DeepSeek-v4-Flash-0731 * ci : remove unused apple ccaches
261 lines
7.5 KiB
YAML
261 lines
7.5 KiB
YAML
name: CI (apple)
|
|
|
|
on:
|
|
workflow_dispatch: # allows manual triggering
|
|
push:
|
|
branches:
|
|
- master
|
|
paths: [
|
|
'.github/workflows/build-apple.yml',
|
|
'**/CMakeLists.txt',
|
|
'**/.cmake',
|
|
'**/*.h',
|
|
'**/*.hpp',
|
|
'**/*.c',
|
|
'**/*.cpp',
|
|
'**/*.swift',
|
|
'**/*.m',
|
|
'**/*.metal'
|
|
]
|
|
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths: [
|
|
'.github/workflows/build-apple.yml',
|
|
'ggml/src/ggml-metal/**'
|
|
]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GGML_NLOOP: 3
|
|
GGML_N_THREADS: 1
|
|
LLAMA_ARG_LOG_COLORS: 1
|
|
LLAMA_ARG_LOG_PREFIX: 1
|
|
LLAMA_ARG_LOG_TIMESTAMPS: 1
|
|
|
|
jobs:
|
|
macos-latest-arm64:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Clone
|
|
id: checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: ccache
|
|
uses: ggml-org/ccache-action@v1.2.21
|
|
with:
|
|
key: apple-arm64
|
|
evict-old-files: 1d
|
|
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
|
|
|
- name: Build
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_RPATH="@loader_path" \
|
|
-DLLAMA_FATAL_WARNINGS=ON \
|
|
-DLLAMA_BUILD_BORINGSSL=ON \
|
|
-DGGML_METAL_EMBED_LIBRARY=OFF \
|
|
-DGGML_METAL_SHADER_DEBUG=ON \
|
|
-DGGML_RPC=ON \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
|
|
time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
|
|
leaks -atExit -- ./build/bin/test-thread-safety -hf ggml-org/gemma-3-270m-qat-GGUF -ngl 99 -p "$(printf 'hello %.0s' {1..128})" -n 16 -c 512 -ub 32 -np 2 -t 2 -lv 1
|
|
|
|
- name: Test
|
|
id: cmake_test
|
|
run: |
|
|
cd build
|
|
ctest -L main -E "test-llama-archs" --verbose --timeout 900
|
|
|
|
- name: ccache-clear
|
|
uses: ./.github/actions/ccache-clear
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
with:
|
|
key: apple-arm64
|
|
older: 5m
|
|
min: 1
|
|
dry-run: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}
|
|
|
|
macos-latest-x64:
|
|
runs-on: macos-15-intel
|
|
|
|
steps:
|
|
- name: Clone
|
|
id: checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: ccache
|
|
uses: ggml-org/ccache-action@v1.2.21
|
|
with:
|
|
key: apple-x64
|
|
evict-old-files: 1d
|
|
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
|
|
|
- name: Build
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
# Metal is disabled due to intermittent failures with Github runners not having a GPU:
|
|
# https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_RPATH="@loader_path" \
|
|
-DLLAMA_FATAL_WARNINGS=ON \
|
|
-DLLAMA_BUILD_BORINGSSL=ON \
|
|
-DGGML_METAL=OFF \
|
|
-DGGML_RPC=ON \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
|
|
time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
|
|
|
|
- name: Test
|
|
id: cmake_test
|
|
run: |
|
|
cd build
|
|
ctest -L main --verbose --timeout 900
|
|
|
|
- name: ccache-clear
|
|
uses: ./.github/actions/ccache-clear
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
with:
|
|
key: apple-x64
|
|
older: 5m
|
|
min: 1
|
|
dry-run: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' }}
|
|
|
|
macos-latest-ios-xcode:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Xcode
|
|
uses: ggml-org/setup-xcode@v1
|
|
with:
|
|
xcode-version: latest-stable
|
|
|
|
- name: Build
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
cmake -B build -G Xcode \
|
|
-DGGML_METAL_EMBED_LIBRARY=ON \
|
|
-DLLAMA_OPENSSL=OFF \
|
|
-DLLAMA_BUILD_APP=OFF \
|
|
-DLLAMA_BUILD_EXAMPLES=OFF \
|
|
-DLLAMA_BUILD_TOOLS=OFF \
|
|
-DLLAMA_BUILD_TESTS=OFF \
|
|
-DLLAMA_BUILD_SERVER=OFF \
|
|
-DCMAKE_SYSTEM_NAME=iOS \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
|
|
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
|
|
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
|
|
|
|
- name: xcodebuild for swift package
|
|
id: xcodebuild
|
|
run: |
|
|
./build-xcframework.sh
|
|
|
|
- name: Upload xcframework artifact
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: llama-xcframework
|
|
path: build-apple/llama.xcframework/
|
|
retention-days: 1
|
|
|
|
- name: Build Xcode project
|
|
run: |
|
|
xcodebuild -downloadPlatform iOS
|
|
xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
|
|
|
|
macos-latest-tvos:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Clone
|
|
id: checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Build
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
cmake -B build -G Xcode \
|
|
-DGGML_METAL_EMBED_LIBRARY=ON \
|
|
-DLLAMA_BUILD_COMMON=OFF \
|
|
-DLLAMA_BUILD_APP=OFF \
|
|
-DLLAMA_BUILD_EXAMPLES=OFF \
|
|
-DLLAMA_BUILD_TOOLS=OFF \
|
|
-DLLAMA_BUILD_TESTS=OFF \
|
|
-DLLAMA_BUILD_SERVER=OFF \
|
|
-DCMAKE_SYSTEM_NAME=tvOS \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
|
|
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
|
|
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
|
|
|
|
macos-latest-visionos:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Clone
|
|
id: checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Build
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
cmake -B build -G Xcode \
|
|
-DGGML_METAL_EMBED_LIBRARY=ON \
|
|
-DLLAMA_BUILD_COMMON=OFF \
|
|
-DLLAMA_BUILD_APP=OFF \
|
|
-DLLAMA_BUILD_EXAMPLES=OFF \
|
|
-DLLAMA_BUILD_TOOLS=OFF \
|
|
-DLLAMA_BUILD_TESTS=OFF \
|
|
-DLLAMA_BUILD_SERVER=OFF \
|
|
-DCMAKE_SYSTEM_NAME=visionOS \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
|
|
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
|
|
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
|
|
|
|
macos-latest-swift:
|
|
runs-on: macos-latest
|
|
needs: macos-latest-ios-xcode
|
|
|
|
strategy:
|
|
matrix:
|
|
destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
|
|
|
|
steps:
|
|
- name: Clone
|
|
id: checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Download xcframework artifact
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: llama-xcframework
|
|
path: build-apple/llama.xcframework/
|
|
|
|
- name: Build llama.cpp with CMake
|
|
id: cmake_build
|
|
run: |
|
|
sysctl -a
|
|
cmake -B build -G Xcode \
|
|
-DGGML_METAL_EMBED_LIBRARY=ON \
|
|
-DLLAMA_OPENSSL=OFF \
|
|
-DLLAMA_BUILD_APP=OFF \
|
|
-DLLAMA_BUILD_EXAMPLES=OFF \
|
|
-DLLAMA_BUILD_TOOLS=OFF \
|
|
-DLLAMA_BUILD_TESTS=OFF \
|
|
-DLLAMA_BUILD_SERVER=OFF \
|
|
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
|
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
|