Skip to content

test(integration): add dual-mode bazel-in-bazel sanity test#1557

Open
novas0x2a wants to merge 1 commit into
mainfrom
bzlmod-integration-sanity
Open

test(integration): add dual-mode bazel-in-bazel sanity test#1557
novas0x2a wants to merge 1 commit into
mainfrom
bzlmod-integration-sanity

Conversation

@novas0x2a
Copy link
Copy Markdown
Collaborator

Adds a single bazel_integration_test scenario that builds a cmake static
library exactly as docs/src/index.md tells users to — regression coverage on
the basic entry point, to land as a stable baseline before the larger bzlmod
hub-and-spoke rework builds on top of it.

The scenario ships both a MODULE.bazel and a WORKSPACE.bazel, and the inner
build runs in whichever pure mode the outer Bazel uses (detected via
bzlmod_enabled.bzl, passed through runner.sh). So bazel test under
--enable_workspace exercises the WORKSPACE path and --enable_bzlmod exercises
the MODULE.bazel path — the same coverage CI's bzlmod/workspaces lanes give.

To support this:

  • Declare the rules_bazel_integration_test harness in both MODULE.bazel and
    the root WORKSPACE.bazel, so the test loads in both modes.
  • Add a top-level //:distribution filegroup staging the rfcc source tree into
    the inner workspace's runfiles for its local_path_override.
  • Import .bazelrc.deleted_packages (generated by
    @rules_bazel_integration_test//tools:update_deleted_packages) so the outer
    Bazel skips the inner scenario package.
  • Pregenerate and commit the inner MODULE.bazel.lock and enforce it with
    --lockfile_mode=error, mirroring parent CI.
  • Add REPO.bazel ignoring bazel-* convenience symlinks at the traversal
    level (glob excludes are a post-filter, not a traversal guard, so they'd
    otherwise trip InconsistentFilesystemException under concurrent
    bazel test //...), and gitignore them.

Add a single bazel_integration_test scenario that builds a cmake static
library exactly as docs/src/index.md tells users to. The scenario ships
both a MODULE.bazel and a WORKSPACE.bazel; the inner build runs in
whichever pure mode the outer Bazel uses (detected via bzlmod_enabled.bzl,
passed through runner.sh), so a local `bazel test` under --enable_workspace
exercises the WORKSPACE path and one under --enable_bzlmod exercises the
MODULE.bazel path -- the same coverage CI's bzlmod/workspaces lanes give.

To support this:

- Declare the rules_bazel_integration_test harness in both MODULE.bazel
  (dev-dep + bazel_binaries extension) and the root WORKSPACE.bazel, so the
  test loads in both modes.
- Add a top-level //:distribution filegroup aggregating per-package
  distribution filegroups, staging the rfcc source tree into the inner
  workspace's runfiles for local_path_override.
- Import .bazelrc.deleted_packages so the outer Bazel skips the inner
  scenario package.
- Pregenerate and commit the inner MODULE.bazel.lock (schema 24, Bazel
  8.6.0) and enforce it with --lockfile_mode=error, mirroring parent CI.
- Add REPO.bazel ignoring bazel-* convenience symlinks at the traversal
  level (glob excludes are a post-filter, not a traversal guard), and
  gitignore the inner symlinks.
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