Skip to content

Commit

Permalink
Add BCR manifest and bzlmod E2E test (#298)
Browse files Browse the repository at this point in the history
I'm not really sure if this will work, it looks like we'll have to wing
it and see what happens.
  • Loading branch information
jchadwick-buf authored Jan 29, 2025
1 parent 79e5a7d commit a9e325f
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 0 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e2e/
15 changes: 15 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"homepage": "https://github.com/bufbuild/protovalidate",
"maintainers": [
{
"name": "Protovalidate Team",
"email": "[email protected]",
"github": "bcr-buf"
}
],
"repository": [
"github:bufbuild/protovalidate"
],
"versions": [],
"yanked_versions": {}
}
12 changes: 12 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bcr_test_module:
module_path: "e2e/bzlmod"
matrix:
platform: ["debian10", "macos"]
bazel: [7.x, 8.x]
tasks:
run_tests:
name: "Run test module"
platform: ${{ platform }}
bazel: ${{ bazel }}
test_targets:
- "//..."
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/archive/refs/tags/{TAG}.tar.gz"
}
1 change: 1 addition & 0 deletions e2e/bzlmod/.bazelrc
1 change: 1 addition & 0 deletions e2e/bzlmod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
33 changes: 33 additions & 0 deletions e2e/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2023 Buf Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_buf//buf:defs.bzl", "buf_lint_test")
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "example_proto",
srcs = [
"example.proto",
],
visibility = ["//visibility:public"],
deps = [
"@protovalidate//proto/protovalidate/buf/validate:validate_proto",
],
)

buf_lint_test(
name = "example_proto_lint",
config = "//:buf.yaml",
targets = [":example_proto"],
)
23 changes: 23 additions & 0 deletions e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Buf Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

bazel_dep(name = "protovalidate", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "protovalidate",
path = "../..",
)

bazel_dep(name = "rules_buf", version = "0.3.0")
bazel_dep(name = "protobuf", version = "29.2", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "7.1.0")
250 changes: 250 additions & 0 deletions e2e/bzlmod/MODULE.bazel.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions e2e/bzlmod/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: bufbuild
repository: protovalidate
commit: a3320276596649bcad929ac829d451f4
digest: shake256:a6e5f64fd3fd47e3e8568e9753f59a1566f56c11ec055baf65463d3bca3499f6f16c2d6f5628fa41cfd0f4fa7e72abe65be4efd77d269749492472ed4cc4070d
14 changes: 14 additions & 0 deletions e2e/bzlmod/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v1
deps:
- buf.build/bufbuild/protovalidate
lint:
use:
- STANDARD
except:
- DIRECTORY_SAME_PACKAGE
- PACKAGE_DEFINED
- PACKAGE_DIRECTORY_MATCH
- PACKAGE_SAME_DIRECTORY
breaking:
use:
- FILE
21 changes: 21 additions & 0 deletions e2e/bzlmod/example.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

import "buf/validate/validate.proto";

message TestMessage {
bool test_field = 1 [(buf.validate.field).bool.const = true];
}

0 comments on commit a9e325f

Please sign in to comment.