Skip to content

build: check that build.zig and Makefile.cbm build the same sources - #116

Merged
ata-sesli merged 1 commit into
mainfrom
simplify/build-source-check
Nov 3, 2026
Merged

ata-sesli merged 1 commit into
mainfrom
simplify/build-source-check

Conversation

@ata-sesli

Copy link
Copy Markdown
Member

Summary

Fixes #111. CI now fails when build.zig and Makefile.cbm build different source files.

Problem

build.zig builds the PR CI binaries and test runners. Makefile.cbm builds the release binaries and the ASan test runner. Each keeps its own list of sources, and nothing compared them. A file added to build.zig but not to Makefile.cbm passed PR CI and only broke a release build or a Makefile test run. a330b01 fixed one such drift after the fact.

Change

  • scripts/check-build-sources.sh compares three groups and prints every file that only one build has:
    • prod: native_sources, the vendored sources and src/main.c in build.zig, against PROD_SRCS, the extraction sources and the vendored sources in Makefile.cbm;
    • test: all_test_sources against ALL_TEST_SRCS. It also checks that the focused build.zig runners (zova_test_sources, mcp_test_sources, pipeline_test_sources) only list tests that all_test_sources has;
    • zig: the .zig files build.zig reaches by @import from src/cbm_zig.zig and src/zova/cbm_zova_bridge.zig, against the .zig files Makefile.cbm lists as Zig library inputs (CBM_ZIG_SRCS, CBM_ZOVA_BRIDGE_ZIG_SRC).
  • Makefile.cbm gains a print-build-sources target, so the script reads the Makefile's resolved lists instead of parsing variables.
  • Allowed difference: vendored/tre/tre_all.c, the Windows regex library, which only Makefile.cbm builds because build.zig has no Windows target. It is listed in ALLOWED in the script, with the reason.
  • CI: the checks job runs the script, and tests/test_github_workflows.sh asserts that step exists.

The larger option in the issue, building releases with zig build and dropping the Makefile lists, is not part of this PR.

Verification

  • The check passes on this branch on macOS (bash 3.2, BSD awk, GNU make 3.81) and Fedora (GNU awk 5.3, GNU make 4).
  • It fails with the right file named for each of these temporary edits, reverted afterwards:
    • a test removed from Makefile.cbm;
    • a pipeline source removed from build.zig's native_sources;
    • src/cypher/parser.zig removed from CBM_ZIG_SRCS;
    • an unknown test added to mcp_test_sources only;
    • ts_runtime.c removed from addNativeSources.
  • tests/test_github_workflows.sh and git diff --check pass.
  • Not tested: mawk, the default awk on the ubuntu-latest runner. The new CI step runs there.

build.zig builds the PR CI binaries and test runners; Makefile.cbm builds
the release binaries and the ASan test runner. Each keeps its own source
list and nothing compared them, so a file missed in Makefile.cbm only
showed up in a release build or a Makefile test run (a330b01 fixed one
such drift).

scripts/check-build-sources.sh compares three groups:
- prod: native_sources, the vendored files and main.c in build.zig
  against PROD_SRCS and the vendored sources in Makefile.cbm;
- test: all_test_sources against ALL_TEST_SRCS, and checks the focused
  build.zig runners only use tests from all_test_sources;
- zig: the files build.zig reaches by @import from its roots against the
  .zig files in CBM_ZIG_SRCS.

Makefile.cbm gains a print-build-sources target that prints its resolved
lists. The only allowed difference is vendored/tre/tre_all.c, the Windows
regex library, since build.zig has no Windows target. CI runs the check
in the checks job.

Signed-off-by: ata-sesli <atasesli@protonmail.com>
@ata-sesli ata-sesli added this to the v2.1.0 milestone Nov 3, 2026
@ata-sesli
ata-sesli added this pull request to stack #120 November 3, 2026 20:14
@ata-sesli
ata-sesli merged commit eae8ad3 into main Nov 3, 2026
10 checks passed
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.

build.zig and Makefile.cbm keep separate source lists that nothing checks

1 participant