github.com/GoogleCloudPlatform/testgrid@v0.0.174/hack/BUILD.bazel (about)

     1  package(default_visibility = ["//visibility:public"])
     2  
     3  py_test(
     4      name = "coalesce_test",
     5      size = "small",
     6      srcs = [
     7          "coalesce.py",
     8          "coalesce_test.py",
     9      ],
    10      python_version = "PY3",
    11      srcs_version = "PY3",
    12  )
    13  
    14  py_test(
    15      name = "verify_boilerplate",
    16      srcs = ["verify_boilerplate.py"],
    17      data = ["//:all-srcs"],
    18      python_version = "PY3",
    19      srcs_version = "PY3",
    20      tags = ["lint"],
    21  )
    22  
    23  MISSPELL = "@com_github_client9_misspell//cmd/misspell"
    24  
    25  sh_test(
    26      name = "verify-spelling",
    27      srcs = ["verify-spelling.sh"],
    28      args = [
    29          "$(location %s)" % MISSPELL,
    30          "--error",
    31      ],
    32      data = [
    33          "@//:all-srcs",
    34          MISSPELL,
    35      ],
    36      tags = ["lint"],
    37  )
    38  
    39  sh_binary(
    40      name = "update-spelling",
    41      srcs = ["update-spelling.sh"],
    42      args = [
    43          "$(location %s)" % MISSPELL,
    44          "-w",
    45      ],
    46      data = [
    47          "@//:all-srcs",
    48          MISSPELL,
    49      ],
    50      tags = ["lint"],
    51  )
    52  
    53  protoc = "@com_google_protobuf//:protoc"
    54  
    55  protoc_gen_go = "@com_github_golang_protobuf//protoc-gen-go"
    56  
    57  protoc_grpc = "plugins=grpc"
    58  
    59  # Use the protoc go_out plugin parameter to map the proto import path to the
    60  # Go package import path. Each mapping entry is prefixed with the keyword "M".
    61  # Reference the https://github.com/golang/protobuf "Parameters" section.
    62  proto_importmap = ",".join([
    63      "Mpb/config/config.proto=github.com/GoogleCloudPlatform/testgrid/pb/config",
    64      "Mpb/custom_evaluator/custom_evaluator.proto=github.com/GoogleCloudPlatform/testgrid/pb/custom_evaluator",
    65      "Mpb/response/types.proto=github.com/GoogleCloudPlatform/testgrid/pb/response",
    66      "Mpb/state/state.proto=github.com/GoogleCloudPlatform/testgrid/pb/state",
    67      "Mpb/summary/summary.proto=github.com/GoogleCloudPlatform/testgrid/pb/summary",
    68      "Mpb/test_status/test_status.proto=github.com/GoogleCloudPlatform/testgrid/pb/test_status",
    69      "Mpb/updater/updater.proto=github.com/GoogleCloudPlatform/testgrid/pb/updater",
    70  ])
    71  
    72  sh_binary(
    73      name = "update-protos",
    74      srcs = ["update-protos.sh"],
    75      args = [
    76          "$(location %s)" % protoc,
    77          "$(location %s)" % protoc_gen_go,
    78          "$(location %s)" % ":boilerplate/boilerplate.generated.go.txt",
    79          protoc_grpc,
    80          proto_importmap,
    81      ],
    82      data = [
    83          ":boilerplate/boilerplate.generated.go.txt",
    84          "//:all-srcs",
    85          "@com_google_protobuf//:timestamp_proto",
    86          protoc,
    87          protoc_gen_go,
    88      ],
    89      tags = ["local"],
    90  )
    91  
    92  sh_test(
    93      name = "verify-protos",
    94      srcs = ["verify-protos.sh"],
    95      args = [
    96          "$(location %s)" % ":update-protos",
    97          "$(location %s)" % protoc,
    98          "$(location %s)" % protoc_gen_go,
    99          "$(location %s)" % ":boilerplate/boilerplate.generated.go.txt",
   100          protoc_grpc,
   101          proto_importmap,
   102      ],
   103      data = [
   104          ":boilerplate/boilerplate.generated.go.txt",
   105          ":update-protos",
   106          "@com_google_protobuf//:timestamp_proto",
   107          protoc,
   108          protoc_gen_go,
   109          "@//:all-srcs",
   110      ],
   111      tags = ["lint"],
   112  )
   113  
   114  test_suite(
   115      name = "verify-all",
   116      tests = [
   117          ":verify-linters",
   118          # "@io_k8s_repo_infra//hack:verify-all", # TODO(fejta): golangci-lint
   119          "@io_k8s_repo_infra//hack:verify-bazel",
   120          # "@io_k8s_repo_infra//hack:verify-boilerplate", TODO(gmccloskey): make more flexible across repos
   121          "@io_k8s_repo_infra//hack:verify-deps",
   122          "@io_k8s_repo_infra//hack:verify-gofmt",
   123      ],
   124  )
   125  
   126  test_suite(
   127      name = "verify-linters",
   128      tags = ["lint"],  # picks up all non-manual targets with this tag
   129  )
   130  
   131  filegroup(
   132      name = "package-srcs",
   133      srcs = glob(["**"]),
   134      tags = ["automanaged"],
   135      visibility = ["//visibility:private"],
   136  )
   137  
   138  filegroup(
   139      name = "all-srcs",
   140      srcs = [":package-srcs"],
   141      tags = ["automanaged"],
   142      visibility = ["//visibility:public"],
   143  )