From 96526cd635369b497bbde1131e8c7fd09fe0e1ad Mon Sep 17 00:00:00 2001 From: Alexandre Calvao Date: Mon, 29 Jun 2026 17:06:30 -0300 Subject: [PATCH] test(ci): verify the extracted out-of-tree bgfx backend (#386 Phase 6c) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bgfx is now extracted to its own repo, github.com/labelle-toolkit/labelle-bgfx (v0.1.0) — the first real backend to leave the assembler monorepo. It vendors the shared sdl_gamepad/android_gamepad sub-packages so the package is self-contained (an external backend can't reference the bundled `../` ones). This adds the OPT-IN verification (the default `.backend = .bgfx` shorthand flip is deferred until the package is validated against real games like FP): - examples/bgfx-external/: a bgfx game configured via `.backend_package = .{ .name="bgfx", .repo="github.com/labelle-toolkit/labelle-bgfx", .version="0.1.0" }` (local framework pins, like examples/bgfx). - a CI step in examples-integration that drives the assembler binary directly to `install` (fetch the package from GitHub) + `generate` (stage + codegen), asserts the package staged self-contained (manifest + vendored gamepad sub-packages) and wired `labelle_bgfx`, then resolves the FULL build graph (`zig build --help` → zbgfx/zglfw + the vendored sub-packages + url deps). It deliberately stops short of the heavy bgfx C++ compile — that's identical to the bundled backend and is covered by the dedicated cached `bgfx-build` job. Verified locally end-to-end (install→stage→generate→graph-resolve all green); this lands the CI regression coverage. --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++ examples/bgfx-external/.gitignore | 1 + examples/bgfx-external/project.labelle | 20 +++++++++++ examples/bgfx-external/scenes/main.jsonc | 31 +++++++++++++++++ examples/bgfx-external/scripts/.gitkeep | 0 5 files changed, 95 insertions(+) create mode 100644 examples/bgfx-external/.gitignore create mode 100644 examples/bgfx-external/project.labelle create mode 100644 examples/bgfx-external/scenes/main.jsonc create mode 100644 examples/bgfx-external/scripts/.gitkeep diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca626108..ab94fa8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -483,6 +483,49 @@ jobs: cd .labelle/wgpu_desktop zig build + # External (out-of-tree) backend wiring — bgfx extracted to its own + # repo (github.com/labelle-toolkit/labelle-bgfx, #386 Phase 6c). Proves + # the opt-in `.backend_package` path end-to-end: `install` FETCHES the + # backend package from GitHub into the cache, then `generate` stages it + # self-contained (vendored sdl_gamepad/android_gamepad come along) and + # codegens against its manifest. We then resolve the FULL generated build + # graph (`zig build --help` → fetches zbgfx/zglfw + resolves the vendored + # sub-packages + url deps) but do NOT run the heavy bgfx C++ compile — it + # is byte-identical to the bundled backend and is covered by the dedicated + # cached `bgfx-build` job. Bypasses labelle-cli (pinned older release) and + # drives the assembler binary directly, like the null step below. + - name: Verify the external (out-of-tree) bgfx backend wires up + run: | + ASM=$GITHUB_WORKSPACE/labelle-assembler/zig-out/bin/labelle-assembler + cd labelle-assembler/examples/bgfx-external + # `install` fetches the github backend_package into the cache; + # `generate` stages it + codegens (the assembler handles backend_package). + $ASM install --project-root . + $ASM generate --project-root . + + # The fetched package was staged SELF-CONTAINED (manifest + vendored + # gamepad sub-packages), and codegen wired the labelle_bgfx dependency. + test -f .labelle/deps/labelle-bgfx/backend.manifest.zon + test -d .labelle/deps/labelle-bgfx/sdl_gamepad + test -d .labelle/deps/labelle-bgfx/android_gamepad + grep -qF 'b.dependency("labelle_bgfx"' .labelle/bgfx_desktop/build.zig + + cd .labelle/bgfx_desktop + # Resolve the whole dep graph without the heavy C++ build. Patch the + # placeholder fingerprint the same way labelle-cli's runner does + # (mirrors the null step). + set +e + ERR=$(zig build --help 2>&1) + set -e + BAD=$(printf '%s\n' "$ERR" | grep -oE 'invalid fingerprint: 0x[0-9a-f]+' | head -1 | awk '{print $3}') + GOOD=$(printf '%s\n' "$ERR" | grep -oE 'use this value: 0x[0-9a-f]+' | head -1 | awk '{print $4}') + if [ -n "$BAD" ] && [ -n "$GOOD" ]; then + echo "labelle-cli-equivalent fixFingerprint: ${BAD} -> ${GOOD}" + sed -i "s/${BAD}/${GOOD}/" build.zig.zon + fi + zig build --help >/dev/null + echo "PASS: external bgfx fetched + staged self-contained + codegen + graph resolve OK" + # Hardware-free RUNTIME check of the shared sdl_gamepad source # (backends/sdl_gamepad/sim — see its README). Attaches an # in-process SDL2 virtual gamecontroller, drives every button and diff --git a/examples/bgfx-external/.gitignore b/examples/bgfx-external/.gitignore new file mode 100644 index 00000000..7781e868 --- /dev/null +++ b/examples/bgfx-external/.gitignore @@ -0,0 +1 @@ +.labelle/ diff --git a/examples/bgfx-external/project.labelle b/examples/bgfx-external/project.labelle new file mode 100644 index 00000000..92c09f4a --- /dev/null +++ b/examples/bgfx-external/project.labelle @@ -0,0 +1,20 @@ +.{ + .name = "example_bgfx_external", + .title = "LaBelle v2 — bgfx", + .backend_package = .{ .name = "bgfx", .repo = "github.com/labelle-toolkit/labelle-bgfx", .version = "0.1.0" }, + .y_axis = .up, + .ecs = .mock, + .core_version = "local:../../../labelle-core", + .engine_version = "local:../../../labelle-engine", + .gfx_version = "local:../../../labelle-gfx", + .labelle_version = "local:../../../labelle-cli", + .assembler_version = "local:../../", + .states = .{ "playing" }, + .layers = .{ + .{ .name = "far_background", .order = 0, .space = .screen }, + .{ .name = "terrain", .order = 1, .space = .world }, + .{ .name = "characters", .order = 2, .space = .world }, + .{ .name = "effects", .order = 3, .space = .world }, + .{ .name = "hud", .order = 4, .space = .screen }, + }, +} diff --git a/examples/bgfx-external/scenes/main.jsonc b/examples/bgfx-external/scenes/main.jsonc new file mode 100644 index 00000000..9e8823f5 --- /dev/null +++ b/examples/bgfx-external/scenes/main.jsonc @@ -0,0 +1,31 @@ +{ + // Main scene — example game + "name": "main", + "entities": [ + // Player entity + { + "name": "player", + "components": { + "Position": { "x": 400, "y": 300 }, + "Shape": { + "shape": { "rectangle": { "width": 32, "height": 32 } }, + "color": { "r": 60, "g": 120, "b": 220, "a": 255 }, + "layer": "characters", + "z_index": 5 + }, + "Velocity": { "x": 0, "y": 0 } + } + }, + // Title label + { + "components": { + "Position": { "x": 400, "y": 50 }, + "Text": { + "text": "LaBelle Example", + "size": 24, + "color": { "r": 255, "g": 255, "b": 255, "a": 255 } + } + } + } + ] +} diff --git a/examples/bgfx-external/scripts/.gitkeep b/examples/bgfx-external/scripts/.gitkeep new file mode 100644 index 00000000..e69de29b