- make deb (tools/deb.sh) builds tidewall_<version>-1_amd64.deb with dpkg-deb: launchers in /usr/games, the game in /usr/lib/tidewall, a validated desktop entry, hicolor icons, man pages, a DEP-5 copyright, the engine's licences and md5sums. No maintainer scripts. Depends on libc6 (>= 2.28), from the binary's GLIBC symbol versions. - make deb-check (tools/deb_check.sh) checks it in a throwaway debian:13 container: apt install with no recommends, desktop-file-validate, icons, man pages and licences, tidewall on a user's PATH, the server and the game headless as a user, lintian, and a purge that leaves nothing behind. - The tarball gains a tidewall launcher (any directory, through a symlink), install-desktop-entry.sh (per-user menu entry, --remove), tidewall.png and ENGINE-LICENSES.txt (Godot's MIT text and bundled notices, which R1 lacked). make dist-check covers the launcher and the menu entry. - Application icon: a hand-written SVG in palette colours, rendered to 16-512 px by make app-icon, and set as the window icon. test_app_icon checks the renders, the colours and the setting. - Fix: looping ambience played into the Dummy audio driver could be reported as resources in use at exit. Directors play nothing without real audio output (SoundBank.has_output()) and stop their voices on exit. Tests: make check (648), make dist-check, make deb-check all pass. Closes #61 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
124 lines
6.5 KiB
Bash
Executable File
124 lines
6.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# R1: builds the release package with tools/dist.sh, unpacks it outside the repository
|
|
# and checks that it works there with nothing from the checkout:
|
|
# - its checksum, and that it holds exactly the files it should;
|
|
# - tools/smoke.sh against its server (SMOKE_DIST);
|
|
# - a whole bot-only match, lobby to results, on its server;
|
|
# - its game, headless with the autoplay script, joining its server over loopback UDP
|
|
# and playing (as tools/client_check.sh does from the repo);
|
|
# - the version and commit in the logs match its VERSION file.
|
|
#
|
|
# tools/dist_check.sh about 3 minutes
|
|
set -uo pipefail
|
|
|
|
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$repo"
|
|
status=0
|
|
fail() {
|
|
echo "dist-check FAIL: $*"
|
|
status=1
|
|
}
|
|
|
|
tools/dist.sh >/dev/null || { echo "dist-check FAIL: tools/dist.sh failed"; tools/dist.sh 2>&1 | tail -n 10; exit 1; }
|
|
archive="$(ls -t build/dist/tidewall-*-linux-x86_64.tar.gz | head -n 1)"
|
|
name="$(basename "$archive" .tar.gz)"
|
|
|
|
work="$(mktemp -d)"
|
|
cleanup() {
|
|
[[ -n "${server_pid:-}" ]] && kill -TERM "$server_pid" 2>/dev/null
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
(cd "$(dirname "$archive")" && sha256sum --check --quiet "$name.tar.gz.sha256") || fail "the checksum doesn't match"
|
|
tar -xzf "$archive" -C "$work"
|
|
package="$work/$name"
|
|
# Nothing the package runs may reach back into the checkout, and nothing it writes may
|
|
# land in the user's home.
|
|
export HOME="$work/home" XDG_DATA_HOME="$work/home/data" XDG_CONFIG_HOME="$work/home/config" XDG_CACHE_HOME="$work/home/cache" XDG_STATE_HOME="$work/home/state"
|
|
mkdir -p "$HOME"
|
|
|
|
expected="ENGINE-LICENSES.txt LICENSE LICENSE-ASSETS PROVENANCE.md README.md VERSION install-desktop-entry.sh server.cfg tidewall tidewall-server tidewall.pck tidewall.png tidewall.x86_64"
|
|
actual="$(cd "$package" && ls -A | LC_ALL=C sort | tr '\n' ' ' | sed 's/ $//')"
|
|
[[ "$actual" == "$expected" ]] || fail "the package holds '$actual', expected '$expected'"
|
|
version="$(sed -n 's/^Tidewall //p' "$package/VERSION")"
|
|
commit="$(sed -n 's/^commit //p' "$package/VERSION")"
|
|
[[ -n "$version" && -n "$commit" ]] || fail "VERSION doesn't name a version and commit"
|
|
|
|
echo "dist-check: smoke against $name" >&2
|
|
(cd "$work" && SMOKE_DIST="$package" "$repo/tools/smoke.sh") | sed 's/^/ /' || fail "smoke failed against the package"
|
|
|
|
echo "dist-check: a whole bot match on the package's server" >&2
|
|
match_log="$work/match.log"
|
|
(cd "$work" && timeout --signal=KILL 600 nice -n 15 "$package/tidewall-server" --seed=2 --bots=24 --matches=1 --unthrottled >"$match_log" 2>&1)
|
|
code=$?
|
|
[[ "$code" -eq 0 ]] || fail "the bot match exited $code"
|
|
grep -q '"event":"results"' "$match_log" || fail "the bot match never reached its results"
|
|
grep -q '"errors":0,"event":"stop"' "$match_log" || fail "the bot match logged errors"
|
|
start="$(grep -m1 '"event":"start"' "$match_log")"
|
|
grep -q "\"version\":\"$version\"" <<<"$start" || fail "the server log doesn't give version $version"
|
|
grep -q "\"commit\":\"$commit\"" <<<"$start" || fail "the server log doesn't give commit $commit"
|
|
echo " bot match: results reached, version $version, commit $commit"
|
|
|
|
echo "dist-check: the package's game joins its server" >&2
|
|
port=$((20000 + RANDOM % 20000))
|
|
server_log="$work/server.log"
|
|
cd "$work"
|
|
TIDEWALL_STATE="$work/server-state" nice -n 15 "$package/tidewall-server" --listen --port="$port" --seed=2 --bots=1 --matches=1 >"$server_log" 2>&1 &
|
|
server_pid=$!
|
|
cd "$repo"
|
|
for _ in $(seq 1 100); do
|
|
grep -q '"event":"start"' "$server_log" 2>/dev/null && break
|
|
sleep 0.1
|
|
done
|
|
client_log="$work/client.log"
|
|
(cd "$work" && timeout --signal=KILL 120 nice -n 15 "$package/tidewall.x86_64" --headless -- --connect="127.0.0.1:$port" --name=Mara --autoplay --client-seconds=55 >"$client_log" 2>&1)
|
|
client_code=$?
|
|
kill -TERM "$server_pid" 2>/dev/null
|
|
wait "$server_pid"
|
|
server_code=$?
|
|
server_pid=""
|
|
report="$(grep -m1 '"event":"client"' "$client_log" || true)"
|
|
[[ "$client_code" -eq 0 ]] || fail "the game exited with $client_code"
|
|
[[ "$server_code" -eq 0 ]] || fail "the server exited with $server_code"
|
|
[[ -n "$report" ]] || fail "the game said nothing"
|
|
grep -q '"joined":true' <<<"$report" || fail "the game never joined"
|
|
grep -q '"phases":\["lobby","countdown","drop"' <<<"$report" || fail "the game didn't follow the match from the lobby into the drop"
|
|
grep -q '"bad_packets":0' <<<"$report" || fail "the game was sent packets it couldn't read"
|
|
playing="$(sed -n 's/.*"frames_playing":\([0-9]*\).*/\1/p' <<<"$report")"
|
|
[[ "${playing:-0}" -ge 300 ]] || fail "the game's player was in the match for only ${playing:-0} frames"
|
|
grep -q '"event":"player_joined".*"name":"Mara"' "$server_log" || fail "the server never saw the game join"
|
|
grep -q '"errors":0,"event":"stop"' "$server_log" || fail "the server logged errors"
|
|
echo " game: joined, in the match for ${playing:-0} frames"
|
|
|
|
echo "dist-check: the launcher from another directory, and the menu entry" >&2
|
|
mkdir -p "$work/elsewhere"
|
|
ln -s "$package/tidewall" "$work/elsewhere/tidewall-link"
|
|
launch_log="$work/launch.log"
|
|
(cd / && timeout --signal=KILL 120 nice -n 15 "$work/elsewhere/tidewall-link" --headless -- --offline --autoplay --client-seconds=8 >"$launch_log" 2>&1)
|
|
launch_code=$?
|
|
[[ "$launch_code" -eq 0 ]] || fail "the launcher, through a symlink from /, exited $launch_code"
|
|
grep -q '"event":"client"' "$launch_log" || fail "the launcher's game said nothing"
|
|
if grep -qE '^(ERROR|SCRIPT ERROR|WARNING: .*leaked)' "$launch_log"; then
|
|
grep -m3 -E '^(ERROR|SCRIPT ERROR|WARNING)' "$launch_log" | sed 's/^/ /'
|
|
fail "the launcher's game logged errors"
|
|
fi
|
|
menu="$work/menu"
|
|
XDG_DATA_HOME="$menu" "$package/install-desktop-entry.sh" >/dev/null || fail "install-desktop-entry.sh failed"
|
|
entry="$menu/applications/tidewall.desktop"
|
|
[[ -s "$entry" && -s "$menu/icons/hicolor/256x256/apps/tidewall.png" ]] || fail "no menu entry or icon after install-desktop-entry.sh"
|
|
grep -qx "Exec=\"$package/tidewall\"" "$entry" || fail "the menu entry doesn't run this folder's launcher"
|
|
if command -v desktop-file-validate >/dev/null; then
|
|
desktop-file-validate "$entry" || fail "the menu entry doesn't validate"
|
|
fi
|
|
XDG_DATA_HOME="$menu" "$package/install-desktop-entry.sh" --remove >/dev/null
|
|
[[ ! -e "$entry" ]] || fail "--remove left the menu entry"
|
|
echo " launcher: played offline through a symlink from /; menu entry added, validated and removed"
|
|
if [[ -n "$(ls -A "$HOME/data" 2>/dev/null | grep -v '^godot$')" ]]; then
|
|
fail "the package wrote outside the engine's user data: $(ls -A "$HOME/data")"
|
|
fi
|
|
|
|
if [[ "$status" -eq 0 ]]; then
|
|
echo "dist-check: ok ($name works outside the repository: smoke, a bot match, and its game playing on its server)"
|
|
fi
|
|
exit "$status"
|