Skip to content

ci(bgfx): re-enable bgfx as a dedicated cached job - #295

Merged
apotema merged 1 commit into
mainfrom
ci/bgfx-cached-job
Jun 12, 2026
Merged

ci(bgfx): re-enable bgfx as a dedicated cached job#295
apotema merged 1 commit into
mainfrom
ci/bgfx-cached-job

Conversation

@apotema

@apotema apotema commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Re-enable the bgfx backend in CI as a dedicated, cached job. bgfx builds clean on Zig 0.16 now (zbgfx is on 0.12.0), and I verified locally on macOS that the backend tests pass and the standalone demo links + initializes the Metal renderer. The only reason it was gated off is the C++ compile cost — so this gives it its own job with actions/cache instead of inlining it into the matrix.

Changes (only .github/workflows/ci.yml)

  • Removed the stale if: false step "bgfx backend tests + cross-compile compile-check" in build-and-test. Its comment blamed "zbgfx-0.10.1's addCSourceFiles 0.16 migration" — stale (now 0.12.0). The step also ran four -Dtarget=... cross-compile checks; those are dropped (cross-compiling bgfx's C++ to 4 targets would multiply an already-expensive build; the host macOS/Metal target is what's verified).
  • Added job bgfx-build ("bgfx backend build + test (macOS)"):
    • runs-on: macos-latest — bgfx is verified there with Metal, and unlike raylib it has no hexops/xcode-frameworks transitive dep, so the macOS runner fetches + links cleanly.
    • Same sibling-checkout layout as build-and-test (labelle-assembler/ + labelle-gui/ for the flow-codegen path-dep), mlugg/setup-zig@v2 0.16.0.
    • actions/cache@v4 over ~/.cache/zig + ~/Library/Caches/zig + the bgfx .zig-cache dirs, keyed on hashFiles('.../backends/bgfx/build.zig.zon') with a bgfx-${{ runner.os }}- restore-key — so the compiled C++ persists between runs and a zbgfx bump busts the cache.
    • Runs cd backends/bgfx && zig build test then cd backends/bgfx/example && zig build.

Verification (macOS arm64, Zig 0.16.0)

  • YAML parses (yaml.safe_load).
  • backends/bgfxzig build test: pass.
  • backends/bgfx/examplezig build: pass (produces the Metal demo binary).

Note

The first CI run on this job will be slow (cold cache → full bgfx C++ compile, tens of minutes). Subsequent runs restore from the cache and are fast; a zbgfx version bump intentionally triggers one slow rebuild.

The build-and-test bgfx step was gated off with `if: false` and a
stale comment blaming zbgfx-0.10.1's 0.16-incompatible build.zig.
backends/bgfx/build.zig.zon now pins zbgfx 0.12.0, which builds clean
on Zig 0.16 (verified locally on macOS: backend tests + Metal example).

The real reason to keep bgfx out of the matrix is its C++ compile cost
(tens of minutes cold), so split it into a dedicated macos-latest job
that caches the Zig global cache + per-project .zig-cache, keyed on the
bgfx build.zig.zon so a zbgfx bump busts the cache. Runs the backend
`zig build test` and the standalone Metal example build.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@cursor

cursor Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Workflow-only change; no application code, with the main caveat that the first cold-cache run will be slow and cache invalidation depends on the .zon hash.

Overview
bgfx is back in CI without slowing the main build-and-test matrix. The old if: false step (stale Zig 0.16 / zbgfx excuse plus four cross-target zig build test runs) is removed from build-and-test.

A new bgfx-build job on macos-latest mirrors the sibling labelle-gui checkout and Zig 0.16.0 setup, then actions/cache@v4 over global and project Zig caches keyed on backends/bgfx/build.zig.zon. It runs backends/bgfx tests and builds the Metal standalone example only on the host macOS target—no Linux/Windows cross-compile gate.

Reviewed by Cursor Bugbot for commit 65632c1. Bugbot is set up for automated code reviews on this repo. Configure here.

@apotema
apotema merged commit 12f2634 into main Jun 12, 2026
5 checks passed
@apotema
apotema deleted the ci/bgfx-cached-job branch June 12, 2026 21:58
apotema added a commit that referenced this pull request Jun 13, 2026
Backend work since v0.39.1:
- wgpu: macOS Metal surface + textured sprite rendering (#290, #291)
- bgfx: macOS bring-up to on-device Android (#296 epic, #304/#305/#307/#308/#309)
- #310 AndroidBackendContext adapters: sokol (#312) + bgfx (#313) register the
  core seam; bgfx-Android gamepad via the shared android_gamepad sub-package
- bgfx desktop gamepad: GLFW (#315) + SDL HIDAPI / Switch-pad support (#318)
- cached bgfx CI job (#295)

Android codegen now calls core.registerAndroidBackend → requires
labelle-core >= v1.17.0 + labelle-engine >= v1.50.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant