Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d593b61af8 | |||
| 65585c61ad | |||
| 0583a8ffae | |||
| 4d9d710a02 | |||
| 3fbee9ce30 | |||
| fd98f46267 |
@@ -2,6 +2,19 @@
|
||||
# locally, run on every master push and pull request. Until this workflow
|
||||
# existed, nothing in CI ran the test suite at all — a direct push to
|
||||
# master was entirely unguarded.
|
||||
#
|
||||
# Build caching (2026-07-13): the Gitea actions cache never restored on
|
||||
# this instance — every run back through run 597 logged "No cache found"
|
||||
# even for exact keys saved successfully ("Cache saved successfully") by
|
||||
# a run an hour earlier, including master→master restores. Until the
|
||||
# cache server on the runner host is fixed, Swatinem/rust-cache is pure
|
||||
# overhead here. `rust-host` is a HOST executor (its filesystem persists
|
||||
# between runs — ~/.cargo and the rustup toolchain already carry over),
|
||||
# so we get warm builds by pointing CARGO_TARGET_DIR at a persistent
|
||||
# path on the runner instead of tarring gigabytes through a cache API
|
||||
# that never returns them. Concurrent runs are safe: cargo serialises
|
||||
# on the target-dir lock.
|
||||
|
||||
name: Test
|
||||
|
||||
on:
|
||||
@@ -28,8 +41,27 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# Seconds-long formatting gate in its own job so a rustfmt slip fails
|
||||
# here instead of after a 35-minute cold build (run 600 spent its
|
||||
# whole build budget to report an unformatted file).
|
||||
fmt:
|
||||
runs-on: rust-host
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust 1.95.0
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.95.0
|
||||
components: rustfmt
|
||||
|
||||
- name: Format check
|
||||
run: cargo fmt --check
|
||||
|
||||
test:
|
||||
runs-on: rust-host
|
||||
needs: fmt
|
||||
|
||||
# Full debuginfo made the solitaire_engine test-binary link peak past the
|
||||
# runner's memory — ld was OOM-killed (signal 9) on runs 447 and 486.
|
||||
@@ -40,10 +72,19 @@ jobs:
|
||||
# test binaries concurrently; as the workspace grew (runs 514/516/519)
|
||||
# two+ simultaneous ld processes OOM-killed the runner again even at
|
||||
# line-tables-only. Two jobs keeps at most two links in flight — the
|
||||
# compile-throughput cost is small next to the cache-warm build.
|
||||
# compile-throughput cost is small next to the warm build.
|
||||
#
|
||||
# CARGO_INCREMENTAL=0: incremental artifacts bloat the persistent
|
||||
# target dir for little benefit in CI (rust-cache used to set this
|
||||
# for the same reason).
|
||||
#
|
||||
# CARGO_TARGET_DIR: persistent on the runner host — see the header
|
||||
# comment. The prune step below keeps it from growing unbounded.
|
||||
env:
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
CARGO_BUILD_JOBS: '2'
|
||||
CARGO_INCREMENTAL: '0'
|
||||
CARGO_TARGET_DIR: /home/runner/.cache/ferrous-solitaire/target
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -53,10 +94,21 @@ jobs:
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.95.0
|
||||
components: clippy, rustfmt
|
||||
components: clippy
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: Swatinem/rust-cache@v2
|
||||
# Toolchain or lockfile bumps strand stale artifacts nothing will
|
||||
# ever reuse; reset the dir when it crosses 40 GiB rather than
|
||||
# curating it (a cold rebuild every few weeks is cheaper than the
|
||||
# bookkeeping).
|
||||
- name: Prune persistent target dir when oversized
|
||||
run: |
|
||||
limit_kb=$((40 * 1024 * 1024))
|
||||
used_kb=$(du -sk "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || echo 0)
|
||||
echo "persistent target dir: $((used_kb / 1024)) MiB (limit $((limit_kb / 1024)) MiB)"
|
||||
if [ "${used_kb:-0}" -gt "$limit_kb" ]; then
|
||||
echo "over limit — clearing for a fresh cold build"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
|
||||
# Native link deps for the Bevy crates (engine/app/web) on a bare
|
||||
# ubuntu runner: ALSA + udev for input/audio, X11 + Wayland for winit.
|
||||
@@ -67,9 +119,6 @@ jobs:
|
||||
libasound2-dev libudev-dev pkg-config libx11-dev libxcursor-dev \
|
||||
libxrandr-dev libxi-dev libwayland-dev libxkbcommon-dev
|
||||
|
||||
- name: Format check
|
||||
run: cargo fmt --check
|
||||
|
||||
# SQLX_OFFLINE uses the checked-in `.sqlx/` query cache (no live DB),
|
||||
# same as the web-e2e workflow's server prebuild.
|
||||
- name: Clippy (deny warnings)
|
||||
|
||||
@@ -206,7 +206,9 @@ async function main() {
|
||||
invariant_ok: !!snap?.invariants?.state_ok,
|
||||
history_len: Array.isArray(snap?.move_history) ? snap.move_history.length : null,
|
||||
replay_payload_present: payload !== null,
|
||||
replay_moves_len: Array.isArray(payload?.moves) ? payload.moves.length : 0,
|
||||
replay_moves_len: Array.isArray(payload?.recording?.instructions)
|
||||
? payload.recording.instructions.length
|
||||
: 0,
|
||||
};
|
||||
}, { stepCap: maxSteps, policyName: policy, maxVisits: maxVisitsPerState });
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ test("draw-mode toggle affects replay payload draw_mode", async ({ page }) => {
|
||||
|
||||
const payload = await page.evaluate(() => window.__FERROUS_DEBUG__.replayPayload());
|
||||
expect(payload.draw_mode).toBe("DrawThree");
|
||||
expect(payload.schema_version).toBe(2);
|
||||
expect(Array.isArray(payload.moves)).toBeTruthy();
|
||||
expect(payload.moves.length).toBeGreaterThan(0);
|
||||
expect(payload.schema_version).toBe(4);
|
||||
expect(Array.isArray(payload.recording?.instructions)).toBeTruthy();
|
||||
expect(payload.recording.instructions.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("autonomous play keeps invariants stable across seed batch", async ({ page }) => {
|
||||
|
||||
@@ -47,7 +47,7 @@ test("debug failure report contains replay diagnostics", async ({ page }) => {
|
||||
expect(report.invariants).toBeTruthy();
|
||||
});
|
||||
|
||||
test("replay payload builder exports schema-v2 moves", async ({ page }) => {
|
||||
test("replay payload builder exports a schema-v4 recording", async ({ page }) => {
|
||||
await page.goto("/play-classic?seed=42");
|
||||
await page.waitForFunction(() => typeof window.__FERROUS_DEBUG__ === "object");
|
||||
|
||||
@@ -57,10 +57,14 @@ test("replay payload builder exports schema-v2 moves", async ({ page }) => {
|
||||
.poll(async () => await page.evaluate(() => window.__FERROUS_DEBUG__.replayPayload() !== null))
|
||||
.toBe(true);
|
||||
const payload = await page.evaluate(() => window.__FERROUS_DEBUG__.replayPayload());
|
||||
expect(payload.schema_version).toBe(2);
|
||||
// Schema v4: the wasm layer assembles the whole payload; the deal is
|
||||
// embedded in `recording` and moves live at recording.instructions.
|
||||
expect(payload.schema_version).toBe(4);
|
||||
expect(payload.draw_mode).toMatch(/Draw(One|Three)/);
|
||||
expect(payload.mode).toBe("Classic");
|
||||
expect(Array.isArray(payload.moves)).toBeTruthy();
|
||||
expect(payload.moves.length).toBeGreaterThan(0);
|
||||
expect(payload.win_move_index).toBe(payload.moves.length - 1);
|
||||
expect(payload.recording).toBeTruthy();
|
||||
expect(payload.recording.initial_state).toBeTruthy();
|
||||
expect(Array.isArray(payload.recording.instructions)).toBeTruthy();
|
||||
expect(payload.recording.instructions.length).toBeGreaterThan(0);
|
||||
expect(payload.win_move_index).toBe(payload.recording.instructions.length - 1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user