chore(ci): add Justfile and codegen drift check - #7605
Open
pfeerick wants to merge 3 commits into
Open
Conversation
Wrap the three existing code generators in `just` recipes, and add a path-gated workflow that regenerates each in ghcr.io/edgetx/edgetx-dev and warns - without failing - when the committed output has drifted. None of make_fonts.sh, cfn_sorter.sh or generate-yaml.sh was referenced by CI, and the first two were undocumented, so there was no way to discover that editing radio/src/translations/i18n/*.h requires re-running them, and nothing detected when the committed artefacts fell out of sync. The check is deliberately non-failing: contributors without the local toolchain must not be blocked, so drift is reported as a job annotation plus a step summary diff. Also gitignore the intermediates both scripts leave behind when they abort (lv_font.inc, lz4_font, a.out), which would otherwise show up as drift. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The codegen recipes need the tools installed on the host - 19 system
locales, lv_font_conv, and a specific libclang. Most contributors will not
have those, but the dev container already does.
Add a docker- variant of each recipe, in their own just group, that runs
the same script in ghcr.io/edgetx/edgetx-dev. They invoke the scripts
directly rather than just-in-the-container, since the image does not ship
just. CI keeps using the plain recipes, as its jobs already run in that
image.
The container runs as the invoking user so generated files are not left
owned by root on Linux hosts.
docker-gen-yaml also points FETCHCONTENT_BASE_DIR at its own directory.
The default is ${CMAKE_SOURCE_DIR}/.cache/fetchcontent, which is inside the
bind mounted repo, so it would be shared with host builds - and CMake state
generated on a macOS host makes the container build fail when FetchContent
tries to reuse it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A Justfile change cannot cause drift - the recipes are thin wrappers, so editing one cannot change what the generators produce. It was still listed in all three per-generator filters, so touching it triggered three full regenerations, which is around ten minutes of CI. The docker- recipes made that worse, since the workflow never invokes them at all. What a Justfile change can do is rename a recipe out from under the jobs, which pass recipe names to the composite action. Check for that directly instead: the changes job now resolves the three recipes the workflow calls, which catches both renames and parse errors in well under a second. The drift jobs need the changes job, so broken recipes stop them running rather than failing three times over. That failure is deliberate - the never-fail behaviour covers drift, not a workflow that references a recipe which no longer exists. Also pins the just version once at workflow level, shared by the changes job and the composite action. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps the three existing code generators in
justrecipes — runnable either on the host or in the dev container — and adds a path-gated workflow that regenerates each one inghcr.io/edgetx/edgetx-dev:latestand warns, without failing, when the committed output has drifted.None of
make_fonts.sh,cfn_sorter.shorgenerate-yaml.shwas referenced by CI, so nothing detected when the committed artefacts fell out of sync with their sources. Two of the three were also undocumented (see #7604).Justfile
The recipes are thin wrappers — each script self-
cds and uses relative paths deliberately, to keep absolute paths out of the generated files, so nothing is reimplemented.Host group needs the tooling installed locally: 19 system locales,
lv_font_conv, and a specificlibclang. Most contributors won't have that (the locales part is fixed for Ubuntu by #7603).Docker group runs the same scripts in the dev container, which already has all of it. These invoke the scripts directly rather than
just-in-the-container, since the image doesn't shipjust. They also run as the invoking user, so generated files aren't left owned byrooton Linux hosts.CI keeps using the plain host recipes, since its jobs already run inside that image.
Workflow
One workflow, three drift jobs, gated per-generator by
dorny/paths-filterso adataconstants.hchange doesn't trigger a full font regeneration. Shared logic lives in a composite action under.github/actions/, following the existing convention there.The drift check never fails the build. This is deliberate — contributors without the local toolchain must not be blocked. Drift is reported as a job annotation plus the diff in the step summary; the job still concludes
success. Note a::warning::does not produce a neutral check, so the checks tab shows a green tick with the annotation attached.A Justfile change is handled separately, since it cannot cause drift — the recipes are wrappers, so editing one cannot change what a generator produces. What it can do is rename a recipe out from under the jobs, which pass recipe names to the composite action. So the
changesjob resolves the three recipes the workflow calls, catching renames and parse errors in well under a second rather than spending ~10 minutes regenerating everything. That check is allowed to fail: the never-fail behaviour covers drift, not a workflow referencing a recipe that no longer exists.Environment
ghcr.io/edgetx/edgetx-dev:latestalready has everything needed — verified againstdev/Dockerfileonbuild-edgetxmain:lv_font_conv, node 20,python3,build-essential, andlocale-genof all 19 locales, an exact match for the list incfn_sorter.sh. The apt block there is literally commented# For font generation and cfn sorting.Testing
Each recipe run end to end against a clean tree, on the host in the container and again through the
docker-variants:cfn-sortgen-fontsgen-yamlyaml_databuilt, byte-identicalSo there is no existing drift. The drift-check logic was exercised for all four cases — clean tree, modified tracked file, untracked generated file, and an oversized diff — each exiting 0. The recipe validation was checked against both a renamed recipe and a malformed Justfile.
actionlintis clean andjust --fmt --checkpasses.Testing the docker variants turned up one real defect worth calling out:
docker-gen-yamlfailed outright, becauseFETCHCONTENT_BASE_DIRdefaults to${CMAKE_SOURCE_DIR}/.cache/fetchcontent(CMakeLists.txt#L46) — inside the bind-mounted repo. The container therefore inherits whatever CMake state host builds left there, and macOS-generated googletest subbuild state makes the Linux configure fail. Anyone who had built natively first would have hit it. Fixed by pointing the container at its own.cache/fetchcontent-dockervia the env var CMakeLists.txt#L42 already honours — still cached between runs, still gitignored, but isolated from host builds.Also
Gitignores the intermediates
make_fonts.shandcfn_sorter.shleave behind if interrupted (lv_font.inc,lz4_font,tools/a.out), which would otherwise show up as drift.Possible follow-up
Adding
justto theedgetx-devimage would let both the workflow and the composite action drop their install step, and collapse the whole docker group into a single genericjust docker <recipe>wrapper.🤖 Generated with Claude Code