3 Commits

Author SHA1 Message Date
Hermes Agent 3c305ac5b4 fix: install python3 before publish step in gdu workflow
gdu static musl build / build-and-release (push) Successful in 39s
2026-05-07 23:34:46 +00:00
Hermes Agent 37968e48fc feat: add gdu static musl build + generalize publish_release.py
gdu static musl build / build-and-release (push) Failing after 39s
iperf3 static musl build / build-and-release (push) Successful in 20s
2026-05-07 23:31:59 +00:00
Hermes Agent 8cbc66227f docs: note runner labels must be set in config.yaml 2026-05-07 23:17:26 +00:00
6 changed files with 144 additions and 4 deletions
+70
View File
@@ -0,0 +1,70 @@
name: gdu static musl build
on:
push:
branches:
- main
paths:
- .gitea/workflows/gdu.yml
- scripts/build_gdu.sh
- versions/gdu.version
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: alpine-latest
steps:
- name: Bootstrap workspace
shell: sh
env:
REPO_URL: ${{ gitea.server_url }}
REPO_NAME: ${{ gitea.repository }}
GIT_SHA: ${{ gitea.sha }}
run: |
apk add --no-cache git
workdir="$(pwd)"
tmpdir="$(mktemp -d)"
git clone --depth 1 "$REPO_URL/$REPO_NAME.git" "$tmpdir/repo"
git -C "$tmpdir/repo" fetch --depth 1 origin "$GIT_SHA"
git -C "$tmpdir/repo" checkout "$GIT_SHA"
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
cp -a "$tmpdir/repo"/. "$workdir"/
- name: Read version
id: meta
shell: sh
working-directory: ${{ gitea.workspace }}
run: |
version="$(tr -d ' \n\r' < versions/gdu.version)"
artifact="gdu-${version}-linux-amd64-musl-static"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "artifact=${artifact}" >> "$GITHUB_OUTPUT"
- name: Build static gdu
shell: sh
working-directory: ${{ gitea.workspace }}
run: |
chmod +x scripts/build_gdu.sh
./scripts/build_gdu.sh "${{ steps.meta.outputs.version }}" "$PWD/dist"
- name: Publish release assets
shell: sh
env:
GITEA_TOKEN: ${{ gitea.token }}
GITEA_API_URL: ${{ gitea.api_url }}
REPO_OWNER: ${{ gitea.repository_owner }}
REPO_NAME: static-musl-builds
TOOL: gdu
VERSION: ${{ steps.meta.outputs.version }}
TARGET_SHA: ${{ gitea.sha }}
working-directory: ${{ gitea.workspace }}
run: |
apk add --no-cache python3
python3 scripts/publish_release.py \
"dist/${{ steps.meta.outputs.artifact }}" \
"dist/${{ steps.meta.outputs.artifact }}.tar.gz" \
"dist/${{ steps.meta.outputs.artifact }}.sha256"
+1
View File
@@ -59,6 +59,7 @@ jobs:
GITEA_API_URL: ${{ gitea.api_url }} GITEA_API_URL: ${{ gitea.api_url }}
REPO_OWNER: ${{ gitea.repository_owner }} REPO_OWNER: ${{ gitea.repository_owner }}
REPO_NAME: static-musl-builds REPO_NAME: static-musl-builds
TOOL: iperf3
VERSION: ${{ steps.meta.outputs.version }} VERSION: ${{ steps.meta.outputs.version }}
TARGET_SHA: ${{ gitea.sha }} TARGET_SHA: ${{ gitea.sha }}
working-directory: ${{ gitea.workspace }} working-directory: ${{ gitea.workspace }}
+11 -1
View File
@@ -72,7 +72,6 @@ services:
GITEA_INSTANCE_URL: "https://g.o4kosebezablokiruyte.ru" GITEA_INSTANCE_URL: "https://g.o4kosebezablokiruyte.ru"
GITEA_RUNNER_REGISTRATION_TOKEN: "PUT_TOKEN_HERE" GITEA_RUNNER_REGISTRATION_TOKEN: "PUT_TOKEN_HERE"
GITEA_RUNNER_NAME: "nl-dedicated-static-builder" GITEA_RUNNER_NAME: "nl-dedicated-static-builder"
GITEA_RUNNER_LABELS: "alpine-latest:docker://node:20-alpine,ubuntu-latest:docker://node:20-bookworm"
volumes: volumes:
- ./config.yaml:/config.yaml - ./config.yaml:/config.yaml
- ./data:/data - ./data:/data
@@ -87,6 +86,17 @@ docker run --rm --entrypoint="" docker.io/gitea/act_runner:0.2.11 \
mkdir -p data mkdir -p data
``` ```
Then edit `config.yaml` and replace the default `runner.labels` block with:
```yaml
runner:
labels:
- "alpine-latest:docker://node:20-alpine"
- "ubuntu-latest:docker://node:20-bookworm"
```
This matters because when `config.yaml` already contains `runner.labels`, the container startup env `GITEA_RUNNER_LABELS` is ignored.
Then start it: Then start it:
```bash ```bash
+57
View File
@@ -0,0 +1,57 @@
#!/bin/sh
set -eu
VERSION="${1:?usage: build_gdu.sh <version> [output_dir]}"
OUTPUT_DIR="${2:-$PWD/dist}"
PREFIX_NAME="gdu-${VERSION}-linux-amd64-musl-static"
# strip leading 'v' if passed
VERSION="${VERSION#v}"
mkdir -p "$OUTPUT_DIR"
apk add --no-cache \
curl \
file \
go \
git \
tar \
xz
# gdu uses Go modules, pull source from GitHub
SRCDIR="${TMPDIR:-/tmp}/gdu-src-${VERSION}"
rm -rf "$SRCDIR"
mkdir -p "$SRCDIR"
curl -fsSL "https://github.com/dundee/gdu/archive/refs/tags/v${VERSION}.tar.gz" \
| tar -xz -C "$SRCDIR" --strip-components=1
cd "$SRCDIR"
# Build fully static with musl toolchain
# CGO_ENABLED=0 forces pure-Go, which means no C deps at all
# ldflags: strip debug + disable dynamic linking
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux \
go build \
-trimpath \
-ldflags="-s -w -extldflags=-static" \
-o "$OUTPUT_DIR/$PREFIX_NAME" \
./cmd/gdu
strip "$OUTPUT_DIR/$PREFIX_NAME" 2>/dev/null || true
(
cd "$OUTPUT_DIR"
tar -czf "${PREFIX_NAME}.tar.gz" "$PREFIX_NAME"
sha256sum "$PREFIX_NAME" "${PREFIX_NAME}.tar.gz" > "${PREFIX_NAME}.sha256"
)
file "$OUTPUT_DIR/$PREFIX_NAME"
ldd "$OUTPUT_DIR/$PREFIX_NAME" || true
if file "$OUTPUT_DIR/$PREFIX_NAME" | grep -qi 'dynamically linked'; then
echo "error: output binary is still dynamically linked" >&2
exit 1
fi
echo "build OK: $OUTPUT_DIR/$PREFIX_NAME"
+4 -3
View File
@@ -93,10 +93,11 @@ def main() -> int:
if missing: if missing:
raise SystemExit(f"missing files: {', '.join(missing)}") raise SystemExit(f"missing files: {', '.join(missing)}")
tag = f"iperf3-v{version}" tool = os.environ.get("TOOL", "iperf3")
title = f"iperf3 {version}" tag = f"{tool}-v{version}"
title = f"{tool} {version}"
body = ( body = (
f"Static musl build for iperf3 {version}.\\n\\n" f"Static musl build for {tool} {version}.\\n\\n"
f"Repository: {owner}/{repo}\\n" f"Repository: {owner}/{repo}\\n"
f"Commit: {target}" f"Commit: {target}"
) )
+1
View File
@@ -0,0 +1 @@
5.36.1