Skip to content

Commit ed11f23

Browse files
committed
Add build workflow
0 parents  commit ed11f23

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# GitHub Actions workflow to build llama-finetune binary for all platforms
2+
#
3+
# Usage:
4+
# 1. Create a new repo (e.g., nitroinbox-binaries)
5+
# 2. Copy this file to .github/workflows/build-finetune.yml
6+
# 3. Go to Actions tab and manually trigger "Build llama-finetune"
7+
# 4. Download artifacts and create a release with them
8+
#
9+
# This is a one-time build workflow (manual trigger only)
10+
11+
name: Build llama-finetune
12+
13+
on:
14+
workflow_dispatch:
15+
inputs:
16+
llama_cpp_ref:
17+
description: 'llama.cpp git ref (tag, branch, or commit)'
18+
required: true
19+
default: 'b4547'
20+
release_version:
21+
description: 'Release version tag (e.g., v1.0.0)'
22+
required: true
23+
default: 'v1.0.0'
24+
25+
jobs:
26+
build-macos-arm64:
27+
runs-on: macos-14 # M1/M2 runner
28+
steps:
29+
- name: Checkout llama.cpp
30+
uses: actions/checkout@v4
31+
with:
32+
repository: ggerganov/llama.cpp
33+
ref: ${{ github.event.inputs.llama_cpp_ref }}
34+
35+
- name: Build llama-finetune
36+
run: |
37+
mkdir build && cd build
38+
cmake .. -DGGML_METAL=ON -DLLAMA_BUILD_EXAMPLES=ON
39+
cmake --build . --config Release --target llama-finetune -j$(sysctl -n hw.ncpu)
40+
41+
- name: Package binary
42+
run: |
43+
mkdir -p dist
44+
cp build/bin/llama-finetune dist/
45+
cd dist
46+
zip llama-finetune-macos-arm64.zip llama-finetune
47+
48+
- name: Upload artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: llama-finetune-macos-arm64
52+
path: dist/llama-finetune-macos-arm64.zip
53+
54+
build-macos-x64:
55+
runs-on: macos-13 # Intel runner
56+
steps:
57+
- name: Checkout llama.cpp
58+
uses: actions/checkout@v4
59+
with:
60+
repository: ggerganov/llama.cpp
61+
ref: ${{ github.event.inputs.llama_cpp_ref }}
62+
63+
- name: Build llama-finetune
64+
run: |
65+
mkdir build && cd build
66+
cmake .. -DGGML_METAL=ON -DLLAMA_BUILD_EXAMPLES=ON
67+
cmake --build . --config Release --target llama-finetune -j$(sysctl -n hw.ncpu)
68+
69+
- name: Package binary
70+
run: |
71+
mkdir -p dist
72+
cp build/bin/llama-finetune dist/
73+
cd dist
74+
zip llama-finetune-macos-x64.zip llama-finetune
75+
76+
- name: Upload artifact
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: llama-finetune-macos-x64
80+
path: dist/llama-finetune-macos-x64.zip
81+
82+
build-linux-x64:
83+
runs-on: ubuntu-22.04
84+
steps:
85+
- name: Checkout llama.cpp
86+
uses: actions/checkout@v4
87+
with:
88+
repository: ggerganov/llama.cpp
89+
ref: ${{ github.event.inputs.llama_cpp_ref }}
90+
91+
- name: Install dependencies
92+
run: |
93+
sudo apt-get update
94+
sudo apt-get install -y build-essential cmake
95+
96+
- name: Build llama-finetune
97+
run: |
98+
mkdir build && cd build
99+
cmake .. -DLLAMA_BUILD_EXAMPLES=ON
100+
cmake --build . --config Release --target llama-finetune -j$(nproc)
101+
102+
- name: Package binary
103+
run: |
104+
mkdir -p dist
105+
cp build/bin/llama-finetune dist/
106+
cd dist
107+
zip llama-finetune-linux-x64.zip llama-finetune
108+
109+
- name: Upload artifact
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: llama-finetune-linux-x64
113+
path: dist/llama-finetune-linux-x64.zip
114+
115+
build-linux-arm64:
116+
runs-on: ubuntu-22.04-arm # ARM runner
117+
steps:
118+
- name: Checkout llama.cpp
119+
uses: actions/checkout@v4
120+
with:
121+
repository: ggerganov/llama.cpp
122+
ref: ${{ github.event.inputs.llama_cpp_ref }}
123+
124+
- name: Install dependencies
125+
run: |
126+
sudo apt-get update
127+
sudo apt-get install -y build-essential cmake
128+
129+
- name: Build llama-finetune
130+
run: |
131+
mkdir build && cd build
132+
cmake .. -DLLAMA_BUILD_EXAMPLES=ON
133+
cmake --build . --config Release --target llama-finetune -j$(nproc)
134+
135+
- name: Package binary
136+
run: |
137+
mkdir -p dist
138+
cp build/bin/llama-finetune dist/
139+
cd dist
140+
zip llama-finetune-linux-arm64.zip llama-finetune
141+
142+
- name: Upload artifact
143+
uses: actions/upload-artifact@v4
144+
with:
145+
name: llama-finetune-linux-arm64
146+
path: dist/llama-finetune-linux-arm64.zip
147+
148+
create-release:
149+
needs: [build-macos-arm64, build-macos-x64, build-linux-x64, build-linux-arm64]
150+
runs-on: ubuntu-latest
151+
permissions:
152+
contents: write
153+
steps:
154+
- name: Download all artifacts
155+
uses: actions/download-artifact@v4
156+
with:
157+
path: artifacts
158+
159+
- name: Create Release
160+
uses: softprops/action-gh-release@v1
161+
with:
162+
tag_name: ${{ github.event.inputs.release_version }}
163+
name: llama-finetune ${{ github.event.inputs.release_version }}
164+
body: |
165+
Pre-built llama-finetune binary from llama.cpp ref: ${{ github.event.inputs.llama_cpp_ref }}
166+
167+
## Platforms
168+
- `llama-finetune-macos-arm64.zip` - macOS Apple Silicon (M1/M2/M3)
169+
- `llama-finetune-macos-x64.zip` - macOS Intel
170+
- `llama-finetune-linux-x64.zip` - Linux x64
171+
- `llama-finetune-linux-arm64.zip` - Linux ARM64
172+
173+
## Usage
174+
Extract the zip and run:
175+
```bash
176+
chmod +x llama-finetune
177+
./llama-finetune --help
178+
```
179+
files: |
180+
artifacts/llama-finetune-macos-arm64/llama-finetune-macos-arm64.zip
181+
artifacts/llama-finetune-macos-x64/llama-finetune-macos-x64.zip
182+
artifacts/llama-finetune-linux-x64/llama-finetune-linux-x64.zip
183+
artifacts/llama-finetune-linux-arm64/llama-finetune-linux-arm64.zip

0 commit comments

Comments
 (0)