Files
Skald-Circle/.gitea/workflows/nightly.yml
T
dguiducci bb5226a9a9
Nightly Build / build (push) Successful in 7m47s
fix: keep the server running after you log out
A `systemctl --user` unit runs under the per-user manager, which systemd
starts at first login and stops when the user's last session ends — so
closing the SSH session that started Skald killed it, and it never came
up at boot. No crash and nothing in the journal: the whole cgroup is
simply torn down. Both installers now enable lingering after installing
the unit, and update.sh carries the same helper so an installation
predating this fix is healed by an ordinary update. A failure to enable
it only ever warns, with the manual command — it must not abort an
install.

Two things found on the way there:

update.sh matched `case "$OS" in Linux) ... Darwin)`, but $OS had already
been normalized to lowercase at the top of the file, so stop_service and
start_service were both silent no-ops. None of the ordering the file
documents at its head was executing: the tarball went over the running
binary (ETXTBSY, aborting the update mid-way) and the safety-net restart
in cleanup() was a no-op too, leaving the box down.

Neither workflow published install.sh / install-nightly.sh to the web
root, so the scripts served by builds.skaldagent.net were hand-copied and
drifting from the repo — an installer fix would reach every existing box
through update.sh but never a new one. Nightly publishes the nightly
installer, release publishes the release one, both with the same atomic
temp-and-rename the tarballs use.

Also on the unit: dropped `After=docker.service`, which a user manager
silently ignores rather than honouring advisorily, and moved
`Restart=on-failure` to `always` — run.sh exits 0 on any graceful
shutdown, including one nobody asked for, which on-failure reads as a
clean stop. That is also what absorbs the boot race against Docker now
that lingering makes us start at boot.
2026-08-06 11:00:13 +01:00

82 lines
3.0 KiB
YAML

name: Nightly Build
on:
push:
branches:
- main
jobs:
build:
runs-on: linux-amd64
env:
CARGO_TARGET_DIR: /home/dguiducci/.cache/skald-ci/target
steps:
- uses: actions/checkout@v4
- name: Build native (linux/amd64)
run: |
RUSTFLAGS="-A warnings" cargo build --release --no-default-features
RUSTFLAGS="-A warnings" cargo build --release --no-default-features -p skald-setup
- name: Cross-compile (linux/arm64)
env:
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
RUSTFLAGS="-A warnings" cargo build --release --no-default-features --target aarch64-unknown-linux-gnu
RUSTFLAGS="-A warnings" cargo build --release --no-default-features -p skald-setup --target aarch64-unknown-linux-gnu
- name: Package amd64
run: |
cd "${GITHUB_WORKSPACE:-.}"
./ci/package.sh \
--version nightly \
--os linux \
--arch amd64 \
--target-dir /home/dguiducci/.cache/skald-ci/target/release \
--output dist/
- name: Package arm64
run: |
cd "${GITHUB_WORKSPACE:-.}"
./ci/package.sh \
--version nightly \
--os linux \
--arch arm64 \
--target-dir /home/dguiducci/.cache/skald-ci/target/aarch64-unknown-linux-gnu/release \
--output dist/
- name: Deploy to builds.skaldagent.net
run: |
cd "${GITHUB_WORKSPACE:-.}"
DEST=/var/www/builds.skaldagent.net/nightly
mkdir -p "$DEST"
# Nightly reuses a fixed filename, so publish atomically: copy to a
# temp name on the same filesystem, then rename over the target. A
# concurrent download never sees a half-written tarball.
for f in dist/*.tar.gz; do
name="$(basename "$f")"
cp "$f" "$DEST/.$name.tmp"
mv -f "$DEST/.$name.tmp" "$DEST/$name"
done
echo "[nightly] Deployed:"
ls -lh "$DEST/"
- name: Publish the nightly installer
run: |
cd "${GITHUB_WORKSPACE:-.}"
# install-nightly.sh is served straight from the web root
# (curl -fsSL https://builds.skaldagent.net/install-nightly.sh | bash),
# so without this it stays whatever was copied there by hand and drifts
# from the repo — a fix to the installer would reach every existing box
# through update.sh but never a new one. Same atomic publish as the
# tarballs: a client mid-download never sees a half-written script.
ROOT=/var/www/builds.skaldagent.net
cp install-nightly.sh "$ROOT/.install-nightly.sh.tmp"
chmod 644 "$ROOT/.install-nightly.sh.tmp"
mv -f "$ROOT/.install-nightly.sh.tmp" "$ROOT/install-nightly.sh"
echo "[nightly] Published install-nightly.sh"