Files
gbr-games/scripts/boot-test.sh
T
gregandClaude Opus 5.5 6baf4796fa
Validate game templates / validate (push) Successful in 21s
Validate game templates / boot-test (push) Skipped
Validate game templates / publish (push) Skipped
feat(boot-test): CI boot tests use the Steam download cache, updated once a day
CI deployed every Steam game from scratch on each run, downloading the whole
game from Steam each time. scripts/boot-test.sh now runs the new
`gbrgames boot-test ID`, the builder's own deploy path: the same payload and
node-agent BootTest, but Steam games start from the cache volume
(gbr-steamcache-<app>, kept by RUNNER.md's prune).

The cache is updated at most once a day (a timestamp in the cache volume, not
copied into servers), so a repeat run within a day doesn't ask Steam for an
update at all; the node-agent's own install still checks the files and fetches
anything newer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 19:12:20 -04:00

50 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Boot-tests the given games with the node-agent's real deploy code, one after another.
# Each game is deployed on this machine's Docker daemon inside the isolated gbr-boottest network and
# must reach its readyPattern (or stay up) before its timeout. Games needing a secret CI doesn't
# have are skipped. Exits non-zero if any game failed.
# boot-test.sh palworld minecraft-crossplay
set -uo pipefail
AGENT_IMAGE="${AGENT_IMAGE:-www.gitea.gbreed.com/gbreed-public/gbr-node-agent:latest}"
NETWORK=gbr-boottest
if ! docker network inspect "$NETWORK" > /dev/null 2>&1; then
# Created by the runner setup with LAN access blocked; never fall back to an unisolated network
echo "::error::Docker network $NETWORK is missing on this runner; see RUNNER.md"
exit 1
fi
docker pull -q "$AGENT_IMAGE" > /dev/null
# Built once: "go run" would turn the skip exit code (3) into a plain failure
gbrgames="${RUNNER_TEMP:-/tmp}/gbrgames"
go build -o "$gbrgames" ./cmd/gbrgames || exit 1
passed=() failed=() skipped=()
for id in "$@"; do
echo "::group::boot test: $id"
# Seconds instead of a full boot: catches templates that can't work with their image (wrong
# container user, startup command reading a variable under the wrong name)
if ! "$gbrgames" inspect-image -game "$id"; then
failed+=("$id")
echo "::endgroup::"
continue
fi
# The node-agent's BootTest with the game's real payload. Steam games start from the runner's download
# cache (volumes gbr-steamcache-<app>, kept by RUNNER.md's prune), so Steam isn't asked for the whole
# game on every run
AGENT_IMAGE="$AGENT_IMAGE" "$gbrgames" boot-test "$id"
code=$?
if [ $code -eq 3 ]; then skipped+=("$id")
elif [ $code -eq 0 ]; then passed+=("$id")
else failed+=("$id"); fi
echo "::endgroup::"
done
echo "passed: ${passed[*]:-none}"
echo "skipped: ${skipped[*]:-none} (missing secrets)"
echo "failed: ${failed[*]:-none}"
# For the workflow: the weekly run queues a repair for each failed game
[ -n "${GITHUB_OUTPUT:-}" ] && echo "failed=${failed[*]}" >> "$GITHUB_OUTPUT"
[ ${#failed[@]} -eq 0 ]