11name : Determinism x86 (cross-platform sync)
22
3- # Builds spring- headless for amd64-linux from this exact engine commit,
3+ # Builds the headless engine for amd64-linux from this exact engine commit,
44# runs a fixed-seed AI-vs-AI game, and records the engine's whole-game
55# sync checksum every frame. The resulting CHKREC stream is the x86_64
66# reference for cross-platform determinism: it must match the arm64
@@ -41,22 +41,37 @@ jobs:
4141 ref : macos-port
4242 path : game-data
4343
44- - name : Build spring-headless (amd64-linux) in upstream container
44+ - name : Cache ccache (amd64-linux container build)
45+ uses : actions/cache@v5
46+ with :
47+ path : src/.cache/ccache-amd64-linux
48+ key : det-ccache-amd64-linux-${{ github.sha }}
49+ restore-keys : |
50+ det-ccache-amd64-linux-
51+
52+ - name : Build headless engine (amd64-linux) in upstream container
4553 working-directory : src
4654 run : |
4755 set -euo pipefail
4856 # build.sh blocks unless submodules are acknowledged.
4957 touch .i-understand-git-submodules.txt
5058 chmod +x docker-build-v2/build.sh
51- # build.sh runs `docker run -it`; the -t needs a TTY which CI has
52- # not got ("the input device is not a TTY") . Wrap each call in
53- # `script`, which allocates a pseudo-terminal, rather than patch
54- # the upstream tooling .
59+ # build.sh runs `docker run -it`; the -t needs a TTY that CI has
60+ # not got. Wrap each call in script(1) for a pseudo-terminal
61+ # rather than patch the upstream tooling. PLATFORM = amd64-linux,
62+ # so outputs land in build-amd64-linux/ .
5563 script -q -e -c "./docker-build-v2/build.sh --configure linux -DCMAKE_BUILD_TYPE=RELWITHDEBINFO -DAI_TYPES=NONE" /dev/null
5664 script -q -e -c "./docker-build-v2/build.sh --compile linux" /dev/null
57- echo "--- build outputs ---"
58- ls -la build-linux/ | head
59- file build-linux/spring-headless || (echo "::error::spring-headless not built" && exit 1)
65+ echo "--- locate headless binary ---"
66+ HEADLESS_BIN="$(find build-amd64-linux -maxdepth 3 -type f \( -name 'spring-headless' -o -name 'engine-headless' \) | head -1)"
67+ if [ -z "$HEADLESS_BIN" ]; then
68+ echo "::error::no headless binary found under build-amd64-linux"
69+ find build-amd64-linux -maxdepth 2 -type f -name 'spring*' -o -name 'engine*' 2>/dev/null | head -20
70+ exit 1
71+ fi
72+ echo "HEADLESS_BIN=$HEADLESS_BIN"
73+ file "$HEADLESS_BIN"
74+ echo "HEADLESS_BIN=$HEADLESS_BIN" >> "$GITHUB_ENV"
6075
6176 - name : Assemble data directory
6277 working-directory : src
@@ -78,11 +93,11 @@ jobs:
7893 # Determinism recorder gadget (unsynced, headless-compatible).
7994 cp -f .github/determinism/det_chkrec.lua "$GAME_SDD/luarules/gadgets/det_chkrec.lua"
8095
81- # Base content built by the engine.
82- cp -f build-linux/base/ springcontent.sdz "$DATA/games/" 2>/dev/null || cp -f build-linux/base/spring/springcontent .sdz "$DATA/games/"
83- cp -f build-linux/base/spring/bitmaps.sdz "$DATA/games/" 2>/dev/null || true
84- cp -f build-linux/base/maphelper.sdz "$DATA/games/" 2>/dev/null || true
85- cp -f build-linux/base/cursors.sdz "$DATA/games/" 2>/dev/null || true
96+ # Base content built by the engine (search the build tree) .
97+ for sdz in springcontent.sdz bitmaps.sdz maphelper.sdz cursors .sdz; do
98+ f="$(find build-amd64- linux -name "$sdz" -type f | head -1)"
99+ if [ -n "$f" ]; then cp -f "$f" "$ DATA/games/"; echo "base: $sdz"; else echo "::warning::missing base $sdz"; fi
100+ done
86101 ls -la "$DATA/games/"
87102
88103 # Red Comet map (same file the arm64 run used).
@@ -100,22 +115,20 @@ jobs:
100115 set -euo pipefail
101116 source docker-build-v2/images_versions.sh
102117 IMAGE="ghcr.io/beyond-all-reason/recoil-build-amd64-linux@${image_version[amd64-linux]}"
103- docker run --rm \
104- -v "$PWD:/src" -v "$DATA:/data" \
118+ # Run the freshly built headless binary inside the build image
119+ # (which has all runtime libs). Mount the repo and the data dir.
120+ docker run --rm --platform=linux/amd64 \
121+ -v "$PWD:/src:ro" -v "$DATA:/data:rw" \
105122 -w /src "$IMAGE" \
106- bash -c '
107- set -e
108- cd /src
109- timeout 600 ./build-linux/spring-headless --isolation-dir /data /data/det_script.txt 2>&1 | tee /data/run.log | grep -aE "CHKREC|synctest|content_error|Error: Sync|could not" || true
110- '
123+ bash -c "set -e; timeout 600 /src/$HEADLESS_BIN --isolation-dir /data /data/det_script.txt 2>&1 | tee /data/run.log | grep -aE 'CHKREC|content_error|Error: Sync|could not|Sync error' || true"
111124 echo "--- extract checksum stream ---"
112125 grep -aoE 'CHKREC [0-9]+ [A-Za-z0-9]+' "$DATA/run.log" > "$RUNNER_TEMP/checksums_amd64_linux.txt" || true
113126 LINES=$(wc -l < "$RUNNER_TEMP/checksums_amd64_linux.txt" || echo 0)
114127 echo "recorded $LINES checksum lines"
115128 head -5 "$RUNNER_TEMP/checksums_amd64_linux.txt" || true
116129 if [ "$LINES" -lt 100 ]; then
117- echo "::error::expected >=300 checksum lines, got $LINES — see run.log"
118- tail -40 "$DATA/run.log" || true
130+ echo "::error::expected >=300 checksum lines, got $LINES — see run.log tail "
131+ tail -60 "$DATA/run.log" || true
119132 exit 1
120133 fi
121134
0 commit comments