Files
llmgw/.gitea/workflows/release.yml
T
Ilker ManapandClaude Opus 5 a2b3f63a0d
CI / test (push) Successful in 1m56s
Release / build (push) Failing after 2m31s
Say what v0.6.0 is, and let the release actually publish it
The changelog had two "Unreleased" headings. The second sat below v0.5.0 and
was the detail behind it — phases 2 and 3, written while they were in progress
and never folded in when the release was cut — so it claimed as unreleased
work that had been shipped for two days. It is now a section of v0.5.0. The
status table said v0.5.0 was planned, which its own release notes disprove.

The first "Unreleased" becomes v0.6.0: eighty commits, of which phase 4 is the
headline and the rest is what a cluster needs before anyone but its operator
is let near it.

Two things would have stopped the release workflow publishing anything:

Gitea gives every job a built-in GITEA_TOKEN, but what it may do depends on
the instance's default mode, and under the restricted default it is read-only
on releases. The job now asks for `releases: write`, which is correct under
either default. An upload that is refused now fails the job — without `-f`,
curl treats a 403 body as a successful transfer, so the release would end up
with some of its files, or none, and a green tick either way.

`workflow_dispatch` is offered but the upload assumed a tag. Fired from a
branch it would have created a release named "main".

README's status paragraph still said authentication, budgets and the control
plane were missing. It now says what is actually left, including the part
worth saying out loud: the InfiniBand, NVML and NCCL paths have never run on
a machine that has any of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 00:29:15 +02:00

131 lines
5.8 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
# The built-in token every job is given carries whatever the instance's
# default mode allows, and under the restricted default that is read-only
# on releases — so the build would succeed and the upload would 403. Asking
# for the one scope this needs works under either default.
permissions:
releases: write
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
# An NVML build for nodes with NVLink, which the portable binary
# cannot serve.
#
# NVML is the only source of NVLink topology, its bindings need cgo,
# and cgo is exactly what CGO_ENABLED=0 above exists to avoid. So the
# portable binary silently falls back to taking the lowest free GPU
# indices — right on an SXM box with NVSwitch, and wrong on a PCIe
# box where NVLink bridges pair specific cards: a tensor group
# straddling two bridges runs several times slower and nothing says
# so. Shipping only the portable build meant nobody could have that
# topology without building it themselves.
#
# Dynamically linked against the host's libc by necessity, so it is
# published beside the portable one rather than instead of it.
if command -v gcc >/dev/null; then
nvml_name="llmgw-${version}-linux-amd64-nvml"
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
-tags nvml -trimpath \
-ldflags "-s -w -X gitea.mynodes.xyz/ilker/llmgw/internal/version.Version=${version}" \
-o "dist/${nvml_name}" ./cmd/llmgw
(cd dist && sha256sum "${nvml_name}" >> checksums.txt)
else
echo "no C toolchain; skipping the nvml build" >&2
fi
# 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
# Gitea gives every job a GITEA_TOKEN, so this is not the usual
# "you forgot to add a secret" — an empty one means the job was denied
# a token, which is an instance setting rather than a repository one.
if [ -z "${TOKEN:-}" ]; then
echo "The job was given no GITEA_TOKEN, so nothing can be uploaded."
echo "Check Settings -> Actions -> General; the binaries are in dist/."
exit 1
fi
# workflow_dispatch can be fired from a branch, where GITHUB_REF_NAME
# is the branch name. Uploading then would create a release called
# "main". The binaries are still built and kept as a check that the
# release build works; only the publishing is a tag's business.
if [ "${GITHUB_REF_TYPE:-}" != "tag" ]; then
echo "not a tag (ref=${GITHUB_REF_NAME}); built, not published"
exit 0
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 -f -X POST -H "Authorization: token $TOKEN" \
-F "attachment=@$f" \
"$api/releases/$id/assets?name=$(basename "$f")" >/dev/null \
|| { echo "upload of $(basename "$f") was refused" >&2; exit 1; }
done
echo "attached $(ls dist | wc -l) files to $tag"