A release was a git tag. Installing llmgw on a node meant having a Go toolchain, and the onboarding script copied a binary from wherever it was run — which works and quietly makes whoever runs it the build server, with the fleet ending up on whatever was in their working tree. Tags now build static linux/amd64, linux/arm64 and darwin binaries and attach them. CGO_ENABLED=0 is the point: it has to run on a node whose libc is older than the builder's, and llmgw has no C dependency because modernc.org/sqlite is pure Go precisely so this stays true. Verified: "not a dynamic executable", runs on a node, reports its version. `ctl engine-check` closes the other half of the phase 4 gap. llmgw's launch arguments are read from each engine's documentation, and engines rename flags between versions; when that happens the failure arrives minutes into a model load, in the engine's own error message, on a node nobody was watching. It builds the widest command llmgw would ever produce — multi-node, since a flag that only appears there is the one nobody notices has gone — and checks each flag against the engine's own --help. No GPU: a CLI prints its help anywhere. Verified against llama.cpp b10991, all seven flags accepted. Flags are matched on a word boundary, so --port is not satisfied by --port-range. Without that, a renamed flag would sail through the check that exists to catch renamed flags. It also warns when the help text looks truncated, which is how the first run went: llama.cpp's help cut to 400 of its 725 lines reported five flags as missing that the running cluster uses. TestSidecarRunsBeforeEngine was flaky under a full run, and worse than flaky — its wait loop fell through on timeout, so a slow machine turned the ordering assertion into a no-op and the failure surfaced later as something else. It now asserts, with a deadline that suits a machine running every other package at the same time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
89 lines
3.4 KiB
YAML
89 lines
3.4 KiB
YAML
# Attaches binaries to a release when a version tag is pushed.
|
|
#
|
|
# Without this a release is a git tag, and installing llmgw on a node means
|
|
# having a Go toolchain and the source. The onboarding script copies a binary
|
|
# from wherever it is run, which works and quietly makes whoever runs it the
|
|
# build server.
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
# Tags are what the version string is built from, and a shallow clone
|
|
# has none of them.
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Build
|
|
run: |
|
|
set -euo pipefail
|
|
version="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
|
|
mkdir -p dist
|
|
|
|
# CGO_ENABLED=0 is the whole point: the binary has to run on a node
|
|
# whose libc is older than the builder's, and llmgw has no C
|
|
# dependency — modernc.org/sqlite is pure Go precisely so this stays
|
|
# true.
|
|
for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do
|
|
os="${target%/*}"; arch="${target#*/}"
|
|
name="llmgw-${version}-${os}-${arch}"
|
|
echo "building $name"
|
|
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build \
|
|
-trimpath \
|
|
-ldflags "-s -w -X gitea.mynodes.xyz/ilker/llmgw/internal/version.Version=${version}" \
|
|
-o "dist/${name}" ./cmd/llmgw
|
|
(cd dist && sha256sum "${name}" >> checksums.txt)
|
|
done
|
|
|
|
# Proof the artifact runs at all before it is published. It cannot
|
|
# test the cross-compiled ones, which is why the native build is
|
|
# checked rather than assumed.
|
|
./dist/llmgw-${version}-linux-amd64 --version
|
|
cat dist/checksums.txt
|
|
|
|
- name: Attach to the release
|
|
env:
|
|
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "${TOKEN:-}" ]; then
|
|
echo "No GITEA_TOKEN secret, so nothing can be uploaded."
|
|
echo "Add one in the repository's Actions settings with package or"
|
|
echo "repository write scope; the binaries are in dist/ meanwhile."
|
|
exit 1
|
|
fi
|
|
tag="${GITHUB_REF_NAME}"
|
|
api="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
|
|
# The release usually exists already, created by hand with its notes.
|
|
id=$(curl -sS -H "Authorization: token $TOKEN" "$api/releases/tags/$tag" \
|
|
| sed -n 's/.*"id":\([0-9]*\).*/\1/p' | head -1)
|
|
if [ -z "$id" ]; then
|
|
echo "creating release $tag"
|
|
id=$(curl -sS -X POST -H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$tag\",\"name\":\"$tag\"}" \
|
|
"$api/releases" | sed -n 's/.*"id":\([0-9]*\).*/\1/p' | head -1)
|
|
fi
|
|
[ -n "$id" ] || { echo "could not find or create the release" >&2; exit 1; }
|
|
|
|
for f in dist/*; do
|
|
echo "uploading $(basename "$f")"
|
|
curl -sS -X POST -H "Authorization: token $TOKEN" \
|
|
-F "attachment=@$f" \
|
|
"$api/releases/$id/assets?name=$(basename "$f")" >/dev/null
|
|
done
|
|
echo "attached $(ls dist | wc -l) files to $tag"
|