Skip to content

Commit

Permalink
fix: BCR presubmit (#38)
Browse files Browse the repository at this point in the history
- Add a child workspace to use as the BCR presubmit test.
- Update BCR presubmit config to run tests in the new workspace.

Related to
bazelbuild/bazel-central-registry#1390.
  • Loading branch information
cgrindel authored Jan 30, 2024
1 parent dd0effe commit 393dbf7
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 5 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/bcr_test
9 changes: 5 additions & 4 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module_path: test/bcr_test
matrix:
platform:
- centos7
Expand All @@ -6,8 +7,8 @@ matrix:
- macos
- windows
tasks:
verify_targets:
name: Verify build targets
run_test_module:
name: Run test module
platform: ${{ platform }}
build_targets:
- "@bazel_features//test:tests"
test_targets:
- "//..."
21 changes: 20 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,26 @@ concurrency:
cancel-in-progress: true

jobs:
test:
unit_tests:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v5
with:
folders: '["."]'
bcr_test:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v5
with:
folders: '["test/bcr_test"]'
exclude: |
[
{"bzlmodEnabled": false},
{"bazelversion": "5.4.0"}
]
test:
runs-on: ubuntu-latest
needs:
- unit_tests
- bcr_test
if: ${{ always() }}
steps:
- uses: cgrindel/gha_join_jobs@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions test/bcr_test/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
try-import %workspace%/.bazelrc.user
1 change: 1 addition & 0 deletions test/bcr_test/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.2
3 changes: 3 additions & 0 deletions test/bcr_test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load(":test.bzl", "bazel_features_test_suite")

bazel_features_test_suite(name = "bazel_features_test")
6 changes: 6 additions & 0 deletions test/bcr_test/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "bazel_features")
local_path_override(
module_name = "bazel_features",
path = "../..",
)
19 changes: 19 additions & 0 deletions test/bcr_test/test.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@bazel_features//:features.bzl", "bazel_features")
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")

"""Tests for `bazel_features` module."""

def _is_bzlmod_enabled_test(ctx):
env = unittest.begin(ctx)

asserts.true(env, bazel_features.external_deps.is_bzlmod_enabled)

return unittest.end(env)

is_bzlmod_enabled_test = unittest.make(_is_bzlmod_enabled_test)

def bazel_features_test_suite(name):
return unittest.suite(
name,
is_bzlmod_enabled_test,
)

0 comments on commit 393dbf7

Please sign in to comment.