R1: Linux export pipeline (make dist, make dist-check)
make dist (tools/dist.sh) checks the official export templates against tools/engine.sha512, installs only the Linux x86_64 ones into the repo-local engine data, exports the "Linux" preset, checks the binary is the verified release template, and packs build/dist/tidewall-<version>-linux-x86_64.tar.gz with a .sha256: tidewall.x86_64, tidewall.pck, a tidewall-server launcher that runs the same game headless with clean SIGTERM handling, an example server.cfg, README, VERSION, licences and asset provenance. BuildInfo gives the version (application/config/version, now 0.9.0) and the commit (build_commit.txt written by make dist, or .git in a checkout). The main menu shows "Version 0.9.0 (commit)" and the server's start log line carries version and commit. make dist-check (tools/dist_check.sh) unpacks the package outside the repo with HOME and XDG dirs in a temp dir and runs smoke against it (new SMOKE_DIST mode), a whole bot match, and the exported game joining the exported server over loopback. A release template crashes on a call on null (exit 139) and ignores invalid calls, so in package mode smoke's fault check expects only a non-zero exit. Closes #60 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
## R1: which build this is. The version is project.godot's application/config/version.
|
||||
## The commit is the one `make dist` wrote into build_commit.txt when it exported the
|
||||
## game. Run from the repository, it is read from .git instead, and "unknown" if
|
||||
## neither can be found.
|
||||
class_name BuildInfo
|
||||
extends RefCounted
|
||||
|
||||
const COMMIT_FILE: String = "res://build_commit.txt"
|
||||
|
||||
static var _commit: String = ""
|
||||
|
||||
|
||||
static func version() -> String:
|
||||
return String(ProjectSettings.get_setting("application/config/version", "0.0.0"))
|
||||
|
||||
|
||||
static func commit() -> String:
|
||||
if _commit.is_empty():
|
||||
_commit = _read_commit()
|
||||
return _commit
|
||||
|
||||
|
||||
## "0.9.0 (1a2b3c4d5e6f)", for the main menu and logs.
|
||||
static func describe() -> String:
|
||||
return "%s (%s)" % [version(), commit()]
|
||||
|
||||
|
||||
static func _read_commit() -> String:
|
||||
if FileAccess.file_exists(COMMIT_FILE):
|
||||
var written: String = FileAccess.get_file_as_string(COMMIT_FILE).strip_edges()
|
||||
if is_valid_commit(written):
|
||||
return written
|
||||
var from_git: String = _git_head(ProjectSettings.globalize_path("res://").path_join(".git"))
|
||||
return from_git if not from_git.is_empty() else "unknown"
|
||||
|
||||
|
||||
## A short or full hex commit name, optionally marked "-dirty".
|
||||
static func is_valid_commit(text: String) -> bool:
|
||||
var name: String = text.trim_suffix("-dirty")
|
||||
if name.length() < 7 or name.length() > 40:
|
||||
return false
|
||||
for character: String in name:
|
||||
if not "0123456789abcdef".contains(character):
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
## The commit HEAD names in a .git directory, shortened to 12 characters, or "".
|
||||
static func _git_head(git_dir: String) -> String:
|
||||
var head_path: String = git_dir.path_join("HEAD")
|
||||
if not FileAccess.file_exists(head_path):
|
||||
return ""
|
||||
var head: String = FileAccess.get_file_as_string(head_path).strip_edges()
|
||||
var full: String = head
|
||||
if head.begins_with("ref: "):
|
||||
var ref: String = head.trim_prefix("ref: ")
|
||||
var loose: String = git_dir.path_join(ref)
|
||||
full = ""
|
||||
if FileAccess.file_exists(loose):
|
||||
full = FileAccess.get_file_as_string(loose).strip_edges()
|
||||
elif FileAccess.file_exists(git_dir.path_join("packed-refs")):
|
||||
for line: String in FileAccess.get_file_as_string(git_dir.path_join("packed-refs")).split("\n", false):
|
||||
if line.ends_with(" " + ref):
|
||||
full = line.get_slice(" ", 0)
|
||||
return full.substr(0, 12) if is_valid_commit(full) else ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://brutau3owyp2q
|
||||
@@ -79,6 +79,8 @@ func _ready() -> void:
|
||||
_finish(2)
|
||||
return
|
||||
var started: Dictionary = config.to_dictionary()
|
||||
started["version"] = BuildInfo.version()
|
||||
started["commit"] = BuildInfo.commit()
|
||||
started["engine"] = Engine.get_version_info()["string"]
|
||||
started["tick_rate_hz"] = Tuning.TICK_RATE_HZ
|
||||
started["world_hash"] = loop.sim.island.heightmap_hash()
|
||||
|
||||
@@ -328,6 +328,13 @@ func _build_main() -> void:
|
||||
_button(column, "Join a server", func() -> void: show_screen("join"))
|
||||
_button(column, "Settings", func() -> void: show_screen("settings"))
|
||||
_button(column, "Quit", func() -> void: quit_requested.emit())
|
||||
var build: Label = Label.new()
|
||||
build.name = "Build"
|
||||
build.text = "Version " + BuildInfo.describe()
|
||||
build.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
build.add_theme_font_size_override("font_size", FONT_SMALL)
|
||||
build.modulate.a = 0.7
|
||||
column.add_child(build)
|
||||
|
||||
|
||||
func _build_practice() -> void:
|
||||
|
||||
Reference in New Issue
Block a user