Repository navigation
192 lines (184 loc) · 7.14 KB
/
Copy pathrelease.yml
File metadata and controls
192 lines (184 loc) · 7.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Builds Pithos for Windows x64, Linux x64 and Linux ARM64, runs the tests on each with the
# small model (LFM3-1.7B), and on a version tag (v*) creates a draft release with the archives.
# Run it by hand (Actions -> release -> Run workflow) to build and test without releasing.
name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
env:
MODEL: LFM3-1.7B-Q4_K_M.gguf
MODEL_URL: https://huggingface.co/LiquidAI/LFM3-1.7B-GGUF/resolve/bad5729bba61d076fff20d2548e62526665af215/LFM3-1.7B-Q4_K_M.gguf
MODEL_SHA256: 3793e1e6e2266919d6e015287221b41100175a98eddaba92e111aed3b05c93c4
jobs:
version:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: v
name: Version from src/main.c (must match the tag)
run: |
v=$(sed -n 's/^#define VERSION "\(.*\)"/\1/p' src/main.c)
echo "version=$v" >> "$GITHUB_OUTPUT"
if [[ "$GITHUB_REF" == refs/tags/* && "$GITHUB_REF_NAME" != "v$v" ]]; then
echo "tag $GITHUB_REF_NAME does not match VERSION $v in src/main.c"; exit 1
fi
windows-x64:
needs: version
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
id: msys2
with:
msystem: MINGW64
install: mingw-w64-x86_64-gcc
- name: Build (gcc, with tests)
shell: cmd
run: |
set "PATH=${{ steps.msys2.outputs.msys2-location }}\mingw64\bin;%PATH%"
call build.cmd test
- uses: actions/cache@v4
with:
path: models
key: model-${{ env.MODEL_SHA256 }}
- name: Model
shell: bash
run: |
mkdir -p models
[ -f "models/$MODEL" ] || curl -fL --retry 3 -o "models/$MODEL" "$MODEL_URL"
echo "$MODEL_SHA256 models/$MODEL" | sha256sum -c
- name: Tests
shell: bash
run: |
set -e
build/test_kernels.exe "models/$MODEL" > tk.txt || { cat tk.txt; exit 1; }
grep -E "ALL OK|FAIL" tk.txt
(mkdir -p shelltest && cd shelltest && ../build/test_shell.exe | tail -n 2)
out=$(build/pithos.exe -m "models/$MODEL" --cpu -p "What is the capital of France?" -n 24 --reasoning off)
echo "$out"
echo "$out" | grep -qi "paris"
- name: Package
shell: bash
run: |
d=pithos-${{ needs.version.outputs.version }}-windows-x64
mkdir -p "$d" dist
cp build/pithos.exe README.md LICENSE "$d/"
# the repository's server.cmd builds first; next to the prebuilt program it just starts it
printf '%s\r\n' '@echo off' \
'rem Start the Pithos server with the web chat and open it in the browser.' \
'rem Extra options are passed through, e.g. server.cmd -m models\LFM3-1.7B-Q4_K_M.gguf --cpu' \
'cd /d "%~dp0"' \
'pithos.exe --server --open %*' > "$d/server.cmd"
7z a "dist/$d.zip" "$d" >/dev/null
- uses: actions/upload-artifact@v4
with:
name: windows-x64
path: dist/*
linux-x64:
needs: version
# Ubuntu 22.04: the binary needs glibc 2.34 (Ubuntu 22.04, Debian 12, RHEL 9 and newer)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build (with tests)
run: make -j4 test
- uses: actions/cache@v4
with:
path: models
key: model-${{ env.MODEL_SHA256 }}
- name: Model
run: |
mkdir -p models
[ -f "models/$MODEL" ] || curl -fL --retry 3 -o "models/$MODEL" "$MODEL_URL"
echo "$MODEL_SHA256 models/$MODEL" | sha256sum -c
- name: Tests
run: |
set -e
build/test_kernels "models/$MODEL" > tk.txt || { cat tk.txt; exit 1; }
grep -E "ALL OK|FAIL" tk.txt
(mkdir -p shelltest && cd shelltest && ../build/test_shell | tail -n 2)
out=$(build/pithos -m "models/$MODEL" --cpu -p "What is the capital of France?" -n 24 --reasoning off)
echo "$out"
echo "$out" | grep -qi "paris"
echo "glibc needed: $(objdump -T build/pithos | grep -o 'GLIBC_[0-9.]*' | sort -Vu | tail -n 1)"
- name: Package
run: |
d=pithos-${{ needs.version.outputs.version }}-linux-x64
mkdir -p "$d" dist
cp build/pithos README.md LICENSE "$d/"
tar --owner=0 --group=0 --numeric-owner -czf "dist/$d.tar.gz" "$d"
- uses: actions/upload-artifact@v4
with:
name: linux-x64
path: dist/*
linux-arm64:
needs: version
runs-on: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
# two binaries: ARMv8.2 with dot product (Raspberry Pi 5, RK3566/RK3588, Graviton 2+) and
# plain ARMv8 for older cores (Raspberry Pi 3 / 4); the runner has dot product, so it runs both
- name: Build (dotprod and armv8, with tests)
run: |
grep -m1 Features /proc/cpuinfo
make -j4 test BUILD=build-dotprod ARCHFLAGS="-march=armv8.2-a+dotprod+fp16"
make -j4 test BUILD=build-armv8 ARCHFLAGS="-march=armv8-a"
- uses: actions/cache@v4
with:
path: models
key: model-${{ env.MODEL_SHA256 }}
- name: Model
run: |
mkdir -p models
[ -f "models/$MODEL" ] || curl -fL --retry 3 -o "models/$MODEL" "$MODEL_URL"
echo "$MODEL_SHA256 models/$MODEL" | sha256sum -c
- name: Tests
run: |
set -e
for b in build-dotprod build-armv8; do
echo "== $b"
$b/test_kernels "models/$MODEL" > tk.txt || { cat tk.txt; exit 1; }
grep -E "ALL OK|FAIL" tk.txt
(mkdir -p shelltest && cd shelltest && ../$b/test_shell | tail -n 2)
out=$($b/pithos -m "models/$MODEL" --cpu -p "What is the capital of France?" -n 24 --reasoning off)
echo "$out"
echo "$out" | grep -qi "paris"
$b/pithos -m "models/$MODEL" --cpu --bench 64,32 2>&1 | grep warm
done
- name: Package
run: |
d=pithos-${{ needs.version.outputs.version }}-linux-arm64
mkdir -p "$d" dist
cp build-dotprod/pithos "$d/pithos"
cp build-armv8/pithos "$d/pithos-armv8"
cp README.md LICENSE "$d/"
tar --owner=0 --group=0 --numeric-owner -czf "dist/$d.tar.gz" "$d"
- uses: actions/upload-artifact@v4
with:
name: linux-arm64
path: dist/*
release:
needs: [version, windows-x64, linux-x64, linux-arm64]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
run: cd dist && sha256sum * > SHA256SUMS && cat SHA256SUMS
- name: Draft release (published by hand after a check)
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" dist/* --draft \
--title "Pithos $GITHUB_REF_NAME" --notes-file .github/release-notes.md