Skip to content

Fork — xcframework build & rolling release #4

Fork — xcframework build & rolling release

Fork — xcframework build & rolling release #4

name: Fork — xcframework build & rolling release
# Fork-specific workflow for apocryphx/llama.cpp. Builds the Apple
# xcframework using the Ninja-patched build-xcframework.sh and publishes
# it to the rolling "latest" prerelease so downstream consumers can curl
# a prebuilt zip.
#
# Separate from upstream's build-apple.yml so upstream syncs don't
# clobber it. See README.md § "Downloading a prebuilt xcframework".
on:
workflow_dispatch:
push:
branches: [master]
paths:
- 'build-xcframework.sh'
- 'CMakeLists.txt'
- 'ggml/**'
- 'src/**'
- 'include/**'
- 'common/**'
- '.github/workflows/fork-xcframework-release.yml'
schedule:
# Weekly rebuild so the "latest" asset doesn't go stale against
# upstream security/bugfix releases.
- cron: '17 7 * * 1'
concurrency:
group: fork-xcframework-release
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
runs-on: macos-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Xcode
uses: ggml-org/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install Ninja + ensure CMake 4.x
run: |
brew install ninja
brew upgrade cmake || brew install cmake
cmake --version
ninja --version
xcodebuild -version
- name: Build xcframework
run: |
./build-xcframework.sh
- name: Capture build metadata
id: meta
run: |
set -e
UPSTREAM_TAG=$(git describe --tags --abbrev=0 --match 'b*' 2>/dev/null || echo "unknown")
COMMIT_SHORT=$(git rev-parse --short HEAD)
BUILD_DATE=$(date -u +%Y-%m-%d)
{
echo "upstream_tag=$UPSTREAM_TAG"
echo "commit_short=$COMMIT_SHORT"
echo "build_date=$BUILD_DATE"
} >> "$GITHUB_OUTPUT"
- name: Zip xcframework
run: |
cd build-apple
zip -r -y ../llama.xcframework.zip llama.xcframework
cd ..
ls -lh llama.xcframework.zip
shasum -a 256 llama.xcframework.zip | tee llama.xcframework.zip.sha256
- name: Upload workflow artifact
uses: actions/upload-artifact@v6
with:
name: llama-xcframework-${{ steps.meta.outputs.commit_short }}
path: |
llama.xcframework.zip
llama.xcframework.zip.sha256
retention-days: 30
- name: Publish rolling "latest" prerelease
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v2
with:
tag_name: latest
name: "Rolling build (${{ steps.meta.outputs.build_date }})"
body: |
Automatically rebuilt xcframework on every push to `master` and weekly.
- upstream tag: `${{ steps.meta.outputs.upstream_tag }}`
- fork commit: `${{ steps.meta.outputs.commit_short }}`
- built: ${{ steps.meta.outputs.build_date }}
- slices: ios-arm64, ios-arm64-simulator, macos-arm64_x86_64, xros-arm64, xros-arm64-simulator, tvos-arm64, tvos-arm64-simulator
```
curl -LO https://github.com/${{ github.repository }}/releases/download/latest/llama.xcframework.zip
unzip llama.xcframework.zip
```
SHA-256: see `llama.xcframework.zip.sha256`.
prerelease: true
make_latest: false
files: |
llama.xcframework.zip
llama.xcframework.zip.sha256